Changeset - 4b3d7e8ba24a
[Not reviewed]
default
0 1 0
Drew Perttula - 12 years ago 2013-06-06 04:43:21
drewp@bigasterisk.com
subcomposer is nicer if we always have some Submaster object. and if you call all the init code
Ignore-this: 372122231f997f3301e23d69e96360fa
1 file changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
bin/subcomposer
Show inline comments
 
@@ -58,34 +58,37 @@ class Subcomposer(tk.Frame):
 
      inside the current sub:
 
      graph -> Submaster levels (handled in Submaster)
 
      Submaster levels -> OneLevel widget
 
      OneLevel widget -> Submaster.editLevel
 
      Submaster.editLevel -> graph (handled in Submaster)
 

	
 
    """
 
    def __init__(self, master, graph, session):
 
        tk.Frame.__init__(self, master, bg='black')
 
        self.graph = graph
 
        self.session = session
 

	
 
        # this is a PersistentSubmaster (even for local) or None if we're not initialized
 
        self.currentSub = Observable(None)
 
        # this is a URIRef or Local
 
        self._currentChoice = Observable(Local)
 

	
 
        self._currentChoice = Observable(Local)
 
        # this is a PersistentSubmaster (even for local)
 
        self.currentSub = Observable(Submaster.PersistentSubmaster(
 
                    graph, self.makeLocal()))
 

	
 
        def pc(val):
 
            log.info("change viewed sub to %s", val)
 
        self._currentChoice.subscribe(pc)
 

	
 
        EditChoice(self, self.graph, self._currentChoice).frame.pack(side='top')
 
        self.setupSubChoiceLinks()
 

	
 
    def setupSubChoiceLinks(self):
 

	
 
        def ann():
 
            print "currently: session=%s currentSub=%r _currentChoice=%r" % (
 
                self.session, self.currentSub(), self._currentChoice())
 

	
 
        @graph.addHandler
 
        def graphChanged():
 
            s = graph.value(self.session, L9['currentSub'])
 
            if s is None:
 
                s = self.makeLocal()
0 comments (0 inline, 0 general)