コード例 #1
0
ファイル: main.py プロジェクト: deavid/soyamirror
    def load(self, event=None):
        import tkFileDialog

        s = tkFileDialog.askopenfilename()
        if s:
            obj = pickle.load(open(s, "rb"))
            editobj.edit(obj)
コード例 #2
0
ファイル: HMMEd.py プロジェクト: tempbottle/ghmm
    def EditStateUp(self, event):
        print 'Calling EditObj'
        if event.widget.find_withtag(CURRENT):
            widget = event.widget.find_withtag(CURRENT)[0]
            tags = self.canvas.gettags(widget)
            if not "edges" in tags:
                v = self.FindVertex(event)
                # print "Found Vertex " + "%s" % v
                # hidden attributes set to None
                editor.register_attr("state_class", None)
                editor.register_attr("emissions", None)  # hidden
                editor.register_attr("itsHMM", None)
                editor.register_attr("desc", None)
                editor.register_attr("index", None)
                editor.register_attr("pos", None)
                editor.register_attr("id", None)
                editor.register_attr("order", None)
                editor.register_attr("tiedto", None)
                editor.register_attr("reading_frame", None)
                editor.register_attr("duration", None)
                editor.register_attr("background", None)

                # register values
                editor.register_attr("label", ValidStringEditor)

                # Edit this State with editobj widget
                editobj.edit(self.HMM.state[v])
コード例 #3
0
ファイル: HMMEd.py プロジェクト: tempbottle/ghmm
    def EditStateUp(self,event):
        print 'Calling EditObj'
	if event.widget.find_withtag(CURRENT):
	    widget = event.widget.find_withtag(CURRENT)[0]
	    tags = self.canvas.gettags(widget)
	    if not "edges" in tags:
		v = self.FindVertex(event)
                # print "Found Vertex " + "%s" % v
                # hidden attributes set to None
                editor.register_attr("state_class", None)
                editor.register_attr("emissions", None) # hidden
                editor.register_attr("itsHMM", None)
                editor.register_attr("desc", None)
                editor.register_attr("index", None)
                editor.register_attr("pos", None)
                editor.register_attr("id", None)
                editor.register_attr("order", None)
                editor.register_attr("tiedto", None)
                editor.register_attr("reading_frame", None)
                editor.register_attr("duration", None)
                editor.register_attr("background", None)
                
                # register values
                editor.register_attr("label", ValidStringEditor)
                
                # Edit this State with editobj widget  
                editobj.edit(self.HMM.state[v])
コード例 #4
0
ファイル: editor.py プロジェクト: jdardon/debian-pkg
 def validate(self, event = None):
   import editobj
   
   value = self.value.get()
   self.value.set("")
   
   if   value == "(edit...)":            editobj.edit(getattr(self.obj, self.attr))
   elif value == "(set in clipboard)":   editobj.clipboard = getattr(self.obj, self.attr)
   elif value == "(paste clipboard)":    setattr(self.obj, self.attr, editobj.clipboard); self.master.fields[self.attr].update()
   elif value == "(deepcopy clipboard)": setattr(self.obj, self.attr, copy.deepcopy(editobj.clipboard)); self.master.fields[self.attr].update()
   else:                                 self.master.fields[self.attr].set_value(value)
コード例 #5
0
ファイル: HMMEd.py プロジェクト: tempbottle/ghmm
    def EditHMMObj(self, event):
        # register values
        editor.register_attr("itsEditor", None)
        editor.register_attr("G", None)
        editor.register_attr("Pi", None)
        editor.register_attr("id2index", None)

        editor.register_attr("hmmAlphabet", None)
        editor.register_attr("hmmClass", None)

        editor.register_attr("editableAttr", None)

        editor.register_attr("backgroundDistributions", None)

        editor.register_attr("state", editor.EntryEditor)

        # Edit this State with editobj widget
        editobj.edit(self.HMM)
コード例 #6
0
ファイル: HMMEd.py プロジェクト: tempbottle/ghmm
    def EditHMMObj(self, event):
        # register values
        editor.register_attr("itsEditor", None)
 	editor.register_attr("G", None)
	editor.register_attr("Pi", None)
        editor.register_attr("id2index", None)

        editor.register_attr("hmmAlphabet", None)
        editor.register_attr("hmmClass", None)
        
        editor.register_attr("editableAttr", None)


        editor.register_attr("backgroundDistributions", None)

                        
        editor.register_attr("state", editor.EntryEditor)
                
        # Edit this State with editobj widget  
        editobj.edit(self.HMM)
コード例 #7
0
ファイル: main.py プロジェクト: deavid/soyamirror
    def __init__(self, extra_classes=()):
        # Get, or create if needed, the root Tk.
        try:
            from Tkinter import _default_root

            tkroot = _default_root
        except ImportError:
            pass
        if not tkroot:
            tkroot = Tk(className="Soya Editor")
            tkroot.withdraw()

        menubar = Menu(tkroot)
        file_menu = Menu(menubar, tearoff=1)
        file_menu.add_command(label="New Material...", command=self.new_material)
        file_menu.add_command(label="New World...", command=self.new_world)
        for clazz in extra_classes:
            file_menu.add_command(label="New %s..." % clazz.__name__, command=lambda clazz=clazz: editobj.edit(clazz()))

        file_menu.add_separator()
        file_menu.add_command(label="Load...", command=self.load)
        file_menu.add_command(label="Quit", command=self.quit)
        menubar.add_cascade(label="File", menu=file_menu)

        Toplevel.__init__(self, tkroot, menu=menubar)

        self.edit_config = editobj.main.EditPropertyFrame(self)
        self.edit_config.edit(CONFIG)
        self.edit_config.pack(fill=BOTH)

        Button(self, text="Apply", command=self.validate).pack()

        self.wm_protocol("WM_DELETE_WINDOW", self.quit)
コード例 #8
0
ファイル: main.py プロジェクト: deavid/soyamirror
 def new_world(self, event=None):
     editobj.edit(soya.World())
コード例 #9
0
ファイル: main.py プロジェクト: deavid/soyamirror
 def new_material(self, event=None):
     editobj.edit(soya.Material())
コード例 #10
0
ファイル: demo.py プロジェクト: jdardon/debian-pkg
# possible children for a given class. Children are given as Python strings.

custom.register_available_children(["MyObj('new')"], MyObj)


# Make MyObj available in the evaluation environment

custom.EVAL_ENV["MyObj"] = MyObj


# No main Tk window
root = Tkinter.Tk(className = 'EditObj')
root.withdraw()

# Better Tk look
root.option_add("*bd", 1)
root.option_add("*Entry.background", "#FFFFFF")
root.option_add("*List.background", "#FFFFFF")


# Create a MyObj object, with another MyObj inside (yes, it is a tree like structure)

my_obj = MyObj("root")
my_obj.content.append(MyObj("child"))


# Edit my_obj !
editobj.edit(my_obj)

Tkinter.mainloop()
コード例 #11
0
ファイル: editor.py プロジェクト: jdardon/debian-pkg
 def button_click(self): editobj.edit(self.get_value(), dialog = 1)
   
 def update(self): self["text"] = str(self.get_value())