[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 76/101: grc: gtk3: calculate flowgraph canv
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 76/101: grc: gtk3: calculate flowgraph canvas size |
Date: |
Thu, 16 Mar 2017 14:58:10 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch python3
in repository gnuradio.
commit eeea99b45c0a0dccd935dc5203b71e0adf1430fe
Author: Sebastian Koslowski <address@hidden>
Date: Tue Aug 30 16:27:31 2016 +0200
grc: gtk3: calculate flowgraph canvas size
---
grc/gui/Block.py | 10 ++++++++++
grc/gui/Element.py | 9 +++++++++
grc/gui/FlowGraph.py | 16 ++++++++++------
3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index 4b6c5b8..b37bec6 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -311,6 +311,16 @@ class Block(CoreBlock, Element):
PangoCairo.show_layout(cr, self._comment_layout)
cr.restore()
+ @property
+ def extend(self):
+ extend = Element.extend.fget(self)
+ x, y = self.coordinate
+ for port in self.active_ports():
+ extend = (min_or_max(xy, offset + p_xy) for offset, min_or_max,
xy, p_xy in zip(
+ (x, y, x, y), (min, min, max, max), extend, port.extend
+ ))
+ return tuple(extend)
+
##############################################
# Controller Modify
##############################################
diff --git a/grc/gui/Element.py b/grc/gui/Element.py
index 8418bef..17cd6dd 100644
--- a/grc/gui/Element.py
+++ b/grc/gui/Element.py
@@ -168,6 +168,15 @@ class Element(object):
if x <= x1 <= x_m and y <= y1 <= y_m:
return self
+ @property
+ def extend(self):
+ x_min, y_min = x_max, y_max = self.coordinate
+ x_min += min(x for x, y in self._bounding_points)
+ y_min += min(y for x, y in self._bounding_points)
+ x_max += max(x for x, y in self._bounding_points)
+ y_max += max(y for x, y in self._bounding_points)
+ return x_min, y_min, x_max, y_max
+
def mouse_over(self):
pass
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index f082e4f..df8e668 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)
- [Commit-gnuradio] [gnuradio] 52/101: grc: refactor: remove get for port and param name, (continued)
- [Commit-gnuradio] [gnuradio] 52/101: grc: refactor: remove get for port and param name, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 40/101: grc: gtk3: remove coordinate getter/setter, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 69/101: grc: gtk3: use darkened bg color for port border, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 55/101: grc: various clean-ups and fixes, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 48/101: grc: refactor: class for nports port clones, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 49/101: grc: refactor: some more bus ports stuff, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 50/101: grc: refactor: move type and port controllers to gui, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 66/101: grc: gtk3: remove deprecated add_with_viewport(), git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 73/101: grc: gtk3: Tweaked color styles for ports, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 63/101: grc: gtk3: speed up what_is_selected(), git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 76/101: grc: gtk3: calculate flowgraph canvas size,
git <=
- [Commit-gnuradio] [gnuradio] 39/101: grc: gtk3: update gui element class, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 86/101: grc: gtk3: Renamed the ActionHandler to Application, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 58/101: grc: gtk3: fix bug in mouse motion handling, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 51/101: grc: gtk3: fix port label hiding, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 59/101: grc: gtk3: fix drag and drop from block tree, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 30/101: grc: refactor: selected blocks handling, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 74/101: grc: gtk3: minor gui flowgraph cleanup, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 93/101: grc: gtk3: python3 error, some cmake fixes, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 85/101: grc: refactor: Moved the notebook and console into separate classes., git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 61/101: grc: gtk3: draw ports before blocks and simplyfied draw code, git, 2017/03/16