def init(self,filename,fullname): scan_remove_file(filename) self.widget_type=[] self.file_name=filename self.edit_list=[] self.line_number=[] inp_load_file(self.lines,filename) n=0 pos=0 my_token_lib=tokens() height=27 for i in range(0, len(self.lines)/2): show=False units="Units" token=self.lines[pos] result=my_token_lib.find(token) if result!=False: units=result.units text_info=result.info show=True pos=pos+1 self.set_size_request(600,-1) if show == True : hbox=gtk.HBox() hbox.show() label = gtk.Label() label.set_size_request(400,height) label.set_markup(latex_to_pygtk_subscript(text_info)) label.set_use_markup(True) hbox.pack_start(label, False, False, padding=1) label.show() self.line_number.append(pos) if result.opt[0]=="text": edit_box=gtk.Entry(max=0) edit_box.set_text(self.lines[pos]); edit_box.connect("changed", self.callback_edit, token) edit_box.show() self.widget_type.append("edit") else: edit_box=gtk.combo_box_new_text() index=0 true_false=False if len(result.opt)==2: if result.opt[0]==_("true") and result.opt[1]==_("false"): true_false=True for i in range(0,len(result.opt)): edit_box.append_text(result.opt[i]) if true_false==False: if yes_no(self.lines[pos])==yes_no(result.opt[i]): index=i else: if str2bool(self.lines[pos])==True: index=0 else: index=1 edit_box.set_active(index); edit_box.connect("changed", self.callback_edit, token) edit_box.show() self.widget_type.append("combo") edit_box.set_size_request(300,height) self.edit_list.append(edit_box) hbox.pack_start(edit_box, False, False, padding=1) label = gtk.Label() label.set_markup(latex_to_pygtk_subscript(units)) label.set_use_markup(True) label.set_size_request(200,height) label.show() hbox.pack_start(label, False, False, padding=1) label.show() self.pack_start(hbox, False, False, padding=1) #self.add() line=1 scan_item_add(filename,token,text_info,line) n=n+1 pos=pos+1
def on_selection_changed(self, widget): selected=self.icon_view.get_selected_items() if len(selected)!=0: icon_pos=selected[0][0] icon_name=self.store[icon_pos][0] icon_type=self.store[icon_pos][COL_IS_DIRECTORY] full_path=os.path.join(self.dir,icon_name) if icon_type=="dat": state=plot_state() get_plot_file_info(state,full_path) summary="<big><b>"+self.store[icon_pos][0]+"</b></big>\n"+_("\ntitle: ")+state.title+_("\nx axis: ")+state.x_label+" ("+latex_to_pygtk_subscript(state.x_units)+_(")\ny axis: ")+state.y_label+" ("+latex_to_pygtk_subscript(state.y_units)+_(")\n\n<big><b>Double click to open</b></big>") my_help_class.help_set_help(["dat_file.png",summary]) if icon_name.endswith("equilibrium"): state=plot_state() get_plot_file_info(state,full_path) summary="<big><b>equilibrium</b></big>\n"+_("\nThis contains the simulation output at 0V in the dark.") my_help_class.help_set_help(["dir_file.png",summary])