Example #1
0
 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()
Example #2
0
 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()
Example #3
0
 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()
Example #4
0
    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
Example #5
0
    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
Example #6
0
    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
Example #7
0
    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
Example #8
0
 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
Example #9
0
 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
Example #10
0
 def onExit(self, evt=None):
     '''Exits after warning of unsaved changes.'''
     if self.saved or dialogs.warn_changes():
         self.frame.Destroy()
Example #11
0
 def onReload(self, evt=None):
     '''Reloads the current file, warning if necessary.'''
     if self.filename != ''  and (self.saved or dialogs.warn_changes()):
         self.load()
Example #12
0
 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