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

  • Committer: Jelmer Vernooij
  • Date: 2006-09-13 20:19:31 UTC
  • mfrom: (0.8.79 main)
  • mto: (0.8.83 merge)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060913201931-23adba246d4d6529
Merge main branch.

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. """
263
265
    def on_treeview_left_button_press_event(self, widget, event):
264
266
        """ Occurs when somebody right-clicks in the bookmark list. """
265
267
        if event.button == 3:
 
268
            # Don't show context with nothing selected
 
269
            if self.comm.get_selected_left() == None:
 
270
                return
 
271
 
266
272
            self.menu.left_context_menu().popup(None, None, None, 0,
267
273
                                                event.time)
268
274
        
269
275
    def on_treeview_left_row_activated(self, treeview, path, view_column):
270
276
        """ Occurs when somebody double-clicks or enters an item in the
271
277
        bookmark list. """
 
278
 
 
279
        newdir = self.comm.get_selected_left()
 
280
        if newdir == None:
 
281
            return
 
282
 
272
283
        self.comm.set_busy(treeview)
273
 
        
274
 
        newdir = self.comm.get_selected_left()
275
284
        self.comm.set_path(newdir)
276
 
        
277
285
        self.comm.refresh_right()
278
 
        
279
286
        self.comm.set_busy(treeview, False)
280
287
    
281
288
    def on_treeview_right_button_press_event(self, widget, event):
312
319
        if newdir == '..':
313
320
            self.comm.set_path(os.path.split(self.comm.get_path())[0])
314
321
        else:
315
 
            fullpath = self.comm.get_path() + '/' + newdir
 
322
            fullpath = self.comm.get_path() + os.sep + newdir
316
323
            if os.path.isdir(fullpath):
317
324
                # selected item is an existant directory
318
325
                self.comm.set_path(fullpath)
319
326
            else:
320
 
                if sys.platform == 'win32':
321
 
                    # open the file with the default application
322
 
                    os.startfile(fullpath)
323
 
                else:
324
 
                    # TODO: support other OSes
325
 
                    print "DEBUG: double-click on non-Win32 platforms not supported."
 
327
                launch(fullpath) 
326
328
        
327
329
        self.comm.refresh_right()
328
330