예제 #1
0
    def close_callback(self, event=None):

        if not Session.file_saved:
            if messagebox.askyesno('Save', "Save file before closing?"):
                self.save_callback()

        Session.lib_compiled = False
        Session.simulator = ODEINT_FIX
        Session.refine_strat = DEF_STRAT
        Session.file_saved = False
        Session.file_type = ''
        Session.file_path = ''

        if Session.file_opened:
            EventHandler.event_generate(CLOSE_EVENT)
        Session.file_opened = False
예제 #2
0
    def new_callback(self):
        """ Open template file """

        # Forget welcome screen widgets
        self.parent.open_label.pack_forget()
        self.parent.manual_label.pack_forget()
        self.parent.email_label.pack_forget()

        # If a file is already open, close it.
        if Session.file_opened:
            self.close_callback()

        Session.hybrid = HyIR.create_template()
        Session.file_path = None
        Session.file_opened = True
        Session.file_saved = False
        EventHandler.event_generate(OPEN_EVENT)

        return
예제 #3
0
    def open_callback(self):
        """ Select and open file """

        # Forget welcome screen widgets
        self.parent.open_label.pack_forget()
        self.parent.manual_label.pack_forget()
        self.parent.email_label.pack_forget()

        # If a file is already open, close it.
        if Session.file_opened:
            self.close_callback()

        file_path = filedialog.askopenfilename(**self.OPEN_OPT)
        if file_path:
            Session.file_path = file_path
            status = FileHandler.open_file(file_path)
            if status:
                Session.file_opened = True
                Session.file_saved = True
                EventHandler.event_generate(OPEN_EVENT)