def OnFileSave(self, event): if self.panel.filename is None: self.OnFileSaveAs(event) return tree.save(self.panel.layout.root, self.panel.filename) self.panel.dirty = False
def OnFileSaveAs(self, event): wildcard = "Tree text file|*.txt" if self.panel.filename is None: filename = "" else: filename = self.panel.filename dlg = wx.FileDialog( self, message="Save file as ...", defaultDir=os.getcwd(), defaultFile="", wildcard=wildcard, style=wx.SAVE ) if dlg.ShowModal() == wx.ID_OK: paths = dlg.GetPaths() filename = paths[0] self.panel.filename = filename tree.save(self.panel.layout.root, self.panel.filename) self.panel.dirty = False self.SetTitle("Snowflake - " + self.panel.filename) dlg.Destroy()