Browse Source

Cleanup

tags/1.9.4
falkTX 10 years ago
parent
commit
6c29444ab0
3 changed files with 9 additions and 239 deletions
  1. +4
    -2
      source/carla_host.py
  2. +5
    -4
      source/carla_widgets.py
  3. +0
    -233
      source/modules/native-plugins/resources/carla-ui

+ 4
- 2
source/carla_host.py View File

@@ -459,10 +459,12 @@ class HostWindow(QMainWindow):
# apply to engine

Carla.host.set_engine_option(ENGINE_OPTION_FORCE_STEREO, forceStereo, "")
Carla.host.set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, preferPluginBridges, "")
Carla.host.set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, preferUiBridges, "")
Carla.host.set_engine_option(ENGINE_OPTION_UIS_ALWAYS_ON_TOP, uisAlwaysOnTop, "")

if not Carla.isPlugin:
Carla.host.set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, preferPluginBridges, "")
Carla.host.set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, preferUiBridges, "")

Carla.host.set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, maxParameters, "")
Carla.host.set_engine_option(ENGINE_OPTION_UI_BRIDGES_TIMEOUT, uiBridgesTimeout, "")



+ 5
- 4
source/carla_widgets.py View File

@@ -142,7 +142,7 @@ class CarlaAboutW(QDialog):

self.ui.l_ladspa.setText(self.tr("Everything! (Including LRDF)"))
self.ui.l_dssi.setText(self.tr("Everything! (Including CustomData/Chunks)"))
self.ui.l_lv2.setText(self.tr("About 80&#37; complete (using custom extensions)<br/>"
self.ui.l_lv2.setText(self.tr("About 95&#37; complete (using custom extensions)<br/>"
"Implemented Feature/Extensions:"
"<ul>"
"<li>http://lv2plug.in/ns/ext/atom</li>"
@@ -158,16 +158,17 @@ class CarlaAboutW(QDialog):
"<li>http://lv2plug.in/ns/ext/parameters</li>"
#"<li>http://lv2plug.in/ns/ext/patch</li>"
#"<li>http://lv2plug.in/ns/ext/port-groups</li>"
#"<li>http://lv2plug.in/ns/ext/port-props</li>"
"<li>http://lv2plug.in/ns/ext/port-props</li>"
"<li>http://lv2plug.in/ns/ext/presets</li>"
#"<li>http://lv2plug.in/ns/ext/resize-port</li>"
"<li>http://lv2plug.in/ns/ext/resize-port</li>"
"<li>http://lv2plug.in/ns/ext/state</li>"
"<li>http://lv2plug.in/ns/ext/time</li>"
"<li>http://lv2plug.in/ns/ext/uri-map</li>"
"<li>http://lv2plug.in/ns/ext/urid</li>"
#"<li>http://lv2plug.in/ns/ext/worker</li>"
"<li>http://lv2plug.in/ns/ext/worker</li>"
"<li>http://lv2plug.in/ns/extensions/ui</li>"
"<li>http://lv2plug.in/ns/extensions/units</li>"
"<li>http://home.gna.org/lv2dynparam/rtmempool/v1</li>"
"<li>http://kxstudio.sf.net/ns/lv2ext/external-ui</li>"
"<li>http://kxstudio.sf.net/ns/lv2ext/programs</li>"
"<li>http://kxstudio.sf.net/ns/lv2ext/rtmempool</li>"


+ 0
- 233
source/modules/native-plugins/resources/carla-ui View File

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

# DISTRHO Notes Plugin
# Copyright (C) 2012-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)

from numpy import rint
from sys import argv, exit

try:
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QApplication, QGridLayout, QLabel, QPushButton, QTextEdit, QWidget
except:
from PyQt4.QtCore import pyqtSlot
from PyQt4.QtGui import QApplication, QGridLayout, QLabel, QPushButton, QTextEdit, QWidget

# -----------------------------------------------------------------------
# Imports (ExternalUI)

from externalui import ExternalUI
from paramspinbox import ParamSpinBox

# -----------------------------------------------------------------------
# External UI

class DistrhoUINotes(QWidget, ExternalUI):
def __init__(self):
QWidget.__init__(self, None)
ExternalUI.__init__(self)

self.fCurPage = 1
self.fSaveSizeNowChecker = -1
self.fSaveTextNowChecker = -1
self.fNotes = ["" for x in range(100)]

self.fTextEdit = QTextEdit(self)
self.fButton = QPushButton(self)
self.fProgressBar = ParamSpinBox(self)
self.fSpacer = QLabel(self)
self.fGridLayout = QGridLayout(self)

self.fButton.setCheckable(True)
self.fButton.setChecked(True)
self.fButton.setText("Edit")
self.fButton.setFixedSize(self.fButton.minimumSizeHint())

self.fProgressBar.setMinimum(1.0)
self.fProgressBar.setMaximum(100.0)
self.fProgressBar.setValue(1.0)
self.fProgressBar.setStep(1.0)
self.fProgressBar.setStepSmall(1.0)
self.fProgressBar.setStepLarge(10.0)

self.fSpacer.setText("")
self.fSpacer.setFixedSize(5, 5)

self.fTextEdit.setReadOnly(False)

self.setLayout(self.fGridLayout)
self.fGridLayout.addWidget(self.fTextEdit, 0, 0, 1, 3)
self.fGridLayout.addWidget(self.fButton, 1, 0, 1, 1)
self.fGridLayout.addWidget(self.fProgressBar, 1, 1, 1, 1)
self.fGridLayout.addWidget(self.fSpacer, 1, 2, 1, 1)
self.fGridLayout.setContentsMargins(0, 0, 0, 0)

self.resize(300, 200)
self.setWindowTitle(self.fUiName)

self.fButton.clicked.connect(self.slot_buttonClicked)
self.fProgressBar.valueChanged.connect(self.slot_progressBarValueChanged)
self.fTextEdit.textChanged.connect(self.slot_textChanged)

self.fIdleTimer = self.startTimer(50)

def saveCurrentTextState(self):
pageKey = "pageText %i" % self.fCurPage
pageValue = self.fTextEdit.toPlainText()

if pageValue != self.fNotes[self.fCurPage-1]:
self.fNotes[self.fCurPage-1] = pageValue
self.d_setState(pageKey, pageValue)

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

@pyqtSlot(bool)
def slot_buttonClicked(self, click):
readOnly = not click
self.fTextEdit.setReadOnly(readOnly)
self.d_setState("readOnly", "yes" if readOnly else "no")

@pyqtSlot(float)
def slot_progressBarValueChanged(self, value):
value = rint(value)

if self.fCurPage == int(value):
return

# maybe save current text before changing page
if self.fSaveTextNowChecker >= 0 and value >= 1.0 and value <= 100.0:
self.saveCurrentTextState()
self.fSaveTextNowChecker = -1

# change current page
self.d_parameterChanged(0, value)

# tell host about this change
self.d_setParameterValue(0, value)

@pyqtSlot()
def slot_textChanged(self):
self.fSaveTextNowChecker = 0

# -------------------------------------------------------------------
# DSP Callbacks

def d_parameterChanged(self, index, value):
if index != 0:
return

nextCurPage = int(value)

if nextCurPage != self.fCurPage and nextCurPage >= 1 and nextCurPage <= 100:
self.saveCurrentTextState()
self.fCurPage = nextCurPage

self.fTextEdit.setPlainText(self.fNotes[self.fCurPage-1])
self.fProgressBar.setValue(self.fCurPage)
self.fProgressBar.update()

def d_stateChanged(self, key, value):
if key == "guiWidth":
try:
width = int(value)
except:
width = 0

if width > 0:
self.resize(width, self.height())

elif key == "guiHeight":
try:
height = int(value)
except:
height = 0

if height > 0:
self.resize(self.width(), height)

elif key.startswith("pageText #"):
try:
pageIndex = int(key.replace("pageText #",""))
except:
pageIndex = 0

if pageIndex >= 1 and pageIndex <= 100:
self.fNotes[pageIndex-1] = value

if pageIndex == self.fCurPage:
self.fTextEdit.setPlainText(self.fNotes[pageIndex-1])

elif key == "readOnly":
readOnly = (value == "yes")
self.fButton.setChecked(not readOnly)
self.fTextEdit.setReadOnly(readOnly)

# -------------------------------------------------------------------
# ExternalUI Callbacks

def d_uiShow(self):
self.show()

def d_uiHide(self):
self.hide()

def d_uiQuit(self):
self.close()
app.quit()

def d_uiTitleChanged(self, uiTitle):
self.setWindowTitle(uiTitle)

# -------------------------------------------------------------------
# Qt events

def resizeEvent(self, event):
self.fSaveSizeNowChecker = 0
QWidget.resizeEvent(self, event)

def timerEvent(self, event):
if event.timerId() == self.fIdleTimer:
if self.fSaveSizeNowChecker == 11:
self.d_setState("guiWidth", str(self.width()))
self.d_setState("guiHeight", str(self.height()))
self.fSaveSizeNowChecker = -1
elif self.fSaveSizeNowChecker >= 0:
self.fSaveSizeNowChecker += 1

if self.fSaveTextNowChecker == 11:
self.saveCurrentTextState()
self.fSaveTextNowChecker = -1
elif self.fSaveTextNowChecker >= 0:
self.fSaveTextNowChecker += 1

if not self.idleExternalUI():
self.d_uiQuit()

QWidget.timerEvent(self, event)

def closeEvent(self, event):
self.closeExternalUI()
QWidget.closeEvent(self, event)

#--------------- main ------------------
if __name__ == '__main__':
app = QApplication(argv)
#app...
gui = DistrhoUINotes()
exit(app.exec_())

Loading…
Cancel
Save