From a27c6bf1061ced857f5281570d5242181b0209bf Mon Sep 17 00:00:00 2001 From: Nikita Zlobin Date: Fri, 8 Jun 2018 01:09:53 +0500 Subject: [PATCH] CanvasBox.updatePositions: fix horizontal port positioning --- source/patchcanvas.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/source/patchcanvas.py b/source/patchcanvas.py index 3f1d967a4..41c43b7bc 100644 --- a/source/patchcanvas.py +++ b/source/patchcanvas.py @@ -2432,17 +2432,21 @@ class CanvasBox(QGraphicsItem): port.widget.setY(last_out_pos) last_out_pos += port_spacing - # Horizontal ports re-positioning - for port in port_list: - if port.port_mode == PORT_MODE_INPUT: - port.widget.setX(1 + canvas.theme.port_offset) - port.widget.setPortWidth(max_in_width) - - elif port.port_mode == PORT_MODE_OUTPUT: - port.widget.setX(self.p_width - max_out_width - canvas.theme.port_offset - 13) - port.widget.setPortWidth(max_out_width) self.p_width = max(self.p_width, 30 + max_in_width + max_out_width) + + # Horizontal ports re-positioning + inX = 1 + canvas.theme.port_offset + outX = self.p_width - max_out_width - canvas.theme.port_offset - 13 + for port_type in port_types: + for port in port_type[1]: + if port.port_mode == PORT_MODE_INPUT: + port.widget.setX(inX) + port.widget.setPortWidth(max_in_width) + + elif port.port_mode == PORT_MODE_OUTPUT: + port.widget.setX(outX) + port.widget.setPortWidth(max_out_width) self.p_height = max(last_in_pos, last_out_pos) self.p_height += max(canvas.theme.port_spacing, canvas.theme.port_spacingT) - canvas.theme.port_spacing