Mercurial > code > home > repos > light9
comparison bin/subcomposer @ 880:e09e3d1d83d5
slightly better behavior when the graph is out of sync. add LocalSubmaster type
Ignore-this: 11f7bc0ff3763685a847ded12bb02191
author | drewp@bigasterisk.com |
---|---|
date | Sat, 08 Jun 2013 01:57:30 +0000 |
parents | 167a61d3cfbf |
children | 4b9997ab0e4f |
comparison
equal
deleted
inserted
replaced
879:6504df2aee03 | 880:e09e3d1d83d5 |
---|---|
107 return | 107 return |
108 self.sendupdate() | 108 self.sendupdate() |
109 graph.patchObject(self.session, | 109 graph.patchObject(self.session, |
110 self.session, L9['currentSub'], newSub.uri) | 110 self.session, L9['currentSub'], newSub.uri) |
111 | 111 |
112 if newSub and 'local' in newSub.uri: # wrong- use rdf:type or something? | 112 with graph.currentState() as current: |
113 self._currentChoice(Local) | 113 |
114 else: | 114 if newSub and (newSub.uri, RDF.type, L9['LocalSubmaster']) in current: |
115 # i think right here is the point that the last local | 115 self._currentChoice(Local) |
116 # becomes garbage, and we could clean it up. | 116 else: |
117 self._currentChoice(newSub.uri) | 117 # i think right here is the point that the last local |
118 # becomes garbage, and we could clean it up. | |
119 self._currentChoice(newSub.uri) | |
118 | 120 |
119 dispatcher.connect(self.levelsChanged, "sub levels changed") | 121 dispatcher.connect(self.levelsChanged, "sub levels changed") |
120 | 122 |
121 @self._currentChoice.subscribe | 123 @self._currentChoice.subscribe |
122 def choiceChanged(newChoice): | 124 def choiceChanged(newChoice): |
134 # todo: put a type on this, so subChanged can identify it right | 136 # todo: put a type on this, so subChanged can identify it right |
135 # todo: where will these get stored, or are they local to this | 137 # todo: where will these get stored, or are they local to this |
136 # subcomposer process and don't use PersistentSubmaster at all? | 138 # subcomposer process and don't use PersistentSubmaster at all? |
137 | 139 |
138 new = URIRef("http://local/%s" % time.time()) | 140 new = URIRef("http://local/%s" % time.time()) |
139 self.graph.patch(Patch(addQuads=[(new, RDF.type, L9['Submaster'], self.session)])) | 141 self.graph.patch(Patch(addQuads=[ |
142 (new, RDF.type, L9['Submaster'], self.session), | |
143 (new, RDF.type, L9['LocalSubmaster'], self.session), | |
144 ])) | |
140 | 145 |
141 return new | 146 return new |
142 | 147 |
143 def setupLevelboxUi(self): | 148 def setupLevelboxUi(self): |
144 self.levelbox = Levelbox(self, self.graph, self.currentSub) | 149 self.levelbox = Levelbox(self, self.graph, self.currentSub) |