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

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

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

revision 1937 by jpye, Mon Oct 27 09:58:54 2008 UTC revision 1938 by jpye, Thu Oct 30 02:12:24 2008 UTC
# Line 167  class app(gtk.Window): Line 167  class app(gtk.Window):
167          self.set_title("ASCEND Blocks")          self.set_title("ASCEND Blocks")
168          self.set_default_size(400, 500)          self.set_default_size(400, 500)
169          self.connect("destroy", gtk.main_quit)          self.connect("destroy", gtk.main_quit)
170            self.connect("key-press-event", self.key_press_event)
171    
172          # vbox containing the main view and the status bar at the bottom          # vbox containing the main view and the status bar at the bottom
173          vbox = gtk.VBox()          vbox = gtk.VBox()
# Line 210  class app(gtk.Window): Line 211  class app(gtk.Window):
211          self.status.push(0, "Found %d block types." % (len(blocks)))          self.status.push(0, "Found %d block types." % (len(blocks)))
212                                    
213      def set_placement_tool(self,block):      def set_placement_tool(self,block):
214            # TODO: add undo handler
215          label = block.type.getName()          label = block.type.getName()
216          def my_block_factory():          def my_block_factory():
217              def wrapper():              def wrapper():
# Line 218  class app(gtk.Window): Line 220  class app(gtk.Window):
220                  return b                  return b
221              return wrapper              return wrapper
222          self.view.tool.grab(PlacementTool(my_block_factory(), HandleTool(), 2))          self.view.tool.grab(PlacementTool(my_block_factory(), HandleTool(), 2))
223    
224        def key_press_event(self,widget,event):
225            # TODO: add undo handler
226            key = gtk.gdk.keyval_name(event.keyval)
227            if key == 'Delete' and self.view.focused_item:
228                self.view.canvas.remove(self.view.focused_item)
229                self.status.push(0,"Item deleted.")
230                
231  a = app()  a = app()
232  gtk.main()  gtk.main()

Legend:
Removed from v.1937  
changed lines
  Added in v.1938

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