From eeea99b45c0a0dccd935dc5203b71e0adf1430fe Mon Sep 17 00:00:00 2001 From: Sebastian Koslowski <koslowski@kit.edu> Date: Tue, 30 Aug 2016 16:27:31 +0200 Subject: grc: gtk3: calculate flowgraph canvas size --- grc/gui/FlowGraph.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'grc/gui/FlowGraph.py') diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py index f082e4f7f0..df8e668eed 100644 --- a/grc/gui/FlowGraph.py +++ b/grc/gui/FlowGraph.py @@ -742,9 +742,13 @@ class FlowGraph(CoreFlowgraph, Element): self.drawing_area.queue_draw() def get_max_coords(self, initial=(0, 0)): - w, h = initial - for block in self.blocks: - x, y = block.coordinate - w = max(w, x + block.width) - h = max(h, y + block.height) - return w, h + return tuple(max(i, e) for i, e in zip(initial, self.extend[2:])) + + @property + def extend(self): + extend = 100000, 100000, 0, 0 + for element in self._elements_to_draw: + extend = (min_or_max(xy, e_xy) for min_or_max, xy, e_xy in zip( + (min, min, max, max), extend, element.extend + )) + return tuple(extend) -- cgit v1.2.3