diff options
Diffstat (limited to 'grc/gui/Block.py')
-rw-r--r-- | grc/gui/Block.py | 22 |
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): """ |