Mercurial > code > home > repos > light9
comparison bin/keyboardcomposer @ 814:1ae8e6b287e3
improvements to file watching. outline of how resync will work
Ignore-this: 501c4f2076099364645cc27e9fe48f61
author | drewp@bigasterisk.com |
---|---|
date | Sun, 30 Sep 2012 07:11:49 +0000 |
parents | f29788d1c8c9 |
children | d7f1f868eb6c |
comparison
equal
deleted
inserted
replaced
813:6f984ce851e2 | 814:1ae8e6b287e3 |
---|---|
117 def updateGraphWithLevel(self, uri, level): | 117 def updateGraphWithLevel(self, uri, level): |
118 """in our per-session graph, we maintain SubSetting objects like this: | 118 """in our per-session graph, we maintain SubSetting objects like this: |
119 | 119 |
120 ?session :subSetting [a :SubSetting; :sub ?s; :level ?l] | 120 ?session :subSetting [a :SubSetting; :sub ?s; :level ?l] |
121 """ | 121 """ |
122 | 122 # move to syncedgraph patchMapping |
123 with self.sub.graph.currentState() as graph: | 123 with self.sub.graph.currentState() as graph: |
124 adds = set([]) | 124 adds = set([]) |
125 for setting in graph.objects(self.session, L9['subSetting']): | 125 for setting in graph.objects(self.session, L9['subSetting']): |
126 if graph.value(setting, L9['sub']) == uri: | 126 if graph.value(setting, L9['sub']) == uri: |
127 break | 127 break |
128 else: | 128 else: |
129 setting = URIRef(self.session + "/setting/%s" % | 129 setting = URIRef(self.session + "/setting/%s" % |
130 random.randrange(999999)) | 130 random.randrange(999999999)) |
131 adds.update([ | 131 adds.update([ |
132 (self.session, L9['subSetting'], setting, self.session), | 132 (self.session, L9['subSetting'], setting, self.session), |
133 (setting, RDF.type, L9['SubSetting'], self.session), | 133 (setting, RDF.type, L9['SubSetting'], self.session), |
134 (setting, L9['sub'], uri, self.session), | 134 (setting, L9['sub'], uri, self.session), |
135 ]) | 135 ]) |
141 if adds != dels: | 141 if adds != dels: |
142 self.sub.graph.patch(Patch(delQuads=dels, addQuads=adds)) | 142 self.sub.graph.patch(Patch(delQuads=dels, addQuads=adds)) |
143 | 143 |
144 def updateLevelFromGraph(self): | 144 def updateLevelFromGraph(self): |
145 """read rdf level, write it to subbox.slider_var""" | 145 """read rdf level, write it to subbox.slider_var""" |
146 | 146 # move this to syncedgraph readMapping |
147 graph = self.sub.graph | 147 graph = self.sub.graph |
148 | 148 |
149 for setting in graph.objects(self.session, L9['subSetting']): | 149 for setting in graph.objects(self.session, L9['subSetting']): |
150 if graph.value(setting, L9['sub']) == self.sub.uri: | 150 if graph.value(setting, L9['sub']) == self.sub.uri: |
151 self.pauseTrace = True # don't bounce this update back to server | 151 self.pauseTrace = True # don't bounce this update back to server |