コード例 #1
0
 def handle_change(self, change):
     """ Handle changes from atom ContainerLists """
     Entry = self.entry_factory
     op = change['operation']
     if op in 'append':
         self.add(len(change['value']), Entry(*change['item']))
     elif op == 'insert':
         self.add(change['index'], Entry(*change['item']))
     elif op == 'extend':
         points = [Entry(*p) for p in change['items']]
         self.addAll([bridge.encode(c) for c in points])
     elif op == '__setitem__':
         self.set(change['index'], Entry(*change['newitem']))
     elif op == 'pop':
         self.remove(change['index'])
     else:
         raise NotImplementedError(
             "Unsupported change operation {}".format(op))
コード例 #2
0
 def refresh_data(self, data):
     Entry = self.entry_factory
     data = [Entry(*d) for d in data]
     self.clear()
     #: Must manually encode these the bridge currently doesnt try as it's slower
     self.addAll([bridge.encode(c) for c in data])
コード例 #3
0
 def refresh_data_set(self):
     self.chart_data = BarData(
         [bridge.encode(c.data_set) for c in self.data_sets()])
     super(AndroidBarChart, self).refresh_data_set()