/[ascend]/trunk/pygtk/canvas/contextmenutool.py
ViewVC logotype

Diff of /trunk/pygtk/canvas/contextmenutool.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2199 by arijit, Fri Sep 4 06:50:08 2009 UTC revision 2200 by grivan, Thu May 20 05:17:35 2010 UTC
# Line 1  Line 1 
1    
2  from gaphas.tool import Tool  from gaphas.tool import Tool
3  import pygtk  import pygtk
4  pygtk.require('2.0')  pygtk.require('2.0')
# Line 16  class ContextMenuTool(Tool): Line 17  class ContextMenuTool(Tool):
17      """      """
18      def __init__(self):      def __init__(self):
19          pass          pass
20                
21      def on_button_press(self, context, event):      def on_button_press(self, event):
22            context = self.view.tool
23          if event.button != 3:          if event.button != 3:
24              context.ungrab()              context.ungrab(self.view.tool)
25              return False              return False
26          if context.view.hovered_item:          if context.view.hovered_item:
27              menu = gtk.Menu()              menu = gtk.Menu()
# Line 46  class ContextMenuTool(Tool): Line 48  class ContextMenuTool(Tool):
48                  menuinfo.set_sensitive(False)                  menuinfo.set_sensitive(False)
49              menu.show_all()              menu.show_all()
50              menu.popup( None, None, None, event.button, event.time)              menu.popup( None, None, None, event.button, event.time)
51              context.ungrab()              self.view.tool.ungrab(self.view.tool)
52              return True              return True
53    
54      def info(self,widget,window,context,item):      def info(self,widget,window,context,item):

Legend:
Removed from v.2199  
changed lines
  Added in v.2200

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22