Fix graph after refactoring
- Use attrs off Field - Rename models into group
This commit is contained in:
1 parent
c001817029
commit
4e2971c0ec
3 files changed
+9
-9
No files matched your search
@@ -38,7 +38,7 @@ class ViewGraph(ParserView):
|
||||
|
||||
def display(self):
|
||||
for widget in self.widgets.itervalues():
|
||||
widget.display(self.screen.models)
|
||||
widget.display(self.screen.group)
|
||||
return True
|
||||
|
||||
def set_cursor(self, new=False, reset_view=True):
|
||||
|
||||
@@ -132,7 +132,7 @@ class Graph(gtk.DrawingArea):
|
||||
def action_keyword(self, ids, window):
|
||||
if not ids:
|
||||
return
|
||||
ctx = self.models.context.copy()
|
||||
ctx = self.group.context.copy()
|
||||
if 'active_ids' in ctx:
|
||||
del ctx['active_ids']
|
||||
if 'active_id' in ctx:
|
||||
@@ -321,21 +321,21 @@ class Graph(gtk.DrawingArea):
|
||||
return self.area.x + self.area.w * 0.05, \
|
||||
self.area.y + self.area.h * 0.05
|
||||
|
||||
def display(self, models):
|
||||
self.updateDatas(models)
|
||||
def display(self, group):
|
||||
self.updateDatas(group)
|
||||
self.setColorScheme()
|
||||
self.updateXY()
|
||||
self.updateGraph()
|
||||
self.queue_draw()
|
||||
|
||||
def updateDatas(self, models):
|
||||
def updateDatas(self, group):
|
||||
self.datas = {}
|
||||
self.labels = {}
|
||||
self.ids = {}
|
||||
self.models = models
|
||||
self.group = group
|
||||
minx = None
|
||||
maxx = None
|
||||
for model in models:
|
||||
for model in group:
|
||||
x = model[self.xfield['name']].get(model)
|
||||
if not minx:
|
||||
minx = x
|
||||
|
||||
@@ -131,7 +131,7 @@ class ParserGraph(ParserInterface):
|
||||
continue
|
||||
xfield = common.node_attributes(child)
|
||||
if not xfield.get('string'):
|
||||
xfield['string'] = fields[xfield['name']]['string']
|
||||
xfield['string'] = fields[xfield['name']].attrs['string']
|
||||
break
|
||||
elif node.localName == 'y':
|
||||
for child in node.childNodes:
|
||||
@@ -139,7 +139,7 @@ class ParserGraph(ParserInterface):
|
||||
continue
|
||||
yattrs = common.node_attributes(child)
|
||||
if not yattrs.get('string') and yattrs['name'] != '#':
|
||||
yattrs['string'] = fields[yattrs['name']]['string']
|
||||
yattrs['string'] = fields[yattrs['name']].attrs['string']
|
||||
yfields.append(yattrs)
|
||||
|
||||
widget = GRAPH_TYPE[attrs.get('type', 'vbar')](xfield, yfields, attrs, model)
|
||||
|
||||
Reference in new issue
Block a user