/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-11 02:56:58 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-20060911025658-997cf3a305b9f1da
A better implementation for the drive selection. (OptionMenu didn't work on Win32)

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'),
77
83
                                       _('Bookmark'), None,
78
84
                                       _('Bookmark current location'),
79
85
                                       self.bookmark),
 
86
                                      ('edit_bookmark', gtk.STOCK_EDIT,
 
87
                                       _('Edit'), None,
 
88
                                       _('Edit the selected bookmark'),
 
89
                                       self.edit_bookmark),
80
90
                                      ('remove_bookmark', gtk.STOCK_REMOVE,
81
91
                                       _('Remove'), None,
82
92
                                       _('Remove the selected bookmark'),
83
93
                                       self.remove_bookmark),
 
94
                                      ('open_folder', gtk.STOCK_OPEN,
 
95
                                       _('Open Folder'), None,
 
96
                                       _('Open bookmark folder in Nautilus'),
 
97
                                       self.open_folder),
84
98
                                      ('diff_selected', None,
85
99
                                       _('Selected...'), None,
86
100
                                       _('Show the differences of the selected file'),
166
180
        
167
181
        self.comm.refresh_right()
168
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
 
169
205
    def commit(self, action):
170
206
        """ Right context menu -> Commit """
171
207
        from commit import OliveCommit
189
225
        
190
226
        self.comm.refresh_left()
191
227
 
 
228
    def edit_bookmark(self, action):
 
229
        """ Left context menu -> Edit """
 
230
        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()
 
235
 
192
236
    def remove_bookmark(self, action):
193
237
        """ Left context menu -> Remove """
194
 
        self.comm.pref.remove_bookmark(self.comm.get_selected_left())
195
238
        
196
 
        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)
197
249
    
198
250
    def diff_selected(self, action):
199
251
        """ Diff toolbutton -> Selected... """