Commit MetaInfo

Revision2be6f5f1e23639eedf1608d804bb51e7e2e37e5c (tree)
Zeit2013-03-28 18:18:02
Autorpylaf
Commiterpylaf

Log Message

new recipe to clipboard

Ändern Zusammenfassung

Diff

diff -r 8d0fe5eb9633 -r 2be6f5f1e236 src/pylafiii/chef.py
--- a/src/pylafiii/chef.py Thu Mar 28 17:53:34 2013 +0900
+++ b/src/pylafiii/chef.py Thu Mar 28 18:18:02 2013 +0900
@@ -928,7 +928,13 @@
928928 Tkinter.Menu.__init__(self,master,cnf,**kw)
929929 self.add_command(label='place',command=obj.place)
930930 self.add_separator()
931- self.add_command(label='save',command=obj.save)
931+ self.add_cascade(label='recipe',menu=obj.RecipeMenu(self,obj))
932+ #self.add_command(label='save',command=obj.save)
933+ class RecipeMenu(Tkinter.Menu):
934+ def __init__(self,master=None,obj=None,cnf={},**kw):
935+ Tkinter.Menu.__init__(self,master,cnf,**kw)
936+ self.add_command(label='to file',command=obj.save)
937+ self.add_command(label='to clipboard',command=obj.recipe_clip)
932938 def __init__(self,master=None,root=None,cnf={},**kw):
933939 Tkinter.Canvas.__init__(self,master,cnf,**kw)
934940 if root:
@@ -1026,6 +1032,12 @@
10261032 file = open(filename,'w')
10271033 file.write(recipe.toxml())
10281034 #print recipe.toprettyxml()
1035+ def recipe_clip(self):
1036+ recipe = self.recipe
1037+ text = Tkinter.Text(self)
1038+ text.clipboard_clear()
1039+ text.clipboard_append(recipe.toprettyxml())
1040+ text.destroy()
10291041 @property
10301042 def recipe(self):
10311043 impl = minidom.getDOMImplementation()
Show on old repository browser