Browse Source

Frontend fixes (#774)

* connection lines: Fix line selection bug

Connection line was unselected if selection changed from input port to
output port for same connection, probably due to repaint order issue.
New variant should be more stable, yet not requiring non-standard
state variable.

* rack: Reset to noop color if unknown skin set

Some skins are initially designed to have hardcoded, color scheme. With
previously selected dark color and new dark skin, it may become close to
black.
tags/v2.1-alpha1-winvst
nick87720z Filipe Coelho <falktx@falktx.com> 6 years ago
parent
commit
7a237562c3
2 changed files with 19 additions and 14 deletions
  1. +4
    -1
      source/frontend/carla_host.py
  2. +15
    -13
      source/frontend/patchcanvas.py

+ 4
- 1
source/frontend/carla_host.py View File

@@ -608,7 +608,10 @@ class HostWindow(QMainWindow):
return

self.host.set_custom_data(pluginId, CUSTOM_DATA_TYPE_PROPERTY, "CarlaSkin", skin)
pitem.recreateWidget(newSkin = skin)
if skin not in ("default","rncbc","presets","mpresets"):
pitem.recreateWidget(newSkin = skin, newColor = (255,255,255))
else:
pitem.recreateWidget(newSkin = skin)

def switchPlugins(self, pluginIdA, pluginIdB):
if pluginIdA == pluginIdB:


+ 15
- 13
source/frontend/patchcanvas.py View File

@@ -1619,9 +1619,9 @@ class CanvasLine(QGraphicsLineItem):
return

if options.eyecandy == EYECANDY_FULL:
if yesno:
if yesno and not self.m_lineSelected:
self.setGraphicsEffect(CanvasPortGlow(self.item1.getPortType(), self.toGraphicsObject()))
else:
elif self.m_lineSelected and not yesno:
self.setGraphicsEffect(None)

self.m_lineSelected = yesno
@@ -1720,9 +1720,9 @@ class CanvasBezierLine(QGraphicsPathItem):
return

if options.eyecandy == EYECANDY_FULL:
if yesno:
if yesno and not self.m_lineSelected:
self.setGraphicsEffect(CanvasPortGlow(self.item1.getPortType(), self.toGraphicsObject()))
else:
elif self.m_lineSelected and not yesno:
self.setGraphicsEffect(None)

self.m_lineSelected = yesno
@@ -1935,7 +1935,6 @@ class CanvasPort(QGraphicsItem):

self.m_line_mov = None
self.m_hover_item = None
self.m_last_selected_state = False

self.m_mouse_down = False
self.m_cursor_moving = False
@@ -2150,6 +2149,17 @@ class CanvasPort(QGraphicsItem):
elif act_selected == act_x_rename:
canvas.callback(ACTION_PORT_RENAME, self.m_group_id, self.m_port_id, "")

def setPortSelected(self, yesno):
for connection in canvas.connection_list:
if ((connection.group_out_id == self.m_group_id and connection.port_out_id == self.m_port_id) or
(connection.group_in_id == self.m_group_id and connection.port_in_id == self.m_port_id)):
connection.widget.setLineSelected(yesno)

def itemChange(self, change, value):
if change == QGraphicsItem.ItemSelectedHasChanged:
self.setPortSelected(value)
return QGraphicsItem.itemChange(self, change, value)

def triggerDisconnect(self, conn_list=None):
if not conn_list:
conn_list = CanvasGetPortConnectionList(self.m_group_id, self.m_port_id)
@@ -2266,12 +2276,6 @@ class CanvasPort(QGraphicsItem):
painter.setFont(self.m_port_font)
painter.drawText(text_pos, self.m_port_name)

if self.isSelected() != self.m_last_selected_state:
for connection in canvas.connection_list:
if ((connection.group_out_id == self.m_group_id and connection.port_out_id == self.m_port_id) or
(connection.group_in_id == self.m_group_id and connection.port_in_id == self.m_port_id)):
connection.widget.setLineSelected(self.isSelected())

if canvas.theme.idx == Theme.THEME_OOSTUDIO and canvas.theme.port_bg_pixmap:
painter.setPen(Qt.NoPen)
painter.setBrush(conn_pen.brush())
@@ -2283,8 +2287,6 @@ class CanvasPort(QGraphicsItem):

painter.drawRect(connRect)

self.m_last_selected_state = self.isSelected()

painter.restore()

# ------------------------------------------------------------------------------


Loading…
Cancel
Save