/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-08 18:32:32 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-20060808183232-e27b1b45f7487da8
Implemented bookmarking.

2006-08-08  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
    * olive/frontend/gtk/menu.py: Added left context menu + Bookmark option
    * olive/frontend/gtk/__init__.py: load bookmarks into the left panel
    * olive/frontend/gtk/handler.py: implemented signal handlers for left panel
    * olive.glade: added signals for the bookmark TreeView
    * cmenu.ui: added description for bookmark context menu

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
        self.comm = comm
48
48
        self.dialog = dialog
49
49
        
50
 
        self.ui_right = gtk.UIManager()
51
 
        
52
 
        self.actiongroup_right = gtk.ActionGroup('context_right')
53
 
        self.actiongroup_right.add_actions([('add', gtk.STOCK_ADD,
54
 
                                             'Add', None,
55
 
                                             'Add the selected file',
56
 
                                             self.add_file),
57
 
                                            ('remove', gtk.STOCK_REMOVE,
58
 
                                             'Remove', None,
59
 
                                             'Remove the selected file',
60
 
                                             self.remove_file),
61
 
                                            ('commit', gtk.STOCK_REDO,
62
 
                                             'Commit', None,
63
 
                                             'Commit the changes',
64
 
                                             self.commit),
65
 
                                            ('diff', None,
66
 
                                             'Diff', None,
67
 
                                             'Show the diff of the file',
68
 
                                             self.diff),
69
 
                                            ('log', None,
70
 
                                             'Log', None,
71
 
                                             'Show the log of the file',
72
 
                                             self.log)])
73
 
        
74
 
        self.ui_right.insert_action_group(self.actiongroup_right, 0)
75
 
        self.ui_right.add_ui_from_file(self.uifile)
76
 
        
77
 
        self.cmenu_right = self.ui_right.get_widget('/context_right')
 
50
        # Create the file list context menu
 
51
        self.ui = gtk.UIManager()
 
52
        
 
53
        self.actiongroup = gtk.ActionGroup('context')
 
54
        self.actiongroup.add_actions([('add', gtk.STOCK_ADD,
 
55
                                       'Add', None,
 
56
                                       'Add the selected file',
 
57
                                       self.add_file),
 
58
                                      ('remove', gtk.STOCK_REMOVE,
 
59
                                       'Remove', None,
 
60
                                       'Remove the selected file',
 
61
                                       self.remove_file),
 
62
                                      ('commit', gtk.STOCK_REDO,
 
63
                                       'Commit', None,
 
64
                                       'Commit the changes',
 
65
                                       self.commit),
 
66
                                      ('diff', None,
 
67
                                       'Diff', None,
 
68
                                       'Show the diff of the file',
 
69
                                       self.diff),
 
70
                                      ('log', None,
 
71
                                       'Log', None,
 
72
                                       'Show the log of the file',
 
73
                                       self.log),
 
74
                                      ('bookmark', None,
 
75
                                       'Bookmark', None,
 
76
                                       'Bookmark current location',
 
77
                                       self.bookmark),
 
78
                                      ('remove_bookmark', gtk.STOCK_REMOVE,
 
79
                                       'Remove', None,
 
80
                                       'Remove the selected bookmark',
 
81
                                       self.remove_bookmark)
 
82
                                     ])
 
83
        
 
84
        self.ui.insert_action_group(self.actiongroup, 0)
 
85
        self.ui.add_ui_from_file(self.uifile)
 
86
        
 
87
        self.cmenu_right = self.ui.get_widget('/context_right')
 
88
        
 
89
        self.cmenu_left = self.ui.get_widget('/context_left')
78
90
 
79
91
    def right_context_menu(self):
80
92
        return self.cmenu_right
81
93
    
 
94
    def left_context_menu(self):
 
95
        return self.cmenu_left
 
96
    
82
97
    def add_file(self, action):
83
98
        """ Right context menu -> Add """
84
99
        # Add only the selected file
135
150
    def log(self, action):
136
151
        """ Right context menu -> Log """
137
152
        self.dialog.error_dialog('This feature is not yet implemented.')
 
153
    
 
154
    def bookmark(self, action):
 
155
        """ Right context menu -> Bookmark """
 
156
        if self.comm.pref.add_bookmark(self.comm.get_path()):
 
157
            self.dialog.info_dialog('Bookmark successfully added.')
 
158
        else:
 
159
            self.dialog.warning_dialog('Location already bookmarked.')
 
160
        
 
161
        self.comm.refresh_left()
 
162
 
 
163
    def remove_bookmark(self, action):
 
164
        """ Left context menu -> Remove """
 
165
        self.comm.pref.remove_bookmark(self.comm.get_selected_left())
 
166
        
 
167
        self.comm.refresh_left()