Exemple #1
0
    def callback_copy_page(self):
        tab = self.notebook.currentWidget()
        old_index = tab.index
        new_sim_name = dlg_get_text(
            _("Clone the current experiment to a new experiment called") + ":",
            tab.tab_name.split("@")[0], "clone.png")
        new_sim_name = new_sim_name.ret
        if new_sim_name != None:
            new_sim_name = new_sim_name + "@" + tab.tab_name.split("@")[1]
            index = experiment_new_filename("fxdomain")
            if inp_copy_file(
                    os.path.join(get_sim_path(),
                                 "fxdomain" + str(index) + ".inp"),
                    os.path.join(get_sim_path(), "fxdomain" + str(old_index) +
                                 ".inp")) == False:
                print("Error copying file" +
                      os.path.join(get_sim_path(), "fxdomain" +
                                   str(old_index) + ".inp"))
                return
            if inp_copy_file(
                    os.path.join(get_sim_path(),
                                 "fxmesh" + str(index) + ".inp"),
                    os.path.join(get_sim_path(),
                                 "fxmesh" + str(old_index) + ".inp")) == False:
                print("Error copying file" +
                      os.path.join(get_sim_path(), "fxdomain" +
                                   str(old_index) + ".inp"))
                return

            inp_update_token_value(
                os.path.join(get_sim_path(), "fxdomain" + str(index) + ".inp"),
                "#sim_menu_name", new_sim_name)
            self.add_page(index)
            self.changed.emit()
Exemple #2
0
    def callback_add_page(self):
        new_sim_name = dlg_get_text(
            _("New experiment name") + ":",
            _("experiment ") + str(self.notebook.count() + 1),
            "document-new.png")

        if new_sim_name.ret != None:
            index = experiment_new_filename("jv")
            inp_copy_file(
                os.path.join(get_sim_path(), "jv" + str(index) + ".inp"),
                os.path.join(get_sim_path(), "jv0.inp"))
            inp_update_token_value(
                os.path.join(get_sim_path(), "jv" + str(index) + ".inp"),
                "#sim_menu_name", new_sim_name.ret + "@jv")
            self.add_page(index)
            self.changed.emit()