/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/menu.py

  • Committer: Jelmer Vernooij
  • Date: 2006-09-06 00:23:46 UTC
  • mto: (0.8.83 merge)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060906002346-73aa11b52d4d7b96
Load plugins on startup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
except:
29
29
    sys.exit(1)
30
30
 
31
 
import olive.backend.fileops as fileops
32
 
import olive.backend.errors as errors
33
 
 
34
 
from launch import launch
 
31
import bzrlib.errors as errors
35
32
 
36
33
class OliveMenu:
37
34
    """ This class is responsible for building the context menus. """
67
64
                                       _('Remove'), None,
68
65
                                       _('Remove the selected file'),
69
66
                                       self.remove_file),
70
 
                                      ('open', gtk.STOCK_OPEN,
71
 
                                       _('Open'), None,
72
 
                                       _('Open the selected file'),
73
 
                                       self.open_file),
74
67
                                      ('commit', None,
75
68
                                       _('Commit'), None,
76
69
                                       _('Commit the changes'),
91
84
                                       _('Remove'), None,
92
85
                                       _('Remove the selected bookmark'),
93
86
                                       self.remove_bookmark),
94
 
                                      ('open_folder', gtk.STOCK_OPEN,
95
 
                                       _('Open Folder'), None,
96
 
                                       _('Open bookmark folder in Nautilus'),
97
 
                                       self.open_folder),
98
87
                                      ('diff_selected', None,
99
88
                                       _('Selected...'), None,
100
89
                                       _('Show the differences of the selected file'),
144
133
            return
145
134
        
146
135
        try:
147
 
            fileops.add([directory + '/' + filename])
 
136
            bzrlib.add.smart_add([directory + '/' + filename])
148
137
        except errors.NotBranchError:
149
138
            self.dialog.error_dialog(_('Directory is not a branch'),
150
139
                                     _('You can perform this action only in a branch.'))
151
140
            return
152
 
        except:
153
 
            raise
154
141
        
155
142
        self.comm.refresh_right()
156
143
    
166
153
            return
167
154
        
168
155
        try:
169
 
            fileops.remove([directory + '/' + filename])
 
156
            wt, path = WorkingTree.open_containing(directory+'/'+filename)
 
157
            wt.remove(path)
 
158
 
170
159
        except errors.NotBranchError:
171
160
            self.dialog.error_dialog(_('Directory is not a branch'),
172
161
                                     _('You can perform this action only in a branch.'))
180
169
        
181
170
        self.comm.refresh_right()
182
171
 
183
 
    def open_file(self, action):
184
 
        """ Right context menu -> Open """
185
 
        # Open only the selected file
186
 
        filename = self.comm.get_selected_right()
187
 
        
188
 
        if filename is None:
189
 
            self.dialog.error_dialog(_('No file was selected'),
190
 
                                     _('Please select a file from the list,\nor choose the other option.'))
191
 
            return
192
 
 
193
 
        if filename == '..':
194
 
            self.comm.set_path(os.path.split(self.comm.get_path())[0])
195
 
        else:
196
 
            fullpath = self.comm.get_path() + os.sep + filename
197
 
            if os.path.isdir(fullpath):
198
 
                # selected item is an existant directory
199
 
                self.comm.set_path(fullpath)
200
 
            else:
201
 
                launch(fullpath) 
202
 
        
203
 
        self.comm.refresh_right()
204
 
 
205
172
    def commit(self, action):
206
173
        """ Right context menu -> Commit """
207
174
        from commit import OliveCommit
228
195
    def edit_bookmark(self, action):
229
196
        """ Left context menu -> Edit """
230
197
        from bookmark import OliveBookmark
231
 
 
232
 
        if self.comm.get_selected_left() != None:
233
 
            bookmark = OliveBookmark(self.gladefile, self.comm, self.dialog)
234
 
            bookmark.display()
 
198
        bookmark = OliveBookmark(self.gladefile, self.comm, self.dialog)
 
199
        bookmark.display()
235
200
 
236
201
    def remove_bookmark(self, action):
237
202
        """ Left context menu -> Remove """
 
203
        self.comm.pref.remove_bookmark(self.comm.get_selected_left())
238
204
        
239
 
        if self.comm.get_selected_left() != None:
240
 
            self.comm.pref.remove_bookmark(self.comm.get_selected_left())
241
 
            self.comm.refresh_left()
242
 
    
243
 
    def open_folder(self, action):
244
 
        """ Left context menu -> Open Folder """
245
 
        path = self.comm.get_selected_left()
246
 
 
247
 
        if path != None:
248
 
            launch(path)
 
205
        self.comm.refresh_left()
249
206
    
250
207
    def diff_selected(self, action):
251
208
        """ Diff toolbutton -> Selected... """