Browse Source

Add carla file to replicate 1.x gui style

tags/1.9.4
falkTX 11 years ago
parent
commit
2088d2498e
6 changed files with 269 additions and 46 deletions
  1. +1
    -1
      resources/ui/carla_settings.ui
  2. +252
    -0
      source/carla
  3. +0
    -33
      source/carla.py
  4. +10
    -12
      source/carla_host.py
  5. +3
    -0
      source/carla_patchbay.py
  6. +3
    -0
      source/carla_rack.py

+ 1
- 1
resources/ui/carla_settings.ui View File

@@ -180,7 +180,7 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number>
<number>0</number>
</property> </property>
<widget class="QWidget" name="page_main"> <widget class="QWidget" name="page_main">
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">


+ 252
- 0
source/carla View File

@@ -0,0 +1,252 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Carla plugin host
# Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# For a full copy of the GNU General Public License see the GPL.txt file

# ------------------------------------------------------------------------------------------------------------
# Imports (Global)

try:
from PyQt5.QtWidgets import QLabel, QTabWidget
except:
from PyQt4.QtGui import QLabel, QTabWidget

# ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff)

from carla_host import *
from carla_patchbay import CarlaPatchbayW
from carla_rack import CarlaRackW

# ------------------------------------------------------------------------------------------------------------
# Tab widget (rack + patchbay)

class CarlaMultiW(QTabWidget):
def __init__(self, parent):
QTabWidget.__init__(self, parent)

self.fRack = CarlaRackW(parent)
self.fPatchbay = CarlaPatchbayW(parent)
self.fParent = parent

self.addTab(self.fRack, "Plugins")
self.addTab(self.fPatchbay, "Patchbay")

self.scene = self.fPatchbay.scene

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

def getPluginCount(self):
return self.fRack.getPluginCount()

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

def addPlugin(self, pluginId, isProjectLoading):
self.fRack.addPlugin(pluginId, isProjectLoading)
self.fPatchbay.addPlugin(pluginId, isProjectLoading)

def removePlugin(self, pluginId):
self.fRack.removePlugin(pluginId)
self.fPatchbay.removePlugin(pluginId)

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

def removeAllPlugins(self):
self.fRack.removeAllPlugins()
self.fPatchbay.removeAllPlugins()

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

def engineStarted(self):
self.fRack.engineStarted()
self.fPatchbay.engineStarted()
self.fParent.engineChanged()

def engineStopped(self):
self.fRack.engineStopped()
self.fPatchbay.engineStopped()
self.fParent.engineStopped()

def engineChanged(self):
self.fParent.engineChanged()

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

def idleFast(self):
self.fRack.idleFast()
self.fPatchbay.idleFast()

def idleSlow(self):
self.fRack.idleSlow()
self.fPatchbay.idleSlow()

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

def saveSettings(self, settings):
self.fRack.saveSettings(settings)
self.fPatchbay.saveSettings(settings)

# ------------------------------------------------------------------------------------------------------------
# Main Window

class CarlaHostW(HostWindow):
def __init__(self, parent=None):
HostWindow.__init__(self, parent)

# -------------------------------------------------------------
# Set-up container

self.fContainer = CarlaMultiW(self)
self.setupContainer(True)

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

self.fInfoText = ""
self.fInfoLabel = QLabel(self)
self.fInfoLabel.setText("Engine stopped")

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

self.ui.act_settings_show_toolbar.triggered.connect(self.slot_toolbarShown)
self.ui.splitter.splitterMoved.connect(self.slot_splitterMoved)

QTimer.singleShot(0, self.slot_infoLabelInit)

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

def engineStopped(self):
self.fInfoText = ""
self.fInfoLabel.setText("Engine stopped")

def engineChanged(self):
self.fInfoText = "Engine running | SampleRate: %g | BufferSize: %i" % (self.fSampleRate, self.fBufferSize)
self.fInfoLabel.setText("%s | %s" % (self.fInfoText, self.fTextTransport))

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

def updateInfoLabelPos(self):
tabBar = self.fContainer.tabBar()
y = tabBar.mapFromParent(self.ui.centralwidget.pos()).y() #+tabBar.height()/4

if not self.ui.toolBar.isVisible():
y -= self.ui.toolBar.height()

self.fInfoLabel.move(self.fInfoLabel.x(), y)

def updateInfoLabelSize(self):
tabBar = self.fContainer.tabBar()
self.fInfoLabel.resize(self.fContainer.width()-tabBar.width()-20, self.fInfoLabel.height())

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

@pyqtSlot()
def slot_splitterMoved(self):
self.updateInfoLabelSize()

@pyqtSlot()
def slot_toolbarShown(self):
self.updateInfoLabelPos()

@pyqtSlot()
def slot_infoLabelInit(self):
tabBar = self.fContainer.tabBar()
x = tabBar.width()+20
y = tabBar.mapFromParent(self.ui.centralwidget.pos()).y() #+ tabBar.height()/4
self.fInfoLabel.move(x, y)
self.fInfoLabel.resize(self.fContainer.width()-x, tabBar.height())

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

def resizeEvent(self, event):
self.updateInfoLabelSize()
HostWindow.resizeEvent(self, event)

def timerEvent(self, event):
HostWindow.timerEvent(self, event)

if event.timerId() == self.fIdleTimerFast:
self.fInfoLabel.setText("%s | %s" % (self.fInfoText, self.fTextTransport))

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

if __name__ == '__main__':
# -------------------------------------------------------------
# App initialization

app = CarlaApplication()

# -------------------------------------------------------------
# Set-up custom signal handling

setUpSignals()

# -------------------------------------------------------------
# Read CLI args

appName = os.path.basename(__file__) if ("__file__" in dir() and os.path.dirname(__file__) in PATH) else sys.argv[0]
libPrefix = None
projectFilename = None

argv = app.arguments()
argc = len(argv)

for i in range(argc):
if i == 0: continue
argument = argv[i]

if argument.startswith("--with-appname="):
appName = os.path.basename(argument.replace("--with-appname=", ""))

elif argument.startswith("--with-libprefix="):
libPrefix = argument.replace("--with-libprefix=", "")

elif os.path.exists(argument):
projectFilename = argument

# -------------------------------------------------------------
# Init host backend

Carla.isControl = False
Carla.isLocal = True
Carla.isPlugin = False
Carla.processMode = PROCESS_MODE_CONTINUOUS_RACK

initHost(appName, libPrefix)

# -------------------------------------------------------------
# Create GUI

Carla.gui = CarlaHostW()

# -------------------------------------------------------------
# Load project file if set

if projectFilename is not None:
Carla.gui.loadProjectLater(projectFilename)

# -------------------------------------------------------------
# Show GUI

Carla.gui.show()

# -------------------------------------------------------------
# App-Loop

sys.exit(app.exec_())

+ 0
- 33
source/carla.py View File

@@ -75,10 +75,6 @@ class CarlaMainW(QMainWindow):
# ------------------------------------------------------------- # -------------------------------------------------------------
# Set-up GUI stuff # Set-up GUI stuff


self.fInfoLabel = QLabel(self)
self.fInfoLabel.setText("")
self.fInfoText = ""

if not WINDOWS: if not WINDOWS:
self.fSyntaxLog = LogSyntaxHighlighter(self.ui.pte_log) self.fSyntaxLog = LogSyntaxHighlighter(self.ui.pte_log)
self.fSyntaxLog.setDocument(self.ui.pte_log.document()) self.fSyntaxLog.setDocument(self.ui.pte_log.document())
@@ -105,19 +101,6 @@ class CarlaMainW(QMainWindow):
self.ui.miniCanvasPreview.init(self.scene, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT, self.fSavedSettings["UseCustomMiniCanvasPaint"]) self.ui.miniCanvasPreview.init(self.scene, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT, self.fSavedSettings["UseCustomMiniCanvasPaint"])
QTimer.singleShot(100, self, SLOT("slot_miniCanvasInit()")) QTimer.singleShot(100, self, SLOT("slot_miniCanvasInit()"))


def updateInfoLabelPos(self):
tabBar = self.ui.tabMain.tabBar()
y = tabBar.mapFromParent(self.ui.centralwidget.pos()).y()+tabBar.height()/4

if not self.ui.toolBar.isVisible():
y -= self.ui.toolBar.height()

self.fInfoLabel.move(self.fInfoLabel.x(), y)

def updateInfoLabelSize(self):
tabBar = self.ui.tabMain.tabBar()
self.fInfoLabel.resize(self.ui.tabMain.width()-tabBar.width()-20, self.fInfoLabel.height())

@pyqtSlot() @pyqtSlot()
def slot_fileExportLv2Preset(self): def slot_fileExportLv2Preset(self):
fileFilter = self.tr("LV2 Preset (*.lv2)") fileFilter = self.tr("LV2 Preset (*.lv2)")
@@ -170,14 +153,6 @@ class CarlaMainW(QMainWindow):
""" % (manifestPath, os.path.basename(filenameTry), presetContents)) """ % (manifestPath, os.path.basename(filenameTry), presetContents))
manifestFd.close() manifestFd.close()


@pyqtSlot()
def slot_toolbarShown(self):
self.updateInfoLabelPos()

@pyqtSlot()
def slot_splitterMoved(self):
self.updateInfoLabelSize()

@pyqtSlot(float, float) @pyqtSlot(float, float)
def slot_miniCanvasMoved(self, xp, yp): def slot_miniCanvasMoved(self, xp, yp):
self.ui.graphicsView.horizontalScrollBar().setValue(xp * DEFAULT_CANVAS_WIDTH) self.ui.graphicsView.horizontalScrollBar().setValue(xp * DEFAULT_CANVAS_WIDTH)
@@ -215,12 +190,6 @@ class CarlaMainW(QMainWindow):
self.ui.graphicsView.horizontalScrollBar().setValue(settings.value("HorizontalScrollBarValue", DEFAULT_CANVAS_WIDTH / 3, type=int)) self.ui.graphicsView.horizontalScrollBar().setValue(settings.value("HorizontalScrollBarValue", DEFAULT_CANVAS_WIDTH / 3, type=int))
self.ui.graphicsView.verticalScrollBar().setValue(settings.value("VerticalScrollBarValue", DEFAULT_CANVAS_HEIGHT * 3 / 8, type=int)) self.ui.graphicsView.verticalScrollBar().setValue(settings.value("VerticalScrollBarValue", DEFAULT_CANVAS_HEIGHT * 3 / 8, type=int))


tabBar = self.ui.tabMain.tabBar()
x = tabBar.width()+20
y = tabBar.mapFromParent(self.ui.centralwidget.pos()).y()+tabBar.height()/4
self.fInfoLabel.move(x, y)
self.fInfoLabel.resize(self.ui.tabMain.width()-x, tabBar.height())

@pyqtSlot() @pyqtSlot()
def slot_miniCanvasCheckAll(self): def slot_miniCanvasCheckAll(self):
self.slot_miniCanvasCheckSize() self.slot_miniCanvasCheckSize()
@@ -301,6 +270,4 @@ class CarlaMainW(QMainWindow):
else: else:
QTimer.singleShot(0, self, SLOT("slot_miniCanvasCheckSize()")) QTimer.singleShot(0, self, SLOT("slot_miniCanvasCheckSize()"))


self.updateInfoLabelSize()

QMainWindow.resizeEvent(self, event) QMainWindow.resizeEvent(self, event)

+ 10
- 12
source/carla_host.py View File

@@ -83,6 +83,9 @@ class CarlaDummyW(object):
def engineStopped(self): def engineStopped(self):
pass pass


def engineChanged(self):
pass

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


def idleFast(self): def idleFast(self):
@@ -172,6 +175,7 @@ class HostWindow(QMainWindow):


self.fLastTransportFrame = 0 self.fLastTransportFrame = 0
self.fLastTransportState = False self.fLastTransportState = False
self.fTextTransport = ""


self.fSavedSettings = {} self.fSavedSettings = {}


@@ -251,8 +255,6 @@ class HostWindow(QMainWindow):
self.ui.act_help_about.triggered.connect(self.slot_aboutCarla) self.ui.act_help_about.triggered.connect(self.slot_aboutCarla)
self.ui.act_help_about_qt.triggered.connect(self.slot_aboutQt) self.ui.act_help_about_qt.triggered.connect(self.slot_aboutQt)


#self.ui.splitter.splitterMoved.connect(self.slot_splitterMoved)

self.ui.cb_disk.currentIndexChanged.connect(self.slot_diskFolderChanged) self.ui.cb_disk.currentIndexChanged.connect(self.slot_diskFolderChanged)
self.ui.b_disk_add.clicked.connect(self.slot_diskFolderAdd) self.ui.b_disk_add.clicked.connect(self.slot_diskFolderAdd)
self.ui.b_disk_remove.clicked.connect(self.slot_diskFolderRemove) self.ui.b_disk_remove.clicked.connect(self.slot_diskFolderRemove)
@@ -520,9 +522,7 @@ class HostWindow(QMainWindow):
mins = (time / 60) % 60 mins = (time / 60) % 60
hrs = (time / 3600) % 60 hrs = (time / 3600) % 60


#textTransport = "Transport %s, at %02i:%02i:%02i" % ("playing" if playing else "stopped", hrs, mins, secs)
#self.fInfoLabel.setText("%s | %s" % (self.fInfoText, textTransport))

self.fTextTransport = "Transport %s, at %02i:%02i:%02i" % ("playing" if playing else "stopped", hrs, mins, secs)
self.fLastTransportFrame = frame self.fLastTransportFrame = frame


def setTransportMenuEnabled(self, enabled): def setTransportMenuEnabled(self, enabled):
@@ -738,12 +738,11 @@ class HostWindow(QMainWindow):
self.setTransportMenuEnabled(check) self.setTransportMenuEnabled(check)


if check: if check:
#self.fInfoText = "Engine running | SampleRate: %g | BufferSize: %i" % (self.fSampleRate, self.fBufferSize)
self.fContainer.engineStarted()

if not Carla.isPlugin: if not Carla.isPlugin:
self.refreshTransport(True) self.refreshTransport(True)


self.fContainer.engineStarted()

@pyqtSlot() @pyqtSlot()
def slot_engineStop(self, doStop = True): def slot_engineStop(self, doStop = True):
if doStop: self.stopEngine() if doStop: self.stopEngine()
@@ -764,9 +763,8 @@ class HostWindow(QMainWindow):
self.setTransportMenuEnabled(check) self.setTransportMenuEnabled(check)


if not check: if not check:
self.fTextTransport = ""
self.fContainer.engineStopped() self.fContainer.engineStopped()
#self.fInfoText = ""
#self.fInfoLabel.setText("Engine stopped")


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


@@ -927,12 +925,12 @@ class HostWindow(QMainWindow):
@pyqtSlot(int) @pyqtSlot(int)
def slot_handleBufferSizeChangedCallback(self, newBufferSize): def slot_handleBufferSizeChangedCallback(self, newBufferSize):
self.fBufferSize = newBufferSize self.fBufferSize = newBufferSize
#self.fInfoText = "Engine running | SampleRate: %g | BufferSize: %i" % (self.fSampleRate, self.fBufferSize)
self.fContainer.engineChanged()


@pyqtSlot(float) @pyqtSlot(float)
def slot_handleSampleRateChangedCallback(self, newSampleRate): def slot_handleSampleRateChangedCallback(self, newSampleRate):
self.fSampleRate = newSampleRate self.fSampleRate = newSampleRate
#self.fInfoText = "Engine running | SampleRate: %g | BufferSize: %i" % (self.fSampleRate, self.fBufferSize)
self.fContainer.engineChanged()


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




+ 3
- 0
source/carla_patchbay.py View File

@@ -218,6 +218,9 @@ class CarlaPatchbayW(QGraphicsView):
def engineStopped(self): def engineStopped(self):
patchcanvas.clear() patchcanvas.clear()


def engineChanged(self):
pass

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


def idleFast(self): def idleFast(self):


+ 3
- 0
source/carla_rack.py View File

@@ -198,6 +198,9 @@ class CarlaRackW(QListWidget):
def engineStopped(self): def engineStopped(self):
pass pass


def engineChanged(self):
pass

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


def idleFast(self): def idleFast(self):


Loading…
Cancel
Save