Browse Source

Draw port outlines inside of designated area

When drawen outside, free space between ports is busy.
But when inside, outline is overlaped with text, so themes need bigger height to fix that.
pull/170/head
Nikita Zlobin 8 years ago
parent
commit
6df25a106d
1 changed files with 24 additions and 24 deletions
  1. +24
    -24
      src/patchcanvas.py

+ 24
- 24
src/patchcanvas.py View File

@@ -1862,17 +1862,17 @@ class CanvasPort(QGraphicsItem):
text_pos = QPointF(3, canvas.theme.port_text_ypos) text_pos = QPointF(3, canvas.theme.port_text_ypos)


if canvas.theme.port_mode == Theme.THEME_PORT_POLYGON: if canvas.theme.port_mode == Theme.THEME_PORT_POLYGON:
poly_locx[0] = -line_width / 2
poly_locx[1] = self.m_port_width + 5 + line_width / 2
poly_locx[2] = self.m_port_width + 12 + line_width / 2
poly_locx[3] = self.m_port_width + 5 + line_width / 2
poly_locx[4] = -line_width / 2
poly_locx[0] = line_width / 2
poly_locx[1] = self.m_port_width + 5 - line_width / 2
poly_locx[2] = self.m_port_width + 12 - line_width / 2
poly_locx[3] = self.m_port_width + 5 - line_width / 2
poly_locx[4] = line_width / 2
elif canvas.theme.port_mode == Theme.THEME_PORT_SQUARE: elif canvas.theme.port_mode == Theme.THEME_PORT_SQUARE:
poly_locx[0] = -line_width / 2
poly_locx[1] = self.m_port_width + 5 + line_width / 2
poly_locx[2] = self.m_port_width + 5 + line_width / 2
poly_locx[3] = self.m_port_width + 5 + line_width / 2
poly_locx[4] = -line_width / 2
poly_locx[0] = line_width / 2
poly_locx[1] = self.m_port_width + 5 - line_width / 2
poly_locx[2] = self.m_port_width + 5 - line_width / 2
poly_locx[3] = self.m_port_width + 5 - line_width / 2
poly_locx[4] = line_width / 2
else: else:
qCritical("PatchCanvas::CanvasPort.paint() - invalid theme port mode '%s'" % canvas.theme.port_mode) qCritical("PatchCanvas::CanvasPort.paint() - invalid theme port mode '%s'" % canvas.theme.port_mode)
return return
@@ -1881,17 +1881,17 @@ class CanvasPort(QGraphicsItem):
text_pos = QPointF(9, canvas.theme.port_text_ypos) text_pos = QPointF(9, canvas.theme.port_text_ypos)


if canvas.theme.port_mode == Theme.THEME_PORT_POLYGON: if canvas.theme.port_mode == Theme.THEME_PORT_POLYGON:
poly_locx[0] = self.m_port_width + 12 + line_width / 2
poly_locx[1] = 7 - line_width / 2
poly_locx[2] = 0 - line_width / 2
poly_locx[3] = 7 - line_width / 2
poly_locx[4] = self.m_port_width + 12 + line_width / 2
poly_locx[0] = self.m_port_width + 12 - line_width / 2
poly_locx[1] = 7 + line_width / 2
poly_locx[2] = 0 + line_width / 2
poly_locx[3] = 7 + line_width / 2
poly_locx[4] = self.m_port_width + 12 - line_width / 2
elif canvas.theme.port_mode == Theme.THEME_PORT_SQUARE: elif canvas.theme.port_mode == Theme.THEME_PORT_SQUARE:
poly_locx[0] = self.m_port_width + 12 + line_width / 2
poly_locx[1] = 5 - line_width / 2
poly_locx[2] = 5 - line_width / 2
poly_locx[3] = 5 - line_width / 2
poly_locx[4] = self.m_port_width + 12 + line_width / 2
poly_locx[0] = self.m_port_width + 12 - line_width / 2
poly_locx[1] = 5 + line_width / 2
poly_locx[2] = 5 + line_width / 2
poly_locx[3] = 5 + line_width / 2
poly_locx[4] = self.m_port_width + 12 - line_width / 2
else: else:
qCritical("PatchCanvas::CanvasPort.paint() - invalid theme port mode '%s'" % canvas.theme.port_mode) qCritical("PatchCanvas::CanvasPort.paint() - invalid theme port mode '%s'" % canvas.theme.port_mode)
return return
@@ -1925,11 +1925,11 @@ class CanvasPort(QGraphicsItem):
return return


polygon = QPolygonF() polygon = QPolygonF()
polygon += QPointF(poly_locx[0], -line_width / 2)
polygon += QPointF(poly_locx[1], -line_width / 2)
polygon += QPointF(poly_locx[0], line_width / 2)
polygon += QPointF(poly_locx[1], line_width / 2)
polygon += QPointF(poly_locx[2], float(canvas.theme.port_height)/2) polygon += QPointF(poly_locx[2], float(canvas.theme.port_height)/2)
polygon += QPointF(poly_locx[3], canvas.theme.port_height + line_width / 2)
polygon += QPointF(poly_locx[4], canvas.theme.port_height + line_width / 2)
polygon += QPointF(poly_locx[3], canvas.theme.port_height - line_width / 2)
polygon += QPointF(poly_locx[4], canvas.theme.port_height - line_width / 2)


if canvas.theme.port_bg_pixmap: if canvas.theme.port_bg_pixmap:
portRect = polygon.boundingRect() portRect = polygon.boundingRect()


Loading…
Cancel
Save