def __init__(self, index): QTabWidget.__init__(self) css_apply(self, "tab_default.css") self.index = index lines = [] self.file_name = os.path.join(get_sim_path(), "pulse" + str(self.index) + ".inp") lines = inp_load_file(self.file_name) if lines != False: self.tab_name = inp_search_token_value(lines, "#sim_menu_name") else: self.tab_name = "" self.setMovable(True) self.tmesh = tab_time_mesh(self.index) self.addTab(self.tmesh, _("time mesh")) self.circuit = circuit(self.index) self.addTab(self.circuit, _("Circuit")) tab = tab_class() tab.init(self.file_name, _("Configure")) self.addTab(tab, _("Configure"))
def __init__(self,index): QTabWidget.__init__(self) self.index=index lines=[] if inp_load_file(lines,"pulse"+str(self.index)+".inp")==True: self.tab_name=inp_search_token_value(lines, "#sim_menu_name") else: self.tab_name="" self.setTabsClosable(True) self.setMovable(True) self.tmesh = tab_time_mesh(self.index) self.addTab(self.tmesh,_("time mesh")) self.circuit=circuit(self.index) self.addTab(self.circuit,_("Circuit")) tab=tab_class() tab.init("pulse"+str(self.index)+".inp","Configure") self.addTab(tab,"Configure")
def init(self,index): self.tab_label=None self.index=index lines=[] if inp_load_file(lines,"pulse"+str(self.index)+".inp")==True: self.tab_name=inp_search_token_value(lines, "#sim_menu_name") else: self.tab_name="" self.title_hbox=gtk.HBox() self.title_hbox.set_size_request(-1, 25) self.label=gtk.Label(self.tab_name.split("@")[0]) self.label.set_justify(gtk.JUSTIFY_LEFT) self.title_hbox.pack_start(self.label, False, True, 0) self.close_button = gtk.Button() close_image = gtk.Image() close_image.set_from_file(os.path.join(get_image_file_path(),"close.png")) close_image.show() self.close_button.add(close_image) self.close_button.props.relief = gtk.RELIEF_NONE self.close_button.set_size_request(25, 25) self.close_button.show() self.title_hbox.pack_end(self.close_button, False, False, 0) self.title_hbox.show_all() self.notebook=gtk.Notebook() self.notebook.show() self.tmesh = tab_time_mesh() self.tmesh.init(self.index) self.notebook.append_page(self.tmesh, gtk.Label(_("time mesh"))) self.pack_start(self.notebook, False, False, 0) self.circuit=circuit() self.circuit.init(self.index) self.notebook.append_page(self.circuit, gtk.Label(_("Circuit"))) self.show()