Esempio n. 1
0
 def button_add(self):
   if self.hierarchy.selection: o = self.hierarchy.selection[0]
   else:                        o = self.hierarchy.node
   
   items, insert, del_ = custom._find_children_insert_remove(o.item)
   while items is None:
     o = o.parent
     items, insert, del_ = custom._find_children_insert_remove(o.item)
     
   def add_this(key, item):
     def do_it():
       try:              insert(key, item)
       except TypeError: insert(item)
       if self.cancel: self.cancel.add_cancel(cancel_it)
       
     def cancel_it():
       del_(key)
       if self.cancel: self.cancel.add_redo(do_it)
       
     do_it()
     
   choices = custom._find_available_children(o.item)
   if isinstance(choices, list):
     if isinstance(items, list): AddDialog(o.item, choices, len(items), add_this)
     else:                       AddDialog(o.item, choices, ""        , add_this)
   elif choices:
     try: choice = editobj.eval(choices, locals = {"parent" : o.item})
     except NotImplementedError: return
     add_this(len(items), choice)
Esempio n. 2
0
  def set_value(self, value): Editor.set_value(self, float(editobj.eval(value)))
  
  
class TextEditor(Editor, Tkinter.Frame):
Esempio n. 3
0
  def set_value(self, value): Editor.set_value(self, int(editobj.eval(value)))
  
class FloatEditor(EntryEditor):
Esempio n. 4
0
 def set_value(self, value):
   if value and (value[0] != "<"):
     try: value = editobj.eval(value)
     except: sys.excepthook(*sys.exc_info())
     
     Editor.set_value(self, value)
Esempio n. 5
0
 def choosen(self, text):
   if   text == u"(paste clipboard)"   : added = editobj.clipboard
   elif text == u"(deepcopy clipboard)": added = copy.deepcopy(editobj.clipboard)
   else:                                 added = editobj.eval(text, locals = {"parent" : self.add_into})
   self.callback(editobj.eval(self.entryk.get(), locals = {"parent" : self.add_into}), added)