summaryrefslogtreecommitdiff
path: root/grc/gui/Block.py
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2014-07-11 15:50:30 -0400
committerTom Rondeau <tom@trondeau.com>2014-07-11 15:50:30 -0400
commitfe1f386291b77d562e0602ef61b64a42d863e535 (patch)
treef1972ef0043fb4825b6eaf9abf0e229850290ea4 /grc/gui/Block.py
parent62831422ae4b2a817a997153468008db38e06598 (diff)
parent831d05eb283e1ac4decb312c990cba089cdca316 (diff)
Merge remote-tracking branch 'gnuradio-wg-grc/grc_hide_ports'
Conflicts: grc/base/Port.py grc/gui/Block.py
Diffstat (limited to 'grc/gui/Block.py')
-rw-r--r--grc/gui/Block.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index 49c0361eb9..0afb351647 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -175,12 +175,19 @@ class Block(Element):
#calculate width and height needed
self.W = self.label_width + 2*BLOCK_LABEL_PADDING
self.H = max(*(
- [self.label_height+2*BLOCK_LABEL_PADDING] + [2*PORT_BORDER_SEPARATION + \
- sum([port.H + PORT_SEPARATION for port in ports]) - PORT_SEPARATION
- for ports in (self.get_sources_gui(), self.get_sinks_gui())] +
- [4*PORT_BORDER_SEPARATION + \
- sum([(port.H) + PORT_SEPARATION for port in ports]) - PORT_SEPARATION
- for ports in ([i for i in self.get_sources_gui() if i.get_type() == 'bus'], [i for i in self.get_sinks_gui() if i.get_type() == 'bus'])]
+ [ # labels
+ self.label_height + 2 * BLOCK_LABEL_PADDING
+ ] +
+ [ # ports
+ 2 * PORT_BORDER_SEPARATION +
+ sum([port.H + PORT_SEPARATION for port in ports if not port.get_hide()]) - PORT_SEPARATION
+ for ports in (self.get_sources_gui(), self.get_sinks_gui())
+ ] +
+ [ # bus ports only
+ 4 * PORT_BORDER_SEPARATION +
+ sum([port.H + PORT_SEPARATION for port in ports if port.get_type() == 'bus']) - PORT_SEPARATION
+ for ports in (self.get_sources_gui(), self.get_sinks_gui())
+ ]
))
def draw(self, gc, window):
@@ -205,7 +212,8 @@ class Block(Element):
window.draw_drawable(gc, self.vertical_label, 0, 0, x+(self.H-self.label_height)/2, y+BLOCK_LABEL_PADDING, -1, -1)
#draw ports
for port in self.get_ports_gui():
- port.draw(gc, window)
+ if not port.get_hide():
+ port.draw(gc, window)
def what_is_selected(self, coor, coor_m=None):
"""