/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/handler.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:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
import os
17
18
import sys
18
19
 
19
20
try:
32
33
 
33
34
from dialog import OliveDialog
34
35
from menu import OliveMenu
 
36
from launch import launch
35
37
 
36
38
class OliveHandler:
37
39
    """ Signal handler class for Olive. """
70
72
        commit = OliveCommit(self.gladefile, self.comm, self.dialog)
71
73
        commit.display()
72
74
    
 
75
    def on_menuitem_branch_missing_revisions_activate(self, widget):
 
76
        """ Branch/Missing revisions menu handler. """
 
77
        import olive.backend.update as update
 
78
        
 
79
        self.comm.set_busy(self.comm.window_main)
 
80
        
 
81
        try:
 
82
            ret = update.missing(self.comm.get_path())
 
83
        except errors.NotBranchError:
 
84
            self.dialog.error_dialog(_('Directory is not a branch'),
 
85
                                     _('You can perform this action only in a branch.'))
 
86
        except errors.ConnectionError:
 
87
            self.dialog.error_dialog(_('Connection error'),
 
88
                                     _('Cannot connect to remote location.\nPlease try again later.'))
 
89
        except errors.NoLocationKnown:
 
90
            self.dialog.error_dialog(_('Parent location is unknown'),
 
91
                                     _('Cannot determine missing revisions if no parent location is known.'))
 
92
        else:
 
93
            if ret > 0:
 
94
                self.dialog.info_dialog(_('There are missing revisions'),
 
95
                                        _('%d revision(s) missing.') % ret)
 
96
            else:
 
97
                self.dialog.info_dialog(_('Local branch up to date'),
 
98
                                        _('There are no missing revisions.'))
 
99
        
 
100
        self.comm.set_busy(self.comm.window_main, False)
 
101
    
73
102
    def on_menuitem_branch_pull_activate(self, widget):
74
103
        """ Branch/Pull menu handler. """
75
104
        import olive.backend.update as update
186
215
    def on_treeview_left_button_press_event(self, widget, event):
187
216
        """ Occurs when somebody right-clicks in the bookmark list. """
188
217
        if event.button == 3:
 
218
            # Don't show context with nothing selected
 
219
            if self.comm.get_selected_left() == None:
 
220
                return
 
221
 
189
222
            self.menu.left_context_menu().popup(None, None, None, 0,
190
223
                                                event.time)
191
224
        
192
225
    def on_treeview_left_row_activated(self, treeview, path, view_column):
193
226
        """ Occurs when somebody double-clicks or enters an item in the
194
227
        bookmark list. """
 
228
 
 
229
        newdir = self.comm.get_selected_left()
 
230
        if newdir == None:
 
231
            return
 
232
 
195
233
        self.comm.set_busy(treeview)
196
 
        
197
 
        newdir = self.comm.get_selected_left()
198
234
        self.comm.set_path(newdir)
199
 
        
200
235
        self.comm.refresh_right()
201
 
        
202
236
        self.comm.set_busy(treeview, False)
203
237
    
204
238
    def on_treeview_right_button_press_event(self, widget, event):
233
267
        if newdir == '..':
234
268
            self.comm.set_path(os.path.split(self.comm.get_path())[0])
235
269
        else:
236
 
            fullpath = self.comm.get_path() + '/' + newdir
 
270
            fullpath = self.comm.get_path() + os.sep + newdir
237
271
            if os.path.isdir(fullpath):
238
272
                # selected item is an existant directory
239
273
                self.comm.set_path(fullpath)
240
274
            else:
241
 
                if sys.platform == 'win32':
242
 
                    # open the file with the default application
243
 
                    os.startfile(fullpath)
244
 
                else:
245
 
                    # TODO: support other OSes
246
 
                    print "DEBUG: double-click on non-Win32 platforms not supported."
 
275
                launch(fullpath) 
247
276
        
248
277
        self.comm.refresh_right()
249
278