def mark_atom_by_name_command(glpane): # review: is this really what the arg always is? i bet it's whatever widget this appeared in... ok, text = grab_text_using_dialog( default = "Ss3-564", title = "Mark atom by name", label = "atom name or number:" ) if ok: name = text assy = glpane.assy mark_atom_by_name(assy, name) return
def on_doubleclick(self): ok, text = grab_text_using_dialog( default = self.text, title = self.dialog_title, label = self.dialog_label ) if ok: #e unicode?? (see cad/src MT Node renaming code, or Node.name mmp code, or the Comment Node, # for example code that can handle it) #e filter through a func about what's acceptable? # if it fails, repeat dialog with more specific label? # strip whitespace? etc # eventually customize all that, for now just do what's most useful right here text = text.strip() self.text = text # changes state else: print "cancelled text edit, old text remains: %r" % (self.text,) #e some other place to put a message in the UI? return
def on_doubleclick(self): ok, text = grab_text_using_dialog(default=self.text, title=self.dialog_title, label=self.dialog_label) if ok: #e unicode?? (see cad/src MT Node renaming code, or Node.name mmp code, or the Comment Node, # for example code that can handle it) #e filter through a func about what's acceptable? # if it fails, repeat dialog with more specific label? # strip whitespace? etc # eventually customize all that, for now just do what's most useful right here text = text.strip() self.text = text # changes state else: print "cancelled text edit, old text remains: %r" % ( self.text, ) #e some other place to put a message in the UI? return