Revisão | 2be6f5f1e23639eedf1608d804bb51e7e2e37e5c (tree) |
---|---|
Hora | 2013-03-28 18:18:02 |
Autor | pylaf |
Commiter | pylaf |
new recipe to clipboard
@@ -928,7 +928,13 @@ | ||
928 | 928 | Tkinter.Menu.__init__(self,master,cnf,**kw) |
929 | 929 | self.add_command(label='place',command=obj.place) |
930 | 930 | 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) | |
932 | 938 | def __init__(self,master=None,root=None,cnf={},**kw): |
933 | 939 | Tkinter.Canvas.__init__(self,master,cnf,**kw) |
934 | 940 | if root: |
@@ -1026,6 +1032,12 @@ | ||
1026 | 1032 | file = open(filename,'w') |
1027 | 1033 | file.write(recipe.toxml()) |
1028 | 1034 | #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() | |
1029 | 1041 | @property |
1030 | 1042 | def recipe(self): |
1031 | 1043 | impl = minidom.getDOMImplementation() |