def save_as_callback(self, event=None):

        if self.notebook.current_tab == EDITOR:
            FileHandler.save_as(
                self.notebook.editor_tab.editor.get('1.0', 'end-1c'))
        else:
            FileHandler.save_as()

        return
Example #2
0
    def _callback_ver(self):

        self._disable_enable_button(2)

        # Guarantee simulator is updated
        Session.cur_prop.simulator = self.sim_var.get()

        result = verify()  # simgen.py
        self._disable_enable_button(0)
        self._update_property_status(0, result, 0)
        FileHandler.prepend_cur_prop(VERIFIED)
        self.parent.parent.plot_tab.create_tab(Session.cur_prop.name)

        return
    def _reload_xml(self, event=None):

        if not Session.file_path:
            print('No session filepath\n')
            return
        Session.write("Reloading xml...")

        file_path = Session.file_path
        file = FileHandler.open_file(file_path)
        if (HYXML_FILE in file_path):
            Session.write("  hyxml file reloaded.\n")
            Session.file_type = HYXML_FILE
        elif (MDL_FILE in file_path):
            Session.write("  mdl file opened\n")
            Session.file_type = MDL_FILE

        if file == None:
            print("File reload failed: No file\n")
            return

        # Obtain parsed results
        Session.hybrid = file['hybrid']
        Session.prop_list = file['prop_list']
        if (len(Session.prop_list) == 0):
            Session.prop_list.append(Property())
        Session.file_opened = True

        self.open_xml()

        return
    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)
    def save_callback(self):

        if self.notebook.current_tab == EDITOR:
            FileHandler.save(self.notebook.editor_tab.editor.get())
            # Load XML into HyIR object
            FileHandler.open_file(Session.file_path)
            # Refresh Model Tab
            self.tree._clear_model()
            self.tree._display_model()
            # Refresh Property Sidebar
            self.notebook.model_tab.sidebar._display_property(Session.cur_prop)
        else:
            FileHandler.save()
            # Refresh Editor Tab
            self.notebook.editor_tab.open_xml()

        return
    def load_file(self, input_path_full):

        self.cur_prop.input_path_full = input_path_full
        self.cur_prop.input_path = input_path_full.split("/").pop()
        self.input_path.set(self.cur_prop.input_path)
        data_dict = FileHandler.parse_data_file(input_path_full)

        # Load Remaining property variables and set the appriopriate tk vars
        self.cur_prop.prop_name = data_dict[PROPNAME]
        self.cur_prop.prop_status = data_dict[SIMVER]
        self.cur_prop.time_step = data_dict[TIMESTEP]
        self.cur_prop.time_horizon = data_dict[TIMEHORIZON]
        self.cur_prop.k_value = data_dict[KVALUE]
        self.cur_prop.simulator = data_dict[SIMULATOR]
        self.cur_prop.refine_strat = data_dict[REFINEMENTSTRAT]
        self.cur_prop.initial_set = data_dict[INITIALSET]
        self.cur_prop.unsafe_set = data_dict[UNSAFESET]

        self.cur_prop.variable_list = data_dict[VARIABLENAMES]
        self.cur_prop.mode_list = data_dict[MODENAMES]

        self._load_cur_prop()
        self._create_boxes()
Example #7
0
    print('            [defualt] "default" or "d" for Default Strategy')
    print('                      "user" or "us" for User Strategy')

    return

if __name__ == '__main__':

    args = getopts(sys.argv)

    if args:

        # Read file into Session variables
        if '-f' not in args:
            print("ERROR: File required")
            sys.exit()
        FileHandler.open_file(args['-f'])
        
        # Select Simulator (Session defaults to ODEINT_FIX)
        if ('-s' in args) and (args['-s'] == "odeintadp"):
            Session.simulator = ODEINT_ADP

        # Select Refinement Strategy (Session defualts to DEF_STRAT)
        if ('-r' in args) and (args['-r'] == "user"):
            Session.refine_strat = USR_STRAT
        
        HyIR.compose_all(Session.hybrid)
        # We only concern ourselves with the first listed property - for now
        Session.prop_list = [Session.cur_prop]
        Property.validate_cur_prop()

        # Simulate/Verify (Simulate is default)