def add_property_column(self,*args): """ Add a property column """ import GtkExtra pname=GtkExtra.input_box(title="Property Name", message="Please enter a name for the property") if ((pname is None) or (len(pname) == 0)): return current_columns=self.pgugrid.get_current_columns() mems=current_columns[0] titles=current_columns[1] editables=current_columns[2] formats=current_columns[3] types=current_columns[4] nodatas=current_columns[5] justify=current_columns[6] tjustify=current_columns[7] mems.append(pname) titles.append(pname) editables.append(1) formats.append(None) types.append('string') nodatas.append('') justify.append(0) tjustify.append(2) self.pgugrid.define_columns(members=mems,titles=titles, editables=editables,formats=formats,types=types, nodata=nodatas,justify=justify,title_justify=tjustify)
def run_script(self, fname): if not fname or os.path.exists(fname): GtkExtra.message_box("Run", "Invalid filename", ("OK", )) return args = GtkExtra.input_box("Arguments", "Enter any command line arguments") if args == None: return os.system(VT_CMD + 'python "' + fname + '" ' + args + ' &')
def run_script(self, fname): if not fname or os.path.exists(fname): GtkExtra.message_box("Run","Invalid filename",("OK",)) return args = GtkExtra.input_box("Arguments", "Enter any command line arguments") if args == None: return os.system(VT_CMD+'python "'+fname+'" ' + args + ' &')
def new_button(_b): # popup little dialog to get the title of the function. # if user enters a name, start the editor so that the new function can be # edited. name = GtkExtra.input_box(title="Enter Function Name", message="Name of the new function is? ", modal=TRUE) if function_list.has_key(name): GtkExtra.message_box(title="Duplicate Function Name", message="Function name already exists", buttons=("OK"), pixmap=None, modal=TRUE) else: run_editor_on(_make_path() + '/' + name)
def do_run(self, _b=None): line = GtkExtra.input_box("Execute Code", "Enter code to execute:") if line == None: return locals = self.curframe.f_locals globals = self.curframe.f_globals globals['__privileged__'] = 1 try: code = compile(line + '\n', '<stdin>', 'single') exec code in globals, locals except: if type(sys.exc_type) == type(''): exc_type_name = sys.exc_type else: exc_type_name = sys.exc_type.__name__ self.set_status('*** ' + exc_type_name + ': ' + str(sys.exc_value)) return self.update_var_listing()
def do_edit(self, _b=None): locals = self.curframe.f_locals varname = self.vardisp.varnames[self.vardisp.selected] val = repr.repr(locals[varname]) value = GtkExtra.input_box("Edit Variable", "Enter new value for" + varname + ":", val) if value == None: return globals = self.curframe.f_globals globals['__privileged__'] = 1 try: val = eval(value, globals, locals) self.curframe.f_locals[varname] = val except: if type(sys.exc_type) == type(''): exc_type_name = sys.exc_type else: exc_type_name = sys.exc_type.__name__ self.set_status('*** ' + exc_type_name + ': ' + str(sys.exc_value)) return row = self.vardisp.selected self.vardisp.set_text(row, 1, type(val).__name__) self.vardisp.set_text(row, 2, repr.repr(val))
def add_property_column(self, *args): """ Add a property column """ import GtkExtra pname = GtkExtra.input_box( title="Property Name", message="Please enter a name for the property") if ((pname is None) or (len(pname) == 0)): return current_columns = self.pgugrid.get_current_columns() mems = current_columns[0] titles = current_columns[1] editables = current_columns[2] formats = current_columns[3] types = current_columns[4] nodatas = current_columns[5] justify = current_columns[6] tjustify = current_columns[7] mems.append(pname) titles.append(pname) editables.append(1) formats.append(None) types.append('string') nodatas.append('') justify.append(0) tjustify.append(2) self.pgugrid.define_columns(members=mems, titles=titles, editables=editables, formats=formats, types=types, nodata=nodatas, justify=justify, title_justify=tjustify)