/[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 1953 by jpye, Mon Nov 10 02:09:23 2008 UTC revision 1954 by jpye, Tue Nov 11 10:01:18 2008 UTC
# Line 13  else: Line 13  else:
13            
14  sys.path.append("..")  sys.path.append("..")
15    
16    import gtkexcepthook
17    
18  if sys.platform.startswith("win"):  if sys.platform.startswith("win"):
19      # Fetchs gtk2 path from registry      # Fetchs gtk2 path from registry
20      import _winreg      import _winreg
# Line 138  from blockinstance import * Line 140  from blockinstance import *
140    
141  def BlockToolChain():  def BlockToolChain():
142      """      """
143      The default tool chain build from HoverTool, ItemTool and HandleTool.      ToolChain for working with BlockCanvas, including several custom Tools.
144      """      """
145      chain = ToolChain()      chain = ToolChain()
146      chain.append(HoverTool())      chain.append(HoverTool())
# Line 241  class app(gtk.Window): Line 243  class app(gtk.Window):
243          elif key == 'l' or key == 'L':          elif key == 'l' or key == 'L':
244              self.set_connector_tool()              self.set_connector_tool()
245              self.status.push(0,"Line draw mode...")              self.status.push(0,"Line draw mode...")
246            elif key == 'S' or key == 's':
247                import cPickle as pickle
248                f = file("./test.a4b","w")
249                try:
250                    pickle.dump(self.view.canvas,f)
251                except Exception,e:
252                    d = gtk.Dialog("Error",self,gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
253                         (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)
254                    )
255                    d.vbox.add(gtk.Label(str(e)))
256                    d.show_all()
257                    d.run()
258                    d.hide()
259                finally:
260                    f.close()
261            elif key == 'R' or key == 'r':
262                import cPickle as pickle
263                f = file("./test.a4b","r")
264                try:
265                    self.view.canvas = pickle.load(f)
266                    self.view.canvas.update_now()
267                finally:
268                    f.close()
269                
270  a = app()  a = app()
271  gtk.main()  gtk.main()

Legend:
Removed from v.1953  
changed lines
  Added in v.1954

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