/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/frontend/gtk/menu.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-15 20:26:53 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060815202653-e68d2a2de099b97b
Major updates in the OliveMenu class.

2006-08-15  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * olive/frontend/gtk/menu.py: upgraded according to the OliveDialog API
      changes; HIGify; load proper icons
    * olive.glade: Close button should be the default on the Informations window

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import olive.backend.fileops as fileops
32
32
import olive.backend.errors as errors
33
33
 
34
 
from commit import OliveCommit
35
 
from diff import OliveDiff
36
 
 
37
34
class OliveMenu:
38
35
    """ This class is responsible for building the context menus. """
39
36
    def __init__(self, gladefile, comm, dialog):
59
56
                                       'Remove', None,
60
57
                                       'Remove the selected file',
61
58
                                       self.remove_file),
62
 
                                      ('commit', gtk.STOCK_REDO,
 
59
                                      ('commit', None,
63
60
                                       'Commit', None,
64
61
                                       'Commit the changes',
65
62
                                       self.commit),
87
84
        self.cmenu_right = self.ui.get_widget('/context_right')
88
85
        
89
86
        self.cmenu_left = self.ui.get_widget('/context_left')
 
87
        
 
88
        # Set icons
 
89
        commit_menu = self.ui.get_widget('/context_right/commit')
 
90
        commit_image = self.comm.menuitem_branch_commit.get_image()
 
91
        commit_pixbuf = commit_image.get_pixbuf()
 
92
        commit_icon = gtk.Image()
 
93
        commit_icon.set_from_pixbuf(commit_pixbuf)
 
94
        commit_menu.set_image(commit_icon)
 
95
        diff_menu = self.ui.get_widget('/context_right/diff')
 
96
        diff_image = self.comm.menuitem_stats_diff.get_image()
 
97
        diff_pixbuf = diff_image.get_pixbuf()
 
98
        diff_icon = gtk.Image()
 
99
        diff_icon.set_from_pixbuf(diff_pixbuf)
 
100
        diff_menu.set_image(diff_icon)
 
101
        log_menu = self.ui.get_widget('/context_right/log')
 
102
        log_image = self.comm.menuitem_stats_log.get_image()
 
103
        log_pixbuf = log_image.get_pixbuf()
 
104
        log_icon = gtk.Image()
 
105
        log_icon.set_from_pixbuf(log_pixbuf)
 
106
        log_menu.set_image(log_icon)
90
107
 
91
108
    def right_context_menu(self):
92
109
        return self.cmenu_right
101
118
        filename = self.comm.get_selected_right()
102
119
            
103
120
        if filename is None:
104
 
            self.dialog.error_dialog('No file was selected.')
 
121
            self.dialog.error_dialog('No file was selected',
 
122
                                     'Please select a file from the list,\nor choose the other option.')
105
123
            return
106
124
        
107
125
        try:
108
126
            fileops.add([directory + '/' + filename])
109
127
        except errors.NotBranchError:
110
 
            self.dialog.error_dialog('The directory is not a branch.')
 
128
            self.dialog.error_dialog('Directory is not a branch',
 
129
                                     'You can perform this action only in a branch.')
111
130
            return
112
131
        except:
113
132
            raise
121
140
        filename = self.comm.get_selected_right()
122
141
        
123
142
        if filename is None:
124
 
            self.dialog.error_dialog('No file was selected.')
 
143
            self.dialog.error_dialog('No file was selected',
 
144
                                     'Please select a file from the list,\nor choose the other option.')
125
145
            return
126
146
        
127
147
        try:
128
148
            fileops.remove([directory + '/' + filename])
129
149
        except errors.NotBranchError:
130
 
            self.dialog.error_dialog('The directory is not a branch.')
 
150
            self.dialog.error_dialog('Directory is not a branch',
 
151
                                     'You can perform this action only in a branch.')
131
152
            return
132
153
        except errors.NotVersionedError:
133
 
            self.dialog.error_dialog('Selected file is not versioned.')
 
154
            self.dialog.error_dialog('File not versioned',
 
155
                                     'The selected file is not versioned.')
134
156
            return
135
157
        except:
136
158
            raise
139
161
 
140
162
    def commit(self, action):
141
163
        """ Right context menu -> Commit """
142
 
        commit = OliveCommit(self.gladefile, self.comm)
 
164
        from commit import OliveCommit
 
165
        commit = OliveCommit(self.gladefile, self.comm, self.dialog)
143
166
        commit.display()
144
167
    
145
168
    def diff(self, action):
146
169
        """ Right context menu -> Diff """
147
 
        diff = OliveDiff(self.gladefile, self.comm)
 
170
        from diff import OliveDiff
 
171
        diff = OliveDiff(self.gladefile, self.comm, self.dialog)
148
172
        diff.display()
149
173
    
150
174
    def log(self, action):
151
175
        """ Right context menu -> Log """
152
 
        self.dialog.error_dialog('This feature is not yet implemented.')
 
176
        from log import OliveLog
 
177
        log = OliveLog(self.gladefile, self.comm, self.dialog)
 
178
        log.display()
153
179
    
154
180
    def bookmark(self, action):
155
181
        """ Right context menu -> Bookmark """
156
182
        if self.comm.pref.add_bookmark(self.comm.get_path()):
157
 
            self.dialog.info_dialog('Bookmark successfully added.')
 
183
            self.dialog.info_dialog('Bookmark successfully added',
 
184
                                    'The current directory was bookmarked. You can reach\nit by selecting it from the left panel.')
158
185
        else:
159
 
            self.dialog.warning_dialog('Location already bookmarked.')
 
186
            self.dialog.warning_dialog('Location already bookmarked'
 
187
                                       'The current directory is already bookmarked.\nSee the left panel for reference.')
160
188
        
161
189
        self.comm.refresh_left()
162
190