Browse Source

patchbay mini-canvas working again

tags/1.9.4
falkTX 11 years ago
parent
commit
aafd65787b
5 changed files with 189 additions and 101 deletions
  1. +6
    -6
      source/carla
  2. +1
    -1
      source/carla-patchbay
  3. +26
    -25
      source/carla_host.py
  4. +152
    -65
      source/carla_patchbay.py
  5. +4
    -4
      source/widgets/canvaspreviewframe.py

+ 6
- 6
source/carla View File

@@ -82,10 +82,11 @@ class CarlaMultiW(QTabWidget):
parent.ReloadParametersCallback.connect(self.fRack.slot_handleReloadParametersCallback)
parent.ReloadProgramsCallback.connect(self.fRack.slot_handleReloadProgramsCallback)
parent.ReloadAllCallback.connect(self.fRack.slot_handleReloadAllCallback)

parent.PatchbayClientAddedCallback.connect(self.fPatchbay.slot_handlePatchbayClientAddedCallback)
parent.PatchbayClientRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayClientRemovedCallback)
parent.PatchbayClientRenamedCallback.connect(self.fPatchbay.slot_handlePatchbayClientRenamedCallback)
#parent.PatchbayIconChangedCallback.connect(self.fPatchbay.slot_handlePatchbayIconChangedCallback)
parent.PatchbayClientIconChangedCallback.connect(self.fPatchbay.slot_handlePatchbayClientIconChangedCallback)
parent.PatchbayPortAddedCallback.connect(self.fPatchbay.slot_handlePatchbayPortAddedCallback)
parent.PatchbayPortRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayPortRemovedCallback)
parent.PatchbayPortRenamedCallback.connect(self.fPatchbay.slot_handlePatchbayPortRenamedCallback)
@@ -107,10 +108,9 @@ class CarlaMultiW(QTabWidget):

def renamePlugin(self, pluginId, newName):
self.fRack.renamePlugin(pluginId, newName)
self.fPatchbay.renamePlugin(pluginId, newName)

def disablePlugin(self, pluginId, errorMsg):
pass
self.fRack.disablePlugin(pluginId)

def removeAllPlugins(self):
self.fRack.removeAllPlugins()
@@ -141,9 +141,9 @@ class CarlaMultiW(QTabWidget):
# -----------------------------------------------------------------

def saveSettings(self, settings):
pass
#self.fRack.saveSettings(settings)
#self.fPatchbay.saveSettings(settings)
self.fPatchbay.saveSettings(settings)
#self.fParent.saveSettings(settings)

# ------------------------------------------------------------------------------------------------------------
# Main Window
@@ -156,7 +156,7 @@ class CarlaHostW(HostWindow):
# Set-up container

self.fContainer = CarlaMultiW(self)
self.setupContainer(True)
self.setupContainer(True, self.fContainer.fPatchbay.themeData)

# -------------------------------------------------------------
# Set-up GUI stuff


+ 1
- 1
source/carla-patchbay View File

@@ -30,7 +30,7 @@ class CarlaHostW(HostWindow):
HostWindow.__init__(self, parent)

self.fContainer = CarlaPatchbayW(self)
self.setupContainer(True)
self.setupContainer(True, self.fContainer.themeData)

# ------------------------------------------------------------------------------------------------------------
# Main


+ 26
- 25
source/carla_host.py View File

@@ -264,10 +264,10 @@ class HostWindow(QMainWindow):
self.PluginRenamedCallback.connect(self.slot_handlePluginRenamedCallback)
self.PluginUnavailableCallback.connect(self.slot_handlePluginUnavailableCallback)

# parameter (rack)
# program, midi-program, ui-state (rack)
# note on, off (rack)
# update, reload (rack)
# parameter (rack, patchbay)
# program, midi-program, ui-state (rack, patchbay)
# note on, off (rack, patchbay)
# update, reload (rack, patchbay)
# patchbay

self.EngineStartedCallback.connect(self.slot_handleEngineStartedCallback)
@@ -299,19 +299,22 @@ class HostWindow(QMainWindow):
dialog = CarlaSettingsW(self, hasCanvas, hasCanvasGL)
return dialog.exec_()

def setupContainer(self, showMiniCanvas):
def setupContainer(self, showMiniCanvas, canvasThemeData = []):
if showMiniCanvas:
CARLA_DEFAULT_CANVAS_WIDTH = 3100
CARLA_DEFAULT_CANVAS_HEIGHT = 2400
self.ui.miniCanvasPreview.setRealParent(self)
#self.ui.miniCanvasPreview.setViewTheme(patchcanvas.canvas.theme.canvas_bg, patchcanvas.canvas.theme.rubberband_brush, patchcanvas.canvas.theme.rubberband_pen.color())
self.ui.miniCanvasPreview.init(self.fContainer.scene, CARLA_DEFAULT_CANVAS_WIDTH, CARLA_DEFAULT_CANVAS_HEIGHT, self.fSavedSettings["UseCustomMiniCanvasPaint"])
canvasWidth, canvasHeight, canvasBg, canvasBrush, canvasPen = canvasThemeData
self.ui.miniCanvasPreview.setViewTheme(canvasBg, canvasBrush, canvasPen)
self.ui.miniCanvasPreview.init(self.fContainer.scene, canvasWidth, canvasHeight, self.fSavedSettings["UseCustomMiniCanvasPaint"])
else:
self.ui.miniCanvasPreview.hide()
self.ui.miniCanvasPreview.hide()

self.ui.mainwidget.hide()
self.ui.splitter.insertWidget(0, self.fContainer)
del self.ui.mainwidget
self.ui.splitter.insertWidget(0, self.fContainer)

def updateContainer(self, canvasThemeData):
canvasWidth, canvasHeight, canvasBg, canvasBrush, canvasPen = canvasThemeData
self.ui.miniCanvasPreview.setViewTheme(canvasBg, canvasBrush, canvasPen)
self.ui.miniCanvasPreview.init(self.fContainer.scene, canvasWidth, canvasHeight, self.fSavedSettings["UseCustomMiniCanvasPaint"])

# -----------------------------------------------------------------
# Internal stuff (files)
@@ -545,7 +548,7 @@ class HostWindow(QMainWindow):
folder = diskFolders[i]
self.ui.cb_disk.addItem(os.path.basename(folder), folder)

if MACOS and not settings.value("Main/UseProTheme", True, type=bool):
if MACOS and not settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, True, type=bool):
self.setUnifiedTitleAndToolBarOnMac(True)

# ---------------------------------------------
@@ -589,8 +592,8 @@ class HostWindow(QMainWindow):
# TODO

self.fSavedSettings = {
"Main/DefaultProjectFolder": settings.value("Main/DefaultProjectFolder", HOME, type=str),
"Main/RefreshInterval": settings.value("Main/RefreshInterval", 50, type=int),
CARLA_KEY_MAIN_PROJECT_FOLDER: settings.value(CARLA_KEY_MAIN_PROJECT_FOLDER, CARLA_DEFAULT_MAIN_PROJECT_FOLDER, type=str),
CARLA_KEY_MAIN_REFRESH_INTERVAL: settings.value(CARLA_KEY_MAIN_REFRESH_INTERVAL, CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, type=int),
CARLA_KEY_CANVAS_THEME: settings.value(CARLA_KEY_CANVAS_THEME, CARLA_DEFAULT_CANVAS_THEME, type=str),
CARLA_KEY_CANVAS_SIZE: settings.value(CARLA_KEY_CANVAS_SIZE, CARLA_DEFAULT_CANVAS_SIZE, type=str),
CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS: settings.value(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS, type=bool),
@@ -599,19 +602,19 @@ class HostWindow(QMainWindow):
CARLA_KEY_CANVAS_USE_OPENGL: settings.value(CARLA_KEY_CANVAS_USE_OPENGL, CARLA_DEFAULT_CANVAS_USE_OPENGL, type=bool),
CARLA_KEY_CANVAS_ANTIALIASING: settings.value(CARLA_KEY_CANVAS_ANTIALIASING, CARLA_DEFAULT_CANVAS_ANTIALIASING, type=int),
CARLA_KEY_CANVAS_HQ_ANTIALIASING: settings.value(CARLA_KEY_CANVAS_HQ_ANTIALIASING, CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING, type=bool),
"UseCustomMiniCanvasPaint": (settings.value("Main/UseProTheme", True, type=bool) and
settings.value("Main/ProThemeColor", "Black", type=str).lower() == "black")
"UseCustomMiniCanvasPaint": (settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, True, type=bool) and
settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, "Black", type=str).lower() == "black")
}

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

if self.fIdleTimerFast != 0:
self.killTimer(self.fIdleTimerFast)
self.fIdleTimerFast = self.startTimer(self.fSavedSettings["Main/RefreshInterval"])
self.fIdleTimerFast = self.startTimer(self.fSavedSettings[CARLA_KEY_MAIN_REFRESH_INTERVAL])

if self.fIdleTimerSlow != 0:
self.killTimer(self.fIdleTimerSlow)
self.fIdleTimerSlow = self.startTimer(self.fSavedSettings["Main/RefreshInterval"]*2)
self.fIdleTimerSlow = self.startTimer(self.fSavedSettings[CARLA_KEY_MAIN_REFRESH_INTERVAL]*2)

def saveSettings(self):
settings = QSettings()
@@ -619,8 +622,6 @@ class HostWindow(QMainWindow):
settings.setValue("Geometry", self.saveGeometry())
settings.setValue("SplitterState", self.ui.splitter.saveState())
settings.setValue("ShowToolbar", self.ui.toolBar.isVisible())
#settings.setValue("HorizontalScrollBarValue", self.ui.graphicsView.horizontalScrollBar().value())
#settings.setValue("VerticalScrollBarValue", self.ui.graphicsView.verticalScrollBar().value())

diskFolders = []

@@ -655,7 +656,7 @@ class HostWindow(QMainWindow):
@pyqtSlot()
def slot_fileOpen(self):
fileFilter = self.tr("Carla Project File (*.carxp)")
filenameTry = QFileDialog.getOpenFileName(self, self.tr("Open Carla Project File"), self.fSavedSettings["Main/DefaultProjectFolder"], filter=fileFilter)[0]
filenameTry = QFileDialog.getOpenFileName(self, self.tr("Open Carla Project File"), self.fSavedSettings[CARLA_KEY_MAIN_PROJECT_FOLDER], filter=fileFilter)[0]

if not filenameTry:
return
@@ -684,7 +685,7 @@ class HostWindow(QMainWindow):
return self.saveProjectNow()

fileFilter = self.tr("Carla Project File (*.carxp)")
filenameTry = QFileDialog.getSaveFileName(self, self.tr("Save Carla Project File"), self.fSavedSettings["Main/DefaultProjectFolder"], filter=fileFilter)[0]
filenameTry = QFileDialog.getSaveFileName(self, self.tr("Save Carla Project File"), self.fSavedSettings[CARLA_KEY_MAIN_PROJECT_FOLDER], filter=fileFilter)[0]

if not filenameTry:
return
@@ -931,9 +932,9 @@ class HostWindow(QMainWindow):
self.slot_engineStart(False)

if self.fIdleTimerFast == 0:
self.fIdleTimerFast = self.startTimer(self.fSavedSettings["Main/RefreshInterval"])
self.fIdleTimerFast = self.startTimer(self.fSavedSettings[CARLA_KEY_MAIN_REFRESH_INTERVAL])
if self.fIdleTimerSlow == 0:
self.fIdleTimerSlow = self.startTimer(self.fSavedSettings["Main/RefreshInterval"]*2)
self.fIdleTimerSlow = self.startTimer(self.fSavedSettings[CARLA_KEY_MAIN_REFRESH_INTERVAL]*2)

@pyqtSlot()
def slot_handleEngineStoppedCallback(self):


+ 152
- 65
source/carla_patchbay.py View File

@@ -19,6 +19,7 @@
# ------------------------------------------------------------------------------------------------------------
# Imports (Global)

from PyQt4.QtCore import QPointF, QTimer
from PyQt4.QtGui import QGraphicsView, QImage, QPrinter, QPrintDialog

# ------------------------------------------------------------------------------------------------------------
@@ -57,49 +58,41 @@ class CarlaPatchbayW(QGraphicsView):
self.fPluginCount = 0
self.fPluginList = []

self.fCanvasWidth = 0
self.fCanvasHeight = 0

# -------------------------------------------------------------
# Set-up Canvas Preview

self.fMiniCanvasPreview = self.fParent.ui.miniCanvasPreview
self.fMiniCanvasPreview.setRealParent(self)
self.fMovingViaMiniCanvas = False

# -------------------------------------------------------------
# Set-up Canvas

self.scene = patchcanvas.PatchScene(self, self) # FIXME?
self.setScene(self.scene)
self.setRenderHint(QPainter.Antialiasing, bool(parent.fSavedSettings[CARLA_KEY_CANVAS_ANTIALIASING] == patchcanvas.ANTIALIASING_FULL))

if parent.fSavedSettings[CARLA_KEY_CANVAS_USE_OPENGL] and hasGL:
self.setViewport(QGLWidget(self))
self.setRenderHint(QPainter.HighQualityAntialiasing, parent.fSavedSettings[CARLA_KEY_CANVAS_HQ_ANTIALIASING])

pOptions = patchcanvas.options_t()
pOptions.theme_name = parent.fSavedSettings[CARLA_KEY_CANVAS_THEME]
pOptions.auto_hide_groups = parent.fSavedSettings[CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS]
pOptions.use_bezier_lines = parent.fSavedSettings[CARLA_KEY_CANVAS_USE_BEZIER_LINES]
pOptions.antialiasing = parent.fSavedSettings[CARLA_KEY_CANVAS_ANTIALIASING]
pOptions.eyecandy = parent.fSavedSettings[CARLA_KEY_CANVAS_EYE_CANDY]

pFeatures = patchcanvas.features_t()
pFeatures.group_info = False
pFeatures.group_rename = False
pFeatures.port_info = False
pFeatures.port_rename = False
pFeatures.handle_group_pos = True
self.setupCanvas()

patchcanvas.setOptions(pOptions)
patchcanvas.setFeatures(pFeatures)
patchcanvas.init("Carla2", self.scene, canvasCallback, False)
QTimer.singleShot(100, self.slot_restoreScrollbarValues)

tryCanvasSize = parent.fSavedSettings[CARLA_KEY_CANVAS_SIZE].split("x")
# -------------------------------------------------------------
# Connect actions to functions

if len(tryCanvasSize) == 2 and tryCanvasSize[0].isdigit() and tryCanvasSize[1].isdigit():
canvasWidth = int(tryCanvasSize[0])
canvasHeight = int(tryCanvasSize[1])
else:
canvasWidth = CARLA_DEFAULT_CANVAS_SIZE_WIDTH
canvasHeight = CARLA_DEFAULT_CANVAS_SIZE_HEIGHT
self.horizontalScrollBar().valueChanged.connect(self.slot_horizontalScrollBarChanged)
self.verticalScrollBar().valueChanged.connect(self.slot_verticalScrollBarChanged)

patchcanvas.setCanvasSize(0, 0, canvasWidth, canvasHeight)
patchcanvas.setInitialPos(canvasWidth / 2, canvasHeight / 2)
self.setSceneRect(0, 0, canvasWidth, canvasHeight)
self.scene.scaleChanged.connect(self.slot_canvasScaleChanged)
self.scene.sceneGroupMoved.connect(self.slot_canvasItemMoved)

# -------------------------------------------------------------
# Connect actions to functions
self.fMiniCanvasPreview.miniCanvasMoved.connect(self.slot_miniCanvasMoved)

if not doSetup: return

@@ -124,14 +117,6 @@ class CarlaPatchbayW(QGraphicsView):

parent.ui.act_settings_configure.triggered.connect(self.slot_configureCarla)

#self.ui.miniCanvasPreview-miniCanvasMoved(double, double)"), SLOT("slot_miniCanvasMoved(double, double)"))

#self.ui.graphicsView.horizontalScrollBar()-valueChanged.connect(self.slot_horizontalScrollBarChanged)
#self.ui.graphicsView.verticalScrollBar()-valueChanged.connect(self.slot_verticalScrollBarChanged)

#self.scene-sceneGroupMoved(int, int, QPointF)"), SLOT("slot_canvasItemMoved(int, int, QPointF)"))
#self.scene-scaleChanged(double)"), SLOT("slot_canvasScaleChanged(double)"))

parent.ParameterValueChangedCallback.connect(self.slot_handleParameterValueChangedCallback)
parent.ParameterDefaultChangedCallback.connect(self.slot_handleParameterDefaultChangedCallback)
parent.ParameterMidiChannelChangedCallback.connect(self.slot_handleParameterMidiChannelChangedCallback)
@@ -249,7 +234,8 @@ class CarlaPatchbayW(QGraphicsView):
# -----------------------------------------------------------------

def saveSettings(self, settings):
pass
settings.setValue("HorizontalScrollBarValue", self.horizontalScrollBar().value())
settings.setValue("VerticalScrollBarValue", self.verticalScrollBar().value())

# -----------------------------------------------------------------
# called by PluginEdit, ignored here
@@ -259,6 +245,107 @@ class CarlaPatchbayW(QGraphicsView):

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

def setupCanvas(self):
pOptions = patchcanvas.options_t()
pOptions.theme_name = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_THEME]
pOptions.auto_hide_groups = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS]
pOptions.use_bezier_lines = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_USE_BEZIER_LINES]
pOptions.antialiasing = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_ANTIALIASING]
pOptions.eyecandy = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_EYE_CANDY]

pFeatures = patchcanvas.features_t()
pFeatures.group_info = False
pFeatures.group_rename = False
pFeatures.port_info = False
pFeatures.port_rename = False
pFeatures.handle_group_pos = True

patchcanvas.setOptions(pOptions)
patchcanvas.setFeatures(pFeatures)
patchcanvas.init("Carla2", self.scene, canvasCallback, False)

tryCanvasSize = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_SIZE].split("x")

if len(tryCanvasSize) == 2 and tryCanvasSize[0].isdigit() and tryCanvasSize[1].isdigit():
self.fCanvasWidth = int(tryCanvasSize[0])
self.fCanvasHeight = int(tryCanvasSize[1])
else:
self.fCanvasWidth = CARLA_DEFAULT_CANVAS_SIZE_WIDTH
self.fCanvasHeight = CARLA_DEFAULT_CANVAS_SIZE_HEIGHT

patchcanvas.setCanvasSize(0, 0, self.fCanvasWidth, self.fCanvasHeight)
patchcanvas.setInitialPos(self.fCanvasWidth / 2, self.fCanvasHeight / 2)
self.setSceneRect(0, 0, self.fCanvasWidth, self.fCanvasHeight)

self.themeData = [self.fCanvasWidth, self.fCanvasHeight, patchcanvas.canvas.theme.canvas_bg, patchcanvas.canvas.theme.rubberband_brush, patchcanvas.canvas.theme.rubberband_pen.color()]

def updateCanvasInitialPos(self):
x = self.horizontalScrollBar().value() + self.width()/4
y = self.verticalScrollBar().value() + self.height()/4
patchcanvas.setInitialPos(x, y)

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

@pyqtSlot()
def slot_miniCanvasCheckAll(self):
self.slot_miniCanvasCheckSize()
self.slot_horizontalScrollBarChanged(self.horizontalScrollBar().value())
self.slot_verticalScrollBarChanged(self.verticalScrollBar().value())

@pyqtSlot()
def slot_miniCanvasCheckSize(self):
self.fMiniCanvasPreview.setViewSize(float(self.width()) / self.fCanvasWidth, float(self.height()) / self.fCanvasHeight)

@pyqtSlot(int)
def slot_horizontalScrollBarChanged(self, value):
if self.fMovingViaMiniCanvas: return

maximum = self.horizontalScrollBar().maximum()
if maximum == 0:
xp = 0
else:
xp = float(value) / maximum
self.fMiniCanvasPreview.setViewPosX(xp)
self.updateCanvasInitialPos()

@pyqtSlot(int)
def slot_verticalScrollBarChanged(self, value):
if self.fMovingViaMiniCanvas: return

maximum = self.verticalScrollBar().maximum()
if maximum == 0:
yp = 0
else:
yp = float(value) / maximum
self.fMiniCanvasPreview.setViewPosY(yp)
self.updateCanvasInitialPos()

@pyqtSlot()
def slot_restoreScrollbarValues(self):
settings = QSettings()
self.horizontalScrollBar().setValue(settings.value("HorizontalScrollBarValue", self.horizontalScrollBar().maximum()/2, type=int))
self.verticalScrollBar().setValue(settings.value("VerticalScrollBarValue", self.verticalScrollBar().maximum()/2, type=int))

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

@pyqtSlot(float)
def slot_canvasScaleChanged(self, scale):
self.fMiniCanvasPreview.setViewScale(scale)

@pyqtSlot(int, int, QPointF)
def slot_canvasItemMoved(self, group_id, split_mode, pos):
self.fMiniCanvasPreview.update()

@pyqtSlot(float, float)
def slot_miniCanvasMoved(self, xp, yp):
self.fMovingViaMiniCanvas = True
self.horizontalScrollBar().setValue(xp * self.fCanvasWidth)
self.verticalScrollBar().setValue(yp * self.fCanvasHeight)
self.fMovingViaMiniCanvas = False
self.updateCanvasInitialPos()

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

@pyqtSlot()
def slot_pluginsEnable(self):
if not Carla.host.is_engine_running():
@@ -362,23 +449,8 @@ class CarlaPatchbayW(QGraphicsView):

patchcanvas.clear()

pOptions = patchcanvas.options_t()
pOptions.theme_name = self.fParent.fSavedSettings["Canvas/Theme"]
pOptions.auto_hide_groups = self.fParent.fSavedSettings["Canvas/AutoHideGroups"]
pOptions.use_bezier_lines = self.fParent.fSavedSettings["Canvas/UseBezierLines"]
pOptions.antialiasing = self.fParent.fSavedSettings["Canvas/Antialiasing"]
pOptions.eyecandy = self.fParent.fSavedSettings["Canvas/EyeCandy"]

pFeatures = patchcanvas.features_t()
pFeatures.group_info = False
pFeatures.group_rename = False
pFeatures.port_info = False
pFeatures.port_rename = False
pFeatures.handle_group_pos = True

patchcanvas.setOptions(pOptions)
patchcanvas.setFeatures(pFeatures)
patchcanvas.init("Carla2", self.scene, canvasCallback, False)
self.setupCanvas()
self.fParent.updateContainer(self.themeData)

if Carla.host.is_engine_running():
Carla.host.patchbay_refresh()
@@ -553,22 +625,37 @@ class CarlaPatchbayW(QGraphicsView):
pcIcon = patchcanvas.ICON_FILE

patchcanvas.addGroup(clientId, clientName, pcSplit, pcIcon)
#QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))

QTimer.singleShot(0, self.fMiniCanvasPreview.update)

@pyqtSlot(int)
def slot_handlePatchbayClientRemovedCallback(self, clientId):
#if not self.fEngineStarted: return
patchcanvas.removeGroup(clientId)
#QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.fMiniCanvasPreview.update)

@pyqtSlot(int, str)
def slot_handlePatchbayClientRenamedCallback(self, clientId, newClientName):
patchcanvas.renameGroup(clientId, newClientName)
#QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.fMiniCanvasPreview.update)

@pyqtSlot(int, str)
def slot_handlePatchbayClientIconChangedCallback(self, clientId, iconName):
patchcanvas.setGroupIcon(clientId, iconName)
@pyqtSlot(int, int)
def slot_handlePatchbayClientIconChangedCallback(self, clientId, clientIcon):
pcIcon = patchcanvas.ICON_APPLICATION

if clientIcon == PATCHBAY_ICON_PLUGIN:
pcIcon = patchcanvas.ICON_PLUGIN
if clientIcon == PATCHBAY_ICON_HARDWARE:
pcIcon = patchcanvas.ICON_HARDWARE
elif clientIcon == PATCHBAY_ICON_CARLA:
pass
elif clientIcon == PATCHBAY_ICON_DISTRHO:
pcIcon = patchcanvas.ICON_DISTRHO
elif clientIcon == PATCHBAY_ICON_FILE:
pcIcon = patchcanvas.ICON_FILE

patchcanvas.setGroupIcon(clientId, pcIcon)
QTimer.singleShot(0, self.fMiniCanvasPreview.update)

@pyqtSlot(int, int, int, str)
def slot_handlePatchbayPortAddedCallback(self, clientId, portId, portFlags, portName):
@@ -587,29 +674,29 @@ class CarlaPatchbayW(QGraphicsView):
portType = patchcanvas.PORT_TYPE_NULL

patchcanvas.addPort(clientId, portId, portName, portMode, portType)
#QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.fMiniCanvasPreview.update)

@pyqtSlot(int, int)
def slot_handlePatchbayPortRemovedCallback(self, groupId, portId):
#if not self.fEngineStarted: return
patchcanvas.removePort(portId)
#QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.fMiniCanvasPreview.update)

@pyqtSlot(int, int, str)
def slot_handlePatchbayPortRenamedCallback(self, groupId, portId, newPortName):
patchcanvas.renamePort(portId, newPortName)
#QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.fMiniCanvasPreview.update)

@pyqtSlot(int, int, int)
def slot_handlePatchbayConnectionAddedCallback(self, connectionId, portOutId, portInId):
patchcanvas.connectPorts(connectionId, portOutId, portInId)
#QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.fMiniCanvasPreview.update)

@pyqtSlot(int, int, int)
def slot_handlePatchbayConnectionRemovedCallback(self, connectionId, portOutId, portInId):
#if not self.fEngineStarted: return
patchcanvas.disconnectPorts(connectionId)
#QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.fMiniCanvasPreview.update)

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



+ 4
- 4
source/widgets/canvaspreviewframe.py View File

@@ -101,8 +101,8 @@ class CanvasPreviewFrame(QFrame):
def setViewScale(self, scale):
self.fScale = scale

#if self.fRealParent is not None:
#QTimer.singleShot(0, self.fRealParent.slot_miniCanvasCheckAll)
if self.fRealParent is not None:
QTimer.singleShot(0, self.fRealParent.slot_miniCanvasCheckAll)

def setViewSize(self, width, height):
self.fViewRect[iWidth] = width * self.fFakeWidth
@@ -205,7 +205,7 @@ class CanvasPreviewFrame(QFrame):
def resizeEvent(self, event):
self.fRenderSource = self.getRenderSource()

#if self.fRealParent is not None:
#QTimer.singleShot(0, self.fRealParent.slot_miniCanvasCheckAll)
if self.fRealParent is not None:
QTimer.singleShot(0, self.fRealParent.slot_miniCanvasCheckAll)

QFrame.resizeEvent(self, event)

Loading…
Cancel
Save