def onOpen(self, evt=None): ''' Open callback from main menu.''' # Open a file dialog to get target if self.saved or dialogs.warn_changes(): df = dialogs.open_file(self.directory) if df[1] != '': self.directory, self.filename = df self.load()
def open(self, event=None): """ @brief Open a file dialog to get a target, then load it. """ # Open a file dialog to get target if self.saved or dialogs.warn_changes(): df = dialogs.open_file(self.directory) if df[1] != '': self.directory, self.filename = df self.load()
def new(self, event=None): """ @brief Creates a new file from the default template. """ if self.saved or dialogs.warn_changes(): self.filename = '' self.mode = 'cad' self.clear() koko.EDITOR.text = TEMPLATE self.first_render = True
def exit(self, event=None): """ @brief Warns of unsaved changes then exits. """ if self.saved or dialogs.warn_changes(): koko.FRAME.Destroy() # Delete these objects to avoid errors due to deletion order # during Python's cleanup stage del koko.FRAME del koko.EDITOR del koko.CANVAS del koko.GLCANVAS
def onNewPCB(self, evt=None): '''Creates a new file from the PCB template.''' if self.saved or dialogs.warn_changes(): self.filename = '' globals.EDITOR.text = koko.template.PCB_TEMPLATE if globals.CANVAS.edit_panel: globals.CANVAS.close_edit_panel() globals.SHAPES.clear() self.first_render = True
def reload(self, event=None): """ @brief Reloads the current file, warning of changes if necessary. """ if self.filename != '' and (self.saved or dialogs.warn_changes()): self.load() self.first_render = False
def onExit(self, evt=None): '''Exits after warning of unsaved changes.''' if self.saved or dialogs.warn_changes(): self.frame.Destroy()
def onReload(self, evt=None): '''Reloads the current file, warning if necessary.''' if self.filename != '' and (self.saved or dialogs.warn_changes()): self.load()