Mercurial > code > home > repos > light9
diff 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 |
line wrap: on
line diff
--- a/bin/subcomposer Sat Jun 08 00:54:56 2013 +0000 +++ b/bin/subcomposer Sat Jun 08 01:57:30 2013 +0000 @@ -109,12 +109,14 @@ graph.patchObject(self.session, self.session, L9['currentSub'], newSub.uri) - if newSub and 'local' in newSub.uri: # wrong- use rdf:type or something? - self._currentChoice(Local) - else: - # i think right here is the point that the last local - # becomes garbage, and we could clean it up. - self._currentChoice(newSub.uri) + with graph.currentState() as current: + + if newSub and (newSub.uri, RDF.type, L9['LocalSubmaster']) in current: + self._currentChoice(Local) + else: + # i think right here is the point that the last local + # becomes garbage, and we could clean it up. + self._currentChoice(newSub.uri) dispatcher.connect(self.levelsChanged, "sub levels changed") @@ -136,7 +138,10 @@ # subcomposer process and don't use PersistentSubmaster at all? new = URIRef("http://local/%s" % time.time()) - self.graph.patch(Patch(addQuads=[(new, RDF.type, L9['Submaster'], self.session)])) + self.graph.patch(Patch(addQuads=[ + (new, RDF.type, L9['Submaster'], self.session), + (new, RDF.type, L9['LocalSubmaster'], self.session), + ])) return new