From 558178930259cb9c3eb2006afed831547641d559 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 31 Aug 2018 14:31:42 +0200 Subject: [PATCH] Cleanup, small fix for previous commits --- source/patchcanvas.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/source/patchcanvas.py b/source/patchcanvas.py index 17ac55b81..5d39b83f4 100644 --- a/source/patchcanvas.py +++ b/source/patchcanvas.py @@ -2404,12 +2404,12 @@ class CanvasBox(QGraphicsItem): port_spacing = canvas.theme.port_height + canvas.theme.port_spacing # Get Max Box Width, vertical ports re-positioning - port_types = [PORT_TYPE_AUDIO_JACK, PORT_TYPE_MIDI_JACK, PORT_TYPE_MIDI_ALSA, PORT_TYPE_PARAMETER] + port_types = [PORT_TYPE_AUDIO_JACK, PORT_TYPE_MIDI_JACK, PORT_TYPE_MIDI_ALSA, PORT_TYPE_PARAMETER] last_in_type = last_out_type = PORT_TYPE_NULL last_in_pos = last_out_pos = canvas.theme.box_header_height + canvas.theme.box_header_spacing + for port_type in port_types: for port in port_list: - if port.port_type != port_type: continue @@ -2433,14 +2433,13 @@ class CanvasBox(QGraphicsItem): port.widget.setY(last_out_pos) last_out_pos += port_spacing - 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]: + for port in port_list: if port.port_mode == PORT_MODE_INPUT: port.widget.setX(inX) port.widget.setPortWidth(max_in_width) @@ -2448,8 +2447,8 @@ class CanvasBox(QGraphicsItem): 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(last_in_pos, last_out_pos) self.p_height += max(canvas.theme.port_spacing, canvas.theme.port_spacingT) - canvas.theme.port_spacing self.p_height += canvas.theme.box_pen.widthF() @@ -2788,14 +2787,14 @@ class CanvasIcon(QGraphicsSvgItem): return self.p_size def paint(self, painter, option, widget): - if self.m_renderer: - painter.save() - painter.setRenderHint(QPainter.Antialiasing, False) - painter.setRenderHint(QPainter.TextAntialiasing, False) - self.m_renderer.render(painter, self.p_size) - painter.restore() - else: - QGraphicsSvgItem.paint(self, painter, option, widget) + if not self.m_renderer: + return QGraphicsSvgItem.paint(self, painter, option, widget) + + painter.save() + painter.setRenderHint(QPainter.Antialiasing, False) + painter.setRenderHint(QPainter.TextAntialiasing, False) + self.m_renderer.render(painter, self.p_size) + painter.restore() # ------------------------------------------------------------------------------ # canvasportglow.cpp