/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-09-07 07:55:25 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-20060907075525-3838cb1cd932379d
Merge from Richard Ferguson's development branch.

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 launch import launch
 
35
 
34
36
class OliveMenu:
35
37
    """ This class is responsible for building the context menus. """
36
38
    def __init__(self, gladefile, comm, dialog):
65
67
                                       _('Remove'), None,
66
68
                                       _('Remove the selected file'),
67
69
                                       self.remove_file),
 
70
                                      ('open', gtk.STOCK_OPEN,
 
71
                                       _('Open'), None,
 
72
                                       _('Open the selected file'),
 
73
                                       self.open_file),
68
74
                                      ('commit', None,
69
75
                                       _('Commit'), None,
70
76
                                       _('Commit the changes'),
85
91
                                       _('Remove'), None,
86
92
                                       _('Remove the selected bookmark'),
87
93
                                       self.remove_bookmark),
 
94
                                      ('open_folder', gtk.STOCK_OPEN,
 
95
                                       _('Open Folder'), None,
 
96
                                       _('Open bookmark folder in Nautilus'),
 
97
                                       self.open_folder),
88
98
                                      ('diff_selected', None,
89
99
                                       _('Selected...'), None,
90
100
                                       _('Show the differences of the selected file'),
170
180
        
171
181
        self.comm.refresh_right()
172
182
 
 
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
 
173
205
    def commit(self, action):
174
206
        """ Right context menu -> Commit """
175
207
        from commit import OliveCommit
196
228
    def edit_bookmark(self, action):
197
229
        """ Left context menu -> Edit """
198
230
        from bookmark import OliveBookmark
199
 
        bookmark = OliveBookmark(self.gladefile, self.comm, self.dialog)
200
 
        bookmark.display()
 
231
 
 
232
        if self.comm.get_selected_left() != None:
 
233
            bookmark = OliveBookmark(self.gladefile, self.comm, self.dialog)
 
234
            bookmark.display()
201
235
 
202
236
    def remove_bookmark(self, action):
203
237
        """ Left context menu -> Remove """
204
 
        self.comm.pref.remove_bookmark(self.comm.get_selected_left())
205
238
        
206
 
        self.comm.refresh_left()
 
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)
207
249
    
208
250
    def diff_selected(self, action):
209
251
        """ Diff toolbutton -> Selected... """