Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

carla_widgets.py 62KB

11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
11 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla widgets code
  4. # Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com>
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License as
  8. # published by the Free Software Foundation; either version 2 of
  9. # the License, or any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # For a full copy of the GNU General Public License see the doc/GPL.txt file.
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Config)
  19. from carla_config import *
  20. # ------------------------------------------------------------------------------------------------------------
  21. # Imports (Global)
  22. if config_UseQt5:
  23. from PyQt5.QtCore import pyqtSignal, pyqtSlot, pyqtWrapperType, Qt, QByteArray, QSettings, QTimer
  24. from PyQt5.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath
  25. from PyQt5.QtWidgets import QDialog, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget
  26. else:
  27. from PyQt4.QtCore import pyqtSignal, pyqtSlot, pyqtWrapperType, Qt, QByteArray, QSettings, QTimer
  28. from PyQt4.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath
  29. from PyQt4.QtGui import QDialog, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget
  30. # ------------------------------------------------------------------------------------------------------------
  31. # Imports (Custom)
  32. import ui_carla_about
  33. import ui_carla_about_juce
  34. import ui_carla_edit
  35. import ui_carla_parameter
  36. from carla_shared import *
  37. from carla_utils import *
  38. from pixmapkeyboard import PixmapKeyboardHArea
  39. # ------------------------------------------------------------------------------------------------------------
  40. # Carla GUI defines
  41. ICON_STATE_ON = 3 # turns on, sets as wait1
  42. ICON_STATE_WAIT1 = 2 # sets as wait2
  43. ICON_STATE_WAIT2 = 1 # turns off, sets as off
  44. ICON_STATE_OFF = 0 # do nothing
  45. # ------------------------------------------------------------------------------------------------------------
  46. # Carla About dialog
  47. class CarlaAboutW(QDialog):
  48. def __init__(self, parent, host):
  49. QDialog.__init__(self, parent)
  50. self.ui = ui_carla_about.Ui_CarlaAboutW()
  51. self.ui.setupUi(self)
  52. if False:
  53. # kdevelop likes this :)
  54. host = CarlaHostMeta()
  55. if host.isControl:
  56. extraInfo = " - <b>%s</b>" % self.tr("OSC Bridge Version")
  57. elif host.isPlugin:
  58. extraInfo = " - <b>%s</b>" % self.tr("Plugin Version")
  59. else:
  60. extraInfo = ""
  61. self.ui.l_about.setText(self.tr(""
  62. "<br>Version %s"
  63. "<br>Carla is a fully-featured audio plugin host%s.<br>"
  64. "<br>Copyright (C) 2011-2014 falkTX<br>"
  65. "" % (VERSION, extraInfo)))
  66. if host.isControl or host.isPlugin:
  67. self.ui.l_extended.hide()
  68. self.ui.tabWidget.removeTab(2)
  69. self.ui.tabWidget.removeTab(1)
  70. else:
  71. self.ui.l_extended.setText(host.get_complete_license_text())
  72. if host.is_engine_running():
  73. self.ui.le_osc_url_tcp.setText(host.get_host_osc_url_tcp())
  74. self.ui.le_osc_url_udp.setText(host.get_host_osc_url_udp())
  75. else:
  76. self.ui.le_osc_url_tcp.setText(self.tr("(Engine not running)"))
  77. self.ui.le_osc_url_udp.setText(self.tr("(Engine not running)"))
  78. self.ui.l_osc_cmds.setText(""
  79. " /set_active <i-value>\n"
  80. " /set_drywet <f-value>\n"
  81. " /set_volume <f-value>\n"
  82. " /set_balance_left <f-value>\n"
  83. " /set_balance_right <f-value>\n"
  84. " /set_panning <f-value>\n"
  85. " /set_parameter_value <i-index> <f-value>\n"
  86. " /set_parameter_midi_cc <i-index> <i-cc>\n"
  87. " /set_parameter_midi_channel <i-index> <i-channel>\n"
  88. " /set_program <i-index>\n"
  89. " /set_midi_program <i-index>\n"
  90. " /note_on <i-note> <i-velo>\n"
  91. " /note_off <i-note>\n"
  92. )
  93. self.ui.l_example.setText("/Carla/2/set_parameter_value 5 1.0")
  94. self.ui.l_example_help.setText("<i>(as in this example, \"2\" is the plugin number and \"5\" the parameter)</i>")
  95. self.ui.l_ladspa.setText(self.tr("Everything! (Including LRDF)"))
  96. self.ui.l_dssi.setText(self.tr("Everything! (Including CustomData/Chunks)"))
  97. self.ui.l_lv2.setText(self.tr("About 95&#37; complete (using custom extensions)<br/>"
  98. "Implemented Feature/Extensions:"
  99. "<ul>"
  100. "<li>http://lv2plug.in/ns/ext/atom</li>"
  101. "<li>http://lv2plug.in/ns/ext/buf-size</li>"
  102. "<li>http://lv2plug.in/ns/ext/data-access</li>"
  103. #"<li>http://lv2plug.in/ns/ext/dynmanifest</li>"
  104. "<li>http://lv2plug.in/ns/ext/event</li>"
  105. "<li>http://lv2plug.in/ns/ext/instance-access</li>"
  106. "<li>http://lv2plug.in/ns/ext/log</li>"
  107. "<li>http://lv2plug.in/ns/ext/midi</li>"
  108. #"<li>http://lv2plug.in/ns/ext/morph</li>"
  109. "<li>http://lv2plug.in/ns/ext/options</li>"
  110. "<li>http://lv2plug.in/ns/ext/parameters</li>"
  111. #"<li>http://lv2plug.in/ns/ext/patch</li>"
  112. #"<li>http://lv2plug.in/ns/ext/port-groups</li>"
  113. "<li>http://lv2plug.in/ns/ext/port-props</li>"
  114. "<li>http://lv2plug.in/ns/ext/presets</li>"
  115. "<li>http://lv2plug.in/ns/ext/resize-port</li>"
  116. "<li>http://lv2plug.in/ns/ext/state</li>"
  117. "<li>http://lv2plug.in/ns/ext/time</li>"
  118. "<li>http://lv2plug.in/ns/ext/uri-map</li>"
  119. "<li>http://lv2plug.in/ns/ext/urid</li>"
  120. "<li>http://lv2plug.in/ns/ext/worker</li>"
  121. "<li>http://lv2plug.in/ns/extensions/ui</li>"
  122. "<li>http://lv2plug.in/ns/extensions/units</li>"
  123. "<li>http://home.gna.org/lv2dynparam/rtmempool/v1</li>"
  124. "<li>http://kxstudio.sf.net/ns/lv2ext/external-ui</li>"
  125. "<li>http://kxstudio.sf.net/ns/lv2ext/programs</li>"
  126. "<li>http://kxstudio.sf.net/ns/lv2ext/props</li>"
  127. "<li>http://kxstudio.sf.net/ns/lv2ext/rtmempool</li>"
  128. "<li>http://ll-plugins.nongnu.org/lv2/ext/midimap</li>"
  129. "<li>http://ll-plugins.nongnu.org/lv2/ext/miditype</li>"
  130. "</ul>"))
  131. self.ui.l_vst.setText(self.tr("<p>About 85&#37; complete (missing vst bank/presets and some minor stuff)</p>"))
  132. self.adjustSize()
  133. self.setFixedSize(self.size())
  134. if WINDOWS:
  135. self.setWindowFlags(self.windowFlags()|Qt.MSWindowsFixedSizeDialogHint)
  136. def done(self, r):
  137. QDialog.done(self, r)
  138. self.close()
  139. # ------------------------------------------------------------------------------------------------------------
  140. # JUCE About dialog
  141. class JuceAboutW(QDialog):
  142. def __init__(self, parent, host):
  143. QDialog.__init__(self, parent)
  144. self.ui = ui_carla_about_juce.Ui_JuceAboutW()
  145. self.ui.setupUi(self)
  146. if False:
  147. # kdevelop likes this :)
  148. host = CarlaHostMeta()
  149. self.ui.l_text2.setText(self.tr("This program uses JUCE version %s." % host.get_juce_version()))
  150. self.adjustSize()
  151. self.setFixedSize(self.size())
  152. if WINDOWS:
  153. self.setWindowFlags(self.windowFlags()|Qt.MSWindowsFixedSizeDialogHint)
  154. def done(self, r):
  155. QDialog.done(self, r)
  156. self.close()
  157. # ------------------------------------------------------------------------------------------------------------
  158. # Plugin Parameter
  159. class PluginParameter(QWidget):
  160. midiControlChanged = pyqtSignal(int, int)
  161. midiChannelChanged = pyqtSignal(int, int)
  162. valueChanged = pyqtSignal(int, float)
  163. def __init__(self, parent, host, pInfo, pluginId, tabIndex):
  164. QWidget.__init__(self, parent)
  165. self.host = host
  166. self.ui = ui_carla_parameter.Ui_PluginParameter()
  167. self.ui.setupUi(self)
  168. if False:
  169. # kdevelop likes this :)
  170. host = CarlaHostMeta()
  171. self.host = host
  172. # -------------------------------------------------------------
  173. # Internal stuff
  174. self.fMidiControl = -1
  175. self.fMidiChannel = 1
  176. self.fParameterId = pInfo['index']
  177. self.fPluginId = pluginId
  178. self.fTabIndex = tabIndex
  179. # -------------------------------------------------------------
  180. # Set-up GUI
  181. pType = pInfo['type']
  182. pHints = pInfo['hints']
  183. self.ui.label.setText(pInfo['name'])
  184. self.ui.widget.setName(pInfo['name'])
  185. self.ui.widget.setMinimum(pInfo['minimum'])
  186. self.ui.widget.setMaximum(pInfo['maximum'])
  187. self.ui.widget.setDefault(pInfo['default'])
  188. self.ui.widget.setValue(pInfo['current'])
  189. self.ui.widget.setLabel(pInfo['unit'])
  190. self.ui.widget.setStep(pInfo['step'])
  191. self.ui.widget.setStepSmall(pInfo['stepSmall'])
  192. self.ui.widget.setStepLarge(pInfo['stepLarge'])
  193. self.ui.widget.setScalePoints(pInfo['scalePoints'], bool(pHints & PARAMETER_USES_SCALEPOINTS))
  194. if not pHints & PARAMETER_IS_AUTOMABLE:
  195. self.ui.sb_control.setEnabled(False)
  196. self.ui.sb_channel.setEnabled(False)
  197. if pType == PARAMETER_INPUT:
  198. if not pHints & PARAMETER_IS_ENABLED:
  199. self.ui.label.setEnabled(False)
  200. self.ui.widget.setEnabled(False)
  201. self.ui.widget.setReadOnly(True)
  202. self.ui.sb_control.setEnabled(False)
  203. self.ui.sb_channel.setEnabled(False)
  204. if pHints & PARAMETER_IS_READ_ONLY:
  205. self.ui.widget.setReadOnly(True)
  206. elif pType == PARAMETER_OUTPUT:
  207. self.ui.widget.setReadOnly(True)
  208. else:
  209. self.ui.widget.setVisible(False)
  210. self.ui.sb_control.setVisible(False)
  211. self.ui.sb_channel.setVisible(False)
  212. if pHints & PARAMETER_USES_CUSTOM_TEXT and not host.isPlugin:
  213. self.ui.widget.setTextCallback(self._textCallBack)
  214. self.ui.widget.updateAll()
  215. self.setMidiControl(pInfo['midiCC'])
  216. self.setMidiChannel(pInfo['midiChannel'])
  217. # -------------------------------------------------------------
  218. # Set-up connections
  219. self.ui.sb_control.customContextMenuRequested.connect(self.slot_controlSpinboxCustomMenu)
  220. self.ui.sb_channel.customContextMenuRequested.connect(self.slot_channelSpinboxCustomMenu)
  221. self.ui.sb_control.valueChanged.connect(self.slot_controlSpinboxChanged)
  222. self.ui.sb_channel.valueChanged.connect(self.slot_channelSpinboxChanged)
  223. self.ui.widget.valueChanged.connect(self.slot_widgetValueChanged)
  224. # -------------------------------------------------------------
  225. def getPluginId(self):
  226. return self.fPluginId
  227. def getTabIndex(self):
  228. return self.fTabIndex
  229. def setPluginId(self, pluginId):
  230. self.fPluginId = pluginId
  231. def setDefault(self, value):
  232. self.ui.widget.setDefault(value)
  233. def setValue(self, value):
  234. self.ui.widget.blockSignals(True)
  235. self.ui.widget.setValue(value)
  236. self.ui.widget.blockSignals(False)
  237. def setMidiControl(self, control):
  238. self.fMidiControl = control
  239. self.ui.sb_control.blockSignals(True)
  240. self.ui.sb_control.setValue(control)
  241. self.ui.sb_control.blockSignals(False)
  242. def setMidiChannel(self, channel):
  243. self.fMidiChannel = channel
  244. self.ui.sb_channel.blockSignals(True)
  245. self.ui.sb_channel.setValue(channel)
  246. self.ui.sb_channel.blockSignals(False)
  247. def setLabelWidth(self, width):
  248. self.ui.label.setFixedWidth(width)
  249. @pyqtSlot()
  250. def slot_controlSpinboxCustomMenu(self):
  251. menu = QMenu(self)
  252. actNone = menu.addAction(self.tr("None"))
  253. if self.fMidiControl == -1:
  254. actNone.setCheckable(True)
  255. actNone.setChecked(True)
  256. for cc in MIDI_CC_LIST:
  257. action = menu.addAction(cc)
  258. if self.fMidiControl != -1 and int(cc.split(" ", 1)[0], 16) == self.fMidiControl:
  259. action.setCheckable(True)
  260. action.setChecked(True)
  261. actSel = menu.exec_(QCursor.pos())
  262. if not actSel:
  263. pass
  264. elif actSel == actNone:
  265. self.ui.sb_control.setValue(-1)
  266. else:
  267. selControlStr = actSel.text()
  268. selControl = int(selControlStr.split(" ", 1)[0], 16)
  269. self.ui.sb_control.setValue(selControl)
  270. @pyqtSlot()
  271. def slot_channelSpinboxCustomMenu(self):
  272. menu = QMenu(self)
  273. for i in range(1, 16+1):
  274. action = menu.addAction("%i" % i)
  275. if self.fMidiChannel == i:
  276. action.setCheckable(True)
  277. action.setChecked(True)
  278. actSel = menu.exec_(QCursor.pos())
  279. if actSel:
  280. selChannel = int(actSel.text())
  281. self.ui.sb_channel.setValue(selChannel)
  282. @pyqtSlot(int)
  283. def slot_controlSpinboxChanged(self, control):
  284. self.fMidiControl = control
  285. self.midiControlChanged.emit(self.fParameterId, control)
  286. @pyqtSlot(int)
  287. def slot_channelSpinboxChanged(self, channel):
  288. self.fMidiChannel = channel
  289. self.midiChannelChanged.emit(self.fParameterId, channel)
  290. @pyqtSlot(float)
  291. def slot_widgetValueChanged(self, value):
  292. self.valueChanged.emit(self.fParameterId, value)
  293. def _textCallBack(self):
  294. return self.host.get_parameter_text(self.fPluginId, self.fParameterId)
  295. # ------------------------------------------------------------------------------------------------------------
  296. # Plugin Editor Parent (Meta class)
  297. class PluginEditParentMeta():
  298. #class PluginEditParentMeta(metaclass=ABCMeta):
  299. @abstractmethod
  300. def editDialogVisibilityChanged(self, pluginId, visible):
  301. raise NotImplementedError
  302. @abstractmethod
  303. def editDialogPluginHintsChanged(self, pluginId, hints):
  304. raise NotImplementedError
  305. @abstractmethod
  306. def editDialogParameterValueChanged(self, pluginId, parameterId, value):
  307. raise NotImplementedError
  308. @abstractmethod
  309. def editDialogProgramChanged(self, pluginId, index):
  310. raise NotImplementedError
  311. @abstractmethod
  312. def editDialogMidiProgramChanged(self, pluginId, index):
  313. raise NotImplementedError
  314. @abstractmethod
  315. def editDialogNotePressed(self, pluginId, note):
  316. raise NotImplementedError
  317. @abstractmethod
  318. def editDialogNoteReleased(self, pluginId, note):
  319. raise NotImplementedError
  320. @abstractmethod
  321. def editDialogMidiActivityChanged(self, pluginId, onOff):
  322. raise NotImplementedError
  323. # ------------------------------------------------------------------------------------------------------------
  324. # Plugin Editor (Built-in)
  325. class PluginEdit(QDialog):
  326. kParamsPerPage = 8
  327. def __init__(self, parent, host, pluginId):
  328. QDialog.__init__(self, parent.window() if parent is not None else None)
  329. self.host = host
  330. self.ui = ui_carla_edit.Ui_PluginEdit()
  331. self.ui.setupUi(self)
  332. if False:
  333. # kdevelop likes this :)
  334. parent = PluginEditParentMeta()
  335. host = CarlaHostMeta()
  336. self.host = host
  337. # -------------------------------------------------------------
  338. # Internal stuff
  339. self.fGeometry = QByteArray()
  340. self.fParent = parent
  341. self.fPluginId = pluginId
  342. self.fPluginInfo = None
  343. self.fCurrentStateFilename = None
  344. self.fControlChannel = int(host.get_internal_parameter_value(pluginId, PARAMETER_CTRL_CHANNEL))
  345. self.fFirstInit = True
  346. self.fParameterList = [] # (type, id, widget)
  347. self.fParametersToUpdate = [] # (id, value)
  348. self.fPlayingNotes = [] # (channel, note)
  349. self.fTabIconOff = QIcon(":/bitmaps/led_off.png")
  350. self.fTabIconOn = QIcon(":/bitmaps/led_yellow.png")
  351. self.fTabIconTimers = []
  352. # used during testing
  353. self.fIdleTimerId = 0
  354. # -------------------------------------------------------------
  355. # Set-up GUI
  356. self.ui.dial_drywet.setCustomPaintMode(self.ui.dial_drywet.CUSTOM_PAINT_MODE_CARLA_WET)
  357. self.ui.dial_drywet.setPixmap(3)
  358. self.ui.dial_drywet.setLabel("Dry/Wet")
  359. self.ui.dial_drywet.setMinimum(0.0)
  360. self.ui.dial_drywet.setMaximum(1.0)
  361. self.ui.dial_drywet.setValue(host.get_internal_parameter_value(pluginId, PARAMETER_DRYWET))
  362. self.ui.dial_vol.setCustomPaintMode(self.ui.dial_vol.CUSTOM_PAINT_MODE_CARLA_VOL)
  363. self.ui.dial_vol.setPixmap(3)
  364. self.ui.dial_vol.setLabel("Volume")
  365. self.ui.dial_vol.setMinimum(0.0)
  366. self.ui.dial_vol.setMaximum(1.27)
  367. self.ui.dial_vol.setValue(host.get_internal_parameter_value(pluginId, PARAMETER_VOLUME))
  368. self.ui.dial_b_left.setCustomPaintMode(self.ui.dial_b_left.CUSTOM_PAINT_MODE_CARLA_L)
  369. self.ui.dial_b_left.setPixmap(4)
  370. self.ui.dial_b_left.setLabel("L")
  371. self.ui.dial_b_left.setMinimum(-1.0)
  372. self.ui.dial_b_left.setMaximum(1.0)
  373. self.ui.dial_b_left.setValue(host.get_internal_parameter_value(pluginId, PARAMETER_BALANCE_LEFT))
  374. self.ui.dial_b_right.setCustomPaintMode(self.ui.dial_b_right.CUSTOM_PAINT_MODE_CARLA_R)
  375. self.ui.dial_b_right.setPixmap(4)
  376. self.ui.dial_b_right.setLabel("R")
  377. self.ui.dial_b_right.setMinimum(-1.0)
  378. self.ui.dial_b_right.setMaximum(1.0)
  379. self.ui.dial_b_right.setValue(host.get_internal_parameter_value(pluginId, PARAMETER_BALANCE_RIGHT))
  380. self.ui.dial_pan.setCustomPaintMode(self.ui.dial_b_right.CUSTOM_PAINT_MODE_CARLA_PAN)
  381. self.ui.dial_pan.setPixmap(4)
  382. self.ui.dial_pan.setLabel("Pan")
  383. self.ui.dial_pan.setMinimum(-1.0)
  384. self.ui.dial_pan.setMaximum(1.0)
  385. self.ui.dial_pan.setValue(host.get_internal_parameter_value(pluginId, PARAMETER_PANNING))
  386. self.ui.sb_ctrl_channel.setValue(self.fControlChannel+1)
  387. self.ui.scrollArea = PixmapKeyboardHArea(self)
  388. self.ui.keyboard = self.ui.scrollArea.keyboard
  389. self.ui.keyboard.setEnabled(self.fControlChannel >= 0)
  390. self.layout().addWidget(self.ui.scrollArea)
  391. self.ui.scrollArea.setEnabled(False)
  392. self.ui.scrollArea.setVisible(False)
  393. # todo
  394. self.ui.rb_balance.setEnabled(False)
  395. self.ui.rb_pan.setEnabled(False)
  396. self.reloadAll()
  397. self.fFirstInit = False
  398. # -------------------------------------------------------------
  399. # Set-up connections
  400. self.finished.connect(self.slot_finished)
  401. self.ui.ch_fixed_buffer.clicked.connect(self.slot_optionChanged)
  402. self.ui.ch_force_stereo.clicked.connect(self.slot_optionChanged)
  403. self.ui.ch_map_program_changes.clicked.connect(self.slot_optionChanged)
  404. self.ui.ch_use_chunks.clicked.connect(self.slot_optionChanged)
  405. self.ui.ch_send_program_changes.clicked.connect(self.slot_optionChanged)
  406. self.ui.ch_send_control_changes.clicked.connect(self.slot_optionChanged)
  407. self.ui.ch_send_channel_pressure.clicked.connect(self.slot_optionChanged)
  408. self.ui.ch_send_note_aftertouch.clicked.connect(self.slot_optionChanged)
  409. self.ui.ch_send_pitchbend.clicked.connect(self.slot_optionChanged)
  410. self.ui.ch_send_all_sound_off.clicked.connect(self.slot_optionChanged)
  411. self.ui.dial_drywet.realValueChanged.connect(self.slot_dryWetChanged)
  412. self.ui.dial_vol.realValueChanged.connect(self.slot_volumeChanged)
  413. self.ui.dial_b_left.realValueChanged.connect(self.slot_balanceLeftChanged)
  414. self.ui.dial_b_right.realValueChanged.connect(self.slot_balanceRightChanged)
  415. self.ui.dial_pan.realValueChanged.connect(self.slot_panChanged)
  416. self.ui.sb_ctrl_channel.valueChanged.connect(self.slot_ctrlChannelChanged)
  417. self.ui.dial_drywet.customContextMenuRequested.connect(self.slot_knobCustomMenu)
  418. self.ui.dial_vol.customContextMenuRequested.connect(self.slot_knobCustomMenu)
  419. self.ui.dial_b_left.customContextMenuRequested.connect(self.slot_knobCustomMenu)
  420. self.ui.dial_b_right.customContextMenuRequested.connect(self.slot_knobCustomMenu)
  421. self.ui.dial_pan.customContextMenuRequested.connect(self.slot_knobCustomMenu)
  422. self.ui.sb_ctrl_channel.customContextMenuRequested.connect(self.slot_channelCustomMenu)
  423. self.ui.keyboard.noteOn.connect(self.slot_noteOn)
  424. self.ui.keyboard.noteOff.connect(self.slot_noteOff)
  425. self.ui.cb_programs.currentIndexChanged.connect(self.slot_programIndexChanged)
  426. self.ui.cb_midi_programs.currentIndexChanged.connect(self.slot_midiProgramIndexChanged)
  427. self.ui.b_save_state.clicked.connect(self.slot_stateSave)
  428. self.ui.b_load_state.clicked.connect(self.slot_stateLoad)
  429. #host.ProgramChangedCallback.connect(self.slot_handleProgramChangedCallback)
  430. #host.MidiProgramChangedCallback.connect(self.slot_handleMidiProgramChangedCallback)
  431. host.NoteOnCallback.connect(self.slot_handleNoteOnCallback)
  432. host.NoteOffCallback.connect(self.slot_handleNoteOffCallback)
  433. host.UpdateCallback.connect(self.slot_handleUpdateCallback)
  434. host.ReloadInfoCallback.connect(self.slot_handleReloadInfoCallback)
  435. host.ReloadParametersCallback.connect(self.slot_handleReloadParametersCallback)
  436. host.ReloadProgramsCallback.connect(self.slot_handleReloadProgramsCallback)
  437. host.ReloadAllCallback.connect(self.slot_handleReloadAllCallback)
  438. #------------------------------------------------------------------
  439. @pyqtSlot(int, int, int, int)
  440. def slot_handleNoteOnCallback(self, pluginId, channel, note, velocity):
  441. if self.fPluginId != pluginId: return
  442. if self.fControlChannel == channel:
  443. self.ui.keyboard.sendNoteOn(note, False)
  444. playItem = (channel, note)
  445. if playItem not in self.fPlayingNotes:
  446. self.fPlayingNotes.append(playItem)
  447. if len(self.fPlayingNotes) == 1 and self.fParent is not None:
  448. self.fParent.editDialogMidiActivityChanged(self.fPluginId, True)
  449. @pyqtSlot(int, int, int)
  450. def slot_handleNoteOffCallback(self, pluginId, channel, note):
  451. if self.fPluginId != pluginId: return
  452. if self.fControlChannel == channel:
  453. self.ui.keyboard.sendNoteOff(note, False)
  454. playItem = (channel, note)
  455. if playItem in self.fPlayingNotes:
  456. self.fPlayingNotes.remove(playItem)
  457. if len(self.fPlayingNotes) == 0 and self.fParent is not None:
  458. self.fParent.editDialogMidiActivityChanged(self.fPluginId, False)
  459. @pyqtSlot(int)
  460. def slot_handleUpdateCallback(self, pluginId):
  461. if self.fPluginId == pluginId:
  462. self.updateInfo()
  463. @pyqtSlot(int)
  464. def slot_handleReloadInfoCallback(self, pluginId):
  465. if self.fPluginId == pluginId:
  466. self.reloadInfo()
  467. @pyqtSlot(int)
  468. def slot_handleReloadParametersCallback(self, pluginId):
  469. if self.fPluginId == pluginId:
  470. self.reloadParameters()
  471. @pyqtSlot(int)
  472. def slot_handleReloadProgramsCallback(self, pluginId):
  473. if self.fPluginId == pluginId:
  474. self.reloadPrograms()
  475. @pyqtSlot(int)
  476. def slot_handleReloadAllCallback(self, pluginId):
  477. if self.fPluginId == pluginId:
  478. self.reloadAll()
  479. #------------------------------------------------------------------
  480. def updateInfo(self):
  481. # Update current program text
  482. if self.ui.cb_programs.count() > 0:
  483. pIndex = self.ui.cb_programs.currentIndex()
  484. pName = self.host.get_program_name(self.fPluginId, pIndex)
  485. #pName = pName[:40] + (pName[40:] and "...")
  486. self.ui.cb_programs.setItemText(pIndex, pName)
  487. # Update current midi program text
  488. if self.ui.cb_midi_programs.count() > 0:
  489. mpIndex = self.ui.cb_midi_programs.currentIndex()
  490. mpData = self.host.get_midi_program_data(self.fPluginId, mpIndex)
  491. mpBank = mpData['bank']
  492. mpProg = mpData['program']
  493. mpName = mpData['name']
  494. #mpName = mpName[:40] + (mpName[40:] and "...")
  495. self.ui.cb_midi_programs.setItemText(mpIndex, "%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName))
  496. # Update all parameter values
  497. for paramType, paramId, paramWidget in self.fParameterList:
  498. paramWidget.blockSignals(True)
  499. paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId))
  500. paramWidget.blockSignals(False)
  501. self.fParametersToUpdate = []
  502. #------------------------------------------------------------------
  503. def reloadAll(self):
  504. self.fPluginInfo = self.host.get_plugin_info(self.fPluginId)
  505. self.reloadInfo()
  506. self.reloadParameters()
  507. self.reloadPrograms()
  508. if self.fPluginInfo['type'] == PLUGIN_LV2:
  509. self.ui.b_save_state.setEnabled(False)
  510. if not self.ui.scrollArea.isEnabled():
  511. self.resize(self.width(), self.height()-self.ui.scrollArea.height())
  512. # Workaround for a Qt4 bug, see https://bugreports.qt-project.org/browse/QTBUG-7792
  513. if LINUX: QTimer.singleShot(0, self.slot_fixNameWordWrap)
  514. @pyqtSlot()
  515. def slot_fixNameWordWrap(self):
  516. self.adjustSize()
  517. self.setMinimumSize(self.width(), self.height())
  518. #------------------------------------------------------------------
  519. def reloadInfo(self):
  520. realPluginName = self.host.get_real_plugin_name(self.fPluginId)
  521. #audioCountInfo = self.host.get_audio_port_count_info(self.fPluginId)
  522. midiCountInfo = self.host.get_midi_port_count_info(self.fPluginId)
  523. #paramCountInfo = self.host.get_parameter_count_info(self.fPluginId)
  524. pluginHints = self.fPluginInfo['hints']
  525. self.ui.le_type.setText(getPluginTypeAsString(self.fPluginInfo['type']))
  526. self.ui.label_name.setEnabled(bool(realPluginName))
  527. self.ui.le_name.setEnabled(bool(realPluginName))
  528. self.ui.le_name.setText(realPluginName)
  529. self.ui.le_name.setToolTip(realPluginName)
  530. self.ui.label_label.setEnabled(bool(self.fPluginInfo['label']))
  531. self.ui.le_label.setEnabled(bool(self.fPluginInfo['label']))
  532. self.ui.le_label.setText(self.fPluginInfo['label'])
  533. self.ui.le_label.setToolTip(self.fPluginInfo['label'])
  534. self.ui.label_maker.setEnabled(bool(self.fPluginInfo['maker']))
  535. self.ui.le_maker.setEnabled(bool(self.fPluginInfo['maker']))
  536. self.ui.le_maker.setText(self.fPluginInfo['maker'])
  537. self.ui.le_maker.setToolTip(self.fPluginInfo['maker'])
  538. self.ui.label_copyright.setEnabled(bool(self.fPluginInfo['copyright']))
  539. self.ui.le_copyright.setEnabled(bool(self.fPluginInfo['copyright']))
  540. self.ui.le_copyright.setText(self.fPluginInfo['copyright'])
  541. self.ui.le_copyright.setToolTip(self.fPluginInfo['copyright'])
  542. self.ui.label_unique_id.setEnabled(bool(self.fPluginInfo['uniqueId']))
  543. self.ui.le_unique_id.setEnabled(bool(self.fPluginInfo['uniqueId']))
  544. self.ui.le_unique_id.setText(str(self.fPluginInfo['uniqueId']))
  545. self.ui.le_unique_id.setToolTip(str(self.fPluginInfo['uniqueId']))
  546. self.ui.label_plugin.setText("\n%s\n" % self.fPluginInfo['name'])
  547. self.setWindowTitle(self.fPluginInfo['name'])
  548. self.ui.dial_drywet.setEnabled(pluginHints & PLUGIN_CAN_DRYWET)
  549. self.ui.dial_vol.setEnabled(pluginHints & PLUGIN_CAN_VOLUME)
  550. self.ui.dial_b_left.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)
  551. self.ui.dial_b_right.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)
  552. self.ui.dial_pan.setEnabled(pluginHints & PLUGIN_CAN_PANNING)
  553. self.ui.ch_use_chunks.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_USE_CHUNKS)
  554. self.ui.ch_use_chunks.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_USE_CHUNKS)
  555. self.ui.ch_fixed_buffer.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FIXED_BUFFERS)
  556. self.ui.ch_fixed_buffer.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FIXED_BUFFERS)
  557. self.ui.ch_force_stereo.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FORCE_STEREO)
  558. self.ui.ch_force_stereo.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FORCE_STEREO)
  559. self.ui.ch_map_program_changes.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_MAP_PROGRAM_CHANGES)
  560. self.ui.ch_map_program_changes.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_MAP_PROGRAM_CHANGES)
  561. self.ui.ch_send_control_changes.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_CONTROL_CHANGES)
  562. self.ui.ch_send_control_changes.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_CONTROL_CHANGES)
  563. self.ui.ch_send_channel_pressure.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_CHANNEL_PRESSURE)
  564. self.ui.ch_send_channel_pressure.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_CHANNEL_PRESSURE)
  565. self.ui.ch_send_note_aftertouch.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
  566. self.ui.ch_send_note_aftertouch.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
  567. self.ui.ch_send_pitchbend.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_PITCHBEND)
  568. self.ui.ch_send_pitchbend.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_PITCHBEND)
  569. self.ui.ch_send_all_sound_off.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
  570. self.ui.ch_send_all_sound_off.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
  571. canSendPrograms = bool((self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_PROGRAM_CHANGES) != 0 and
  572. (self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_MAP_PROGRAM_CHANGES) == 0)
  573. self.ui.ch_send_program_changes.setEnabled(canSendPrograms)
  574. self.ui.ch_send_program_changes.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_PROGRAM_CHANGES)
  575. self.ui.sw_programs.setCurrentIndex(0 if self.fPluginInfo['type'] in (PLUGIN_VST, PLUGIN_GIG, PLUGIN_SFZ) else 1)
  576. # Show/hide keyboard
  577. showKeyboard = (self.fPluginInfo['category'] == PLUGIN_CATEGORY_SYNTH or midiCountInfo['ins'] > 0 < midiCountInfo['outs'])
  578. self.ui.scrollArea.setEnabled(showKeyboard)
  579. self.ui.scrollArea.setVisible(showKeyboard)
  580. # Force-update parent for new hints
  581. if self.fParent is not None and not self.fFirstInit:
  582. self.fParent.editDialogPluginHintsChanged(self.fPluginId, pluginHints)
  583. def reloadParameters(self):
  584. # Reset
  585. self.fParameterList = []
  586. self.fParametersToUpdate = []
  587. self.fTabIconTimers = []
  588. # Remove all previous parameters
  589. for x in range(self.ui.tabWidget.count()-1):
  590. self.ui.tabWidget.widget(1).deleteLater()
  591. self.ui.tabWidget.removeTab(1)
  592. parameterCount = self.host.get_parameter_count(self.fPluginId)
  593. # -----------------------------------------------------------------
  594. if parameterCount <= 0:
  595. return
  596. # -----------------------------------------------------------------
  597. if parameterCount > self.host.maxParameters:
  598. fakeName = self.tr("This plugin has too many parameters to display here!")
  599. paramFakeListFull = []
  600. paramFakeList = []
  601. paramFakeWidth = QFontMetrics(self.font()).width(fakeName)
  602. parameter = {
  603. 'type': PARAMETER_UNKNOWN,
  604. 'hints': 0x0,
  605. 'name': fakeName,
  606. 'unit': "",
  607. 'scalePoints': [],
  608. 'index': 0,
  609. 'default': 0.0,
  610. 'minimum': 0.0,
  611. 'maximum': 1.0,
  612. 'step': 0.0,
  613. 'stepSmall': 0.0,
  614. 'stepLarge': 0.0,
  615. 'midiCC': -1,
  616. 'midiChannel': 1,
  617. 'current': 0.0
  618. }
  619. paramFakeList.append(parameter)
  620. paramFakeListFull.append((paramFakeList, paramFakeWidth))
  621. self._createParameterWidgets(PARAMETER_UNKNOWN, paramFakeListFull, self.tr("Information"))
  622. return
  623. # -----------------------------------------------------------------
  624. paramInputList = []
  625. paramOutputList = []
  626. paramInputWidth = 0
  627. paramOutputWidth = 0
  628. paramInputListFull = [] # ([params], width)
  629. paramOutputListFull = [] # ([params], width)
  630. for i in range(parameterCount):
  631. paramInfo = self.host.get_parameter_info(self.fPluginId, i)
  632. paramData = self.host.get_parameter_data(self.fPluginId, i)
  633. paramRanges = self.host.get_parameter_ranges(self.fPluginId, i)
  634. paramValue = self.host.get_current_parameter_value(self.fPluginId, i)
  635. if paramData['type'] not in (PARAMETER_INPUT, PARAMETER_OUTPUT):
  636. continue
  637. if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
  638. continue
  639. parameter = {
  640. 'type': paramData['type'],
  641. 'hints': paramData['hints'],
  642. 'name': paramInfo['name'],
  643. 'unit': paramInfo['unit'],
  644. 'scalePoints': [],
  645. 'index': paramData['index'],
  646. 'default': paramRanges['def'],
  647. 'minimum': paramRanges['min'],
  648. 'maximum': paramRanges['max'],
  649. 'step': paramRanges['step'],
  650. 'stepSmall': paramRanges['stepSmall'],
  651. 'stepLarge': paramRanges['stepLarge'],
  652. 'midiCC': paramData['midiCC'],
  653. 'midiChannel': paramData['midiChannel']+1,
  654. 'current': paramValue
  655. }
  656. for j in range(paramInfo['scalePointCount']):
  657. scalePointInfo = self.host.get_parameter_scalepoint_info(self.fPluginId, i, j)
  658. parameter['scalePoints'].append({
  659. 'value': scalePointInfo['value'],
  660. 'label': scalePointInfo['label']
  661. })
  662. #parameter['name'] = parameter['name'][:30] + (parameter['name'][30:] and "...")
  663. # -----------------------------------------------------------------
  664. # Get width values, in packs of 10
  665. if parameter['type'] == PARAMETER_INPUT:
  666. paramInputWidthTMP = QFontMetrics(self.font()).width(parameter['name'])
  667. if paramInputWidthTMP > paramInputWidth:
  668. paramInputWidth = paramInputWidthTMP
  669. paramInputList.append(parameter)
  670. if len(paramInputList) == self.kParamsPerPage:
  671. paramInputListFull.append((paramInputList, paramInputWidth))
  672. paramInputList = []
  673. paramInputWidth = 0
  674. else:
  675. paramOutputWidthTMP = QFontMetrics(self.font()).width(parameter['name'])
  676. if paramOutputWidthTMP > paramOutputWidth:
  677. paramOutputWidth = paramOutputWidthTMP
  678. paramOutputList.append(parameter)
  679. if len(paramOutputList) == self.kParamsPerPage:
  680. paramOutputListFull.append((paramOutputList, paramOutputWidth))
  681. paramOutputList = []
  682. paramOutputWidth = 0
  683. # for i in range(parameterCount)
  684. else:
  685. # Final page width values
  686. if 0 < len(paramInputList) < 10:
  687. paramInputListFull.append((paramInputList, paramInputWidth))
  688. if 0 < len(paramOutputList) < 10:
  689. paramOutputListFull.append((paramOutputList, paramOutputWidth))
  690. # Create parameter tabs + widgets
  691. self._createParameterWidgets(PARAMETER_INPUT, paramInputListFull, self.tr("Parameters"))
  692. self._createParameterWidgets(PARAMETER_OUTPUT, paramOutputListFull, self.tr("Outputs"))
  693. def reloadPrograms(self):
  694. # Programs
  695. self.ui.cb_programs.blockSignals(True)
  696. self.ui.cb_programs.clear()
  697. programCount = self.host.get_program_count(self.fPluginId)
  698. if programCount > 0:
  699. self.ui.cb_programs.setEnabled(True)
  700. self.ui.label_programs.setEnabled(True)
  701. for i in range(programCount):
  702. pName = self.host.get_program_name(self.fPluginId, i)
  703. #pName = pName[:40] + (pName[40:] and "...")
  704. self.ui.cb_programs.addItem(pName)
  705. self.ui.cb_programs.setCurrentIndex(self.host.get_current_program_index(self.fPluginId))
  706. else:
  707. self.ui.cb_programs.setEnabled(False)
  708. self.ui.label_programs.setEnabled(False)
  709. self.ui.cb_programs.blockSignals(False)
  710. # MIDI Programs
  711. self.ui.cb_midi_programs.blockSignals(True)
  712. self.ui.cb_midi_programs.clear()
  713. midiProgramCount = self.host.get_midi_program_count(self.fPluginId)
  714. if midiProgramCount > 0:
  715. self.ui.cb_midi_programs.setEnabled(True)
  716. self.ui.label_midi_programs.setEnabled(True)
  717. for i in range(midiProgramCount):
  718. mpData = self.host.get_midi_program_data(self.fPluginId, i)
  719. mpBank = mpData['bank']
  720. mpProg = mpData['program']
  721. mpName = mpData['name']
  722. #mpName = mpName[:40] + (mpName[40:] and "...")
  723. self.ui.cb_midi_programs.addItem("%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName))
  724. self.ui.cb_midi_programs.setCurrentIndex(self.host.get_current_midi_program_index(self.fPluginId))
  725. else:
  726. self.ui.cb_midi_programs.setEnabled(False)
  727. self.ui.label_midi_programs.setEnabled(False)
  728. self.ui.cb_midi_programs.blockSignals(False)
  729. self.ui.sw_programs.setEnabled(programCount > 0 or midiProgramCount > 0)
  730. if self.fPluginInfo['type'] == PLUGIN_LV2:
  731. self.ui.b_load_state.setEnabled(programCount > 0)
  732. #------------------------------------------------------------------
  733. def clearNotes(self):
  734. self.fPlayingNotes = []
  735. self.ui.keyboard.allNotesOff()
  736. def noteOn(self, channel, note, velocity):
  737. if self.fControlChannel == channel:
  738. self.ui.keyboard.sendNoteOn(note, False)
  739. def noteOff(self, channel, note):
  740. if self.fControlChannel == channel:
  741. self.ui.keyboard.sendNoteOff(note, False)
  742. #------------------------------------------------------------------
  743. def getHints(self):
  744. return self.fPluginInfo['hints']
  745. def setPluginId(self, idx):
  746. self.fPluginId = idx
  747. def setName(self, name):
  748. self.fPluginInfo['name'] = name
  749. self.ui.label_plugin.setText("\n%s\n" % name)
  750. self.setWindowTitle(name)
  751. #------------------------------------------------------------------
  752. def setParameterValue(self, parameterId, value):
  753. for paramItem in self.fParametersToUpdate:
  754. if paramItem[0] == parameterId:
  755. paramItem[1] = value
  756. break
  757. else:
  758. self.fParametersToUpdate.append([parameterId, value])
  759. def setParameterDefault(self, parameterId, value):
  760. for paramType, paramId, paramWidget in self.fParameterList:
  761. if paramId == parameterId:
  762. paramWidget.setDefault(value)
  763. break
  764. def setParameterMidiControl(self, parameterId, control):
  765. for paramType, paramId, paramWidget in self.fParameterList:
  766. if paramId == parameterId:
  767. paramWidget.setMidiControl(control)
  768. break
  769. def setParameterMidiChannel(self, parameterId, channel):
  770. for paramType, paramId, paramWidget in self.fParameterList:
  771. if paramId == parameterId:
  772. paramWidget.setMidiChannel(channel+1)
  773. break
  774. def setProgram(self, index):
  775. self.ui.cb_programs.blockSignals(True)
  776. self.ui.cb_programs.setCurrentIndex(index)
  777. self.ui.cb_programs.blockSignals(False)
  778. self._updateParameterValues()
  779. def setMidiProgram(self, index):
  780. self.ui.cb_midi_programs.blockSignals(True)
  781. self.ui.cb_midi_programs.setCurrentIndex(index)
  782. self.ui.cb_midi_programs.blockSignals(False)
  783. self._updateParameterValues()
  784. def setOption(self, option, yesNo):
  785. if option == PLUGIN_OPTION_USE_CHUNKS:
  786. widget = self.ui.ch_use_chunks
  787. elif option == PLUGIN_OPTION_FIXED_BUFFERS:
  788. widget = self.ui.ch_fixed_buffer
  789. elif option == PLUGIN_OPTION_FORCE_STEREO:
  790. widget = self.ui.ch_force_stereo
  791. elif option == PLUGIN_OPTION_MAP_PROGRAM_CHANGES:
  792. widget = self.ui.ch_map_program_changes
  793. elif option == PLUGIN_OPTION_SEND_PROGRAM_CHANGES:
  794. widget = self.ui.ch_send_program_changes
  795. elif option == PLUGIN_OPTION_SEND_CONTROL_CHANGES:
  796. widget = self.ui.ch_send_control_changes
  797. elif option == PLUGIN_OPTION_SEND_CHANNEL_PRESSURE:
  798. widget = self.ui.ch_send_channel_pressure
  799. elif option == PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH:
  800. widget = self.ui.ch_send_note_aftertouch
  801. elif option == PLUGIN_OPTION_SEND_PITCHBEND:
  802. widget = self.ui.ch_send_pitchbend
  803. elif option == PLUGIN_OPTION_SEND_ALL_SOUND_OFF:
  804. widget = self.ui.ch_send_all_sound_off
  805. else:
  806. return
  807. widget.blockSignals(True)
  808. widget.setChecked(yesNo)
  809. widget.blockSignals(False)
  810. #------------------------------------------------------------------
  811. def setVisible(self, yesNo):
  812. if yesNo:
  813. if not self.fGeometry.isNull():
  814. self.restoreGeometry(self.fGeometry)
  815. else:
  816. self.fGeometry = self.saveGeometry()
  817. QDialog.setVisible(self, yesNo)
  818. #------------------------------------------------------------------
  819. def idleSlow(self):
  820. # Check Tab icons
  821. for i in range(len(self.fTabIconTimers)):
  822. if self.fTabIconTimers[i] == ICON_STATE_ON:
  823. self.fTabIconTimers[i] = ICON_STATE_WAIT1
  824. elif self.fTabIconTimers[i] == ICON_STATE_WAIT1:
  825. self.fTabIconTimers[i] = ICON_STATE_WAIT2
  826. elif self.fTabIconTimers[i] == ICON_STATE_WAIT2:
  827. self.fTabIconTimers[i] = ICON_STATE_OFF
  828. self.ui.tabWidget.setTabIcon(i+1, self.fTabIconOff)
  829. # Check parameters needing update
  830. for index, value in self.fParametersToUpdate:
  831. if index == PARAMETER_DRYWET:
  832. self.ui.dial_drywet.blockSignals(True)
  833. self.ui.dial_drywet.setValue(value)
  834. self.ui.dial_drywet.blockSignals(False)
  835. elif index == PARAMETER_VOLUME:
  836. self.ui.dial_vol.blockSignals(True)
  837. self.ui.dial_vol.setValue(value)
  838. self.ui.dial_vol.blockSignals(False)
  839. elif index == PARAMETER_BALANCE_LEFT:
  840. self.ui.dial_b_left.blockSignals(True)
  841. self.ui.dial_b_left.setValue(value)
  842. self.ui.dial_b_left.blockSignals(False)
  843. elif index == PARAMETER_BALANCE_RIGHT:
  844. self.ui.dial_b_right.blockSignals(True)
  845. self.ui.dial_b_right.setValue(value)
  846. self.ui.dial_b_right.blockSignals(False)
  847. elif index == PARAMETER_PANNING:
  848. self.ui.dial_pan.blockSignals(True)
  849. self.ui.dial_pan.setValue(value)
  850. self.ui.dial_pan.blockSignals(False)
  851. elif index == PARAMETER_CTRL_CHANNEL:
  852. self.fControlChannel = int(value)
  853. self.ui.sb_ctrl_channel.blockSignals(True)
  854. self.ui.sb_ctrl_channel.setValue(self.fControlChannel+1)
  855. self.ui.sb_ctrl_channel.blockSignals(False)
  856. self.ui.keyboard.allNotesOff()
  857. self._updateCtrlPrograms()
  858. elif index >= 0:
  859. for paramType, paramId, paramWidget in self.fParameterList:
  860. if paramId != index:
  861. continue
  862. paramWidget.setValue(value)
  863. if paramType == PARAMETER_INPUT:
  864. tabIndex = paramWidget.getTabIndex()
  865. if self.fTabIconTimers[tabIndex-1] == ICON_STATE_OFF:
  866. self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOn)
  867. self.fTabIconTimers[tabIndex-1] = ICON_STATE_ON
  868. break
  869. # Clear all parameters
  870. self.fParametersToUpdate = []
  871. # Update parameter outputs
  872. #for paramType, paramId, paramWidget in self.fParameterList:
  873. #if paramType != PARAMETER_OUTPUT:
  874. #continue
  875. #paramWidget.blockSignals(True)
  876. #paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId))
  877. #paramWidget.blockSignals(False)
  878. #------------------------------------------------------------------
  879. @pyqtSlot()
  880. def slot_stateSave(self):
  881. if self.fPluginInfo['type'] == PLUGIN_LV2:
  882. # TODO
  883. return
  884. if self.fCurrentStateFilename:
  885. askTry = QMessageBox.question(self, self.tr("Overwrite?"), self.tr("Overwrite previously created file?"), QMessageBox.Ok|QMessageBox.Cancel)
  886. if askTry == QMessageBox.Ok:
  887. self.host.save_plugin_state(self.fPluginId, self.fCurrentStateFilename)
  888. return
  889. self.fCurrentStateFilename = None
  890. fileFilter = self.tr("Carla State File (*.carxs)")
  891. filename = QFileDialog.getSaveFileName(self, self.tr("Save Plugin State File"), filter=fileFilter)
  892. if config_UseQt5:
  893. filename = filename[0]
  894. if not filename:
  895. return
  896. if not filename.lower().endswith(".carxs"):
  897. filename += ".carxs"
  898. self.fCurrentStateFilename = filename
  899. self.host.save_plugin_state(self.fPluginId, self.fCurrentStateFilename)
  900. @pyqtSlot()
  901. def slot_stateLoad(self):
  902. if self.fPluginInfo['type'] == PLUGIN_LV2:
  903. presetList = []
  904. for i in range(self.host.get_program_count(self.fPluginId)):
  905. presetList.append("%03i - %s" % (i+1, self.host.get_program_name(self.fPluginId, i)))
  906. ret = QInputDialog.getItem(self, self.tr("Open LV2 Preset"), self.tr("Select an LV2 Preset:"), presetList, 0, False)
  907. if ret[1]:
  908. index = int(ret[0].split(" - ", 1)[0])-1
  909. self.host.set_midi_program(self.fPluginId, -1)
  910. self.host.set_program(self.fPluginId, index)
  911. self.setMidiProgram(-1)
  912. return
  913. fileFilter = self.tr("Carla State File (*.carxs)")
  914. filename = QFileDialog.getOpenFileName(self, self.tr("Open Plugin State File"), filter=fileFilter)
  915. if config_UseQt5:
  916. filename = filename[0]
  917. if not filename:
  918. return
  919. self.fCurrentStateFilename = filename
  920. self.host.load_plugin_state(self.fPluginId, self.fCurrentStateFilename)
  921. #------------------------------------------------------------------
  922. @pyqtSlot(bool)
  923. def slot_optionChanged(self, clicked):
  924. sender = self.sender()
  925. if sender == self.ui.ch_use_chunks:
  926. option = PLUGIN_OPTION_USE_CHUNKS
  927. elif sender == self.ui.ch_fixed_buffer:
  928. option = PLUGIN_OPTION_FIXED_BUFFERS
  929. elif sender == self.ui.ch_force_stereo:
  930. option = PLUGIN_OPTION_FORCE_STEREO
  931. elif sender == self.ui.ch_map_program_changes:
  932. option = PLUGIN_OPTION_MAP_PROGRAM_CHANGES
  933. elif sender == self.ui.ch_send_program_changes:
  934. option = PLUGIN_OPTION_SEND_PROGRAM_CHANGES
  935. elif sender == self.ui.ch_send_control_changes:
  936. option = PLUGIN_OPTION_SEND_CONTROL_CHANGES
  937. elif sender == self.ui.ch_send_channel_pressure:
  938. option = PLUGIN_OPTION_SEND_CHANNEL_PRESSURE
  939. elif sender == self.ui.ch_send_note_aftertouch:
  940. option = PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH
  941. elif sender == self.ui.ch_send_pitchbend:
  942. option = PLUGIN_OPTION_SEND_PITCHBEND
  943. elif sender == self.ui.ch_send_all_sound_off:
  944. option = PLUGIN_OPTION_SEND_ALL_SOUND_OFF
  945. else:
  946. return
  947. #--------------------------------------------------------------
  948. # handle map-program-changes and send-program-changes conflict
  949. if option == PLUGIN_OPTION_MAP_PROGRAM_CHANGES and clicked:
  950. self.ui.ch_send_program_changes.setEnabled(False)
  951. # disable send-program-changes if needed
  952. if self.ui.ch_send_program_changes.isChecked():
  953. self.host.set_option(self.fPluginId, PLUGIN_OPTION_SEND_PROGRAM_CHANGES, False)
  954. #--------------------------------------------------------------
  955. # set option
  956. self.host.set_option(self.fPluginId, option, clicked)
  957. #--------------------------------------------------------------
  958. # handle map-program-changes and send-program-changes conflict
  959. if option == PLUGIN_OPTION_MAP_PROGRAM_CHANGES and not clicked:
  960. self.ui.ch_send_program_changes.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_PROGRAM_CHANGES)
  961. # restore send-program-changes if needed
  962. if self.ui.ch_send_program_changes.isChecked():
  963. self.host.set_option(self.fPluginId, PLUGIN_OPTION_SEND_PROGRAM_CHANGES, True)
  964. #------------------------------------------------------------------
  965. @pyqtSlot(int)
  966. def slot_dryWetChanged(self, value):
  967. self.host.set_drywet(self.fPluginId, value)
  968. if self.fParent is not None:
  969. self.fParent.editDialogParameterValueChanged(self.fPluginId, PARAMETER_DRYWET, value)
  970. @pyqtSlot(int)
  971. def slot_volumeChanged(self, value):
  972. self.host.set_volume(self.fPluginId, value)
  973. if self.fParent is not None:
  974. self.fParent.editDialogParameterValueChanged(self.fPluginId, PARAMETER_VOLUME, value)
  975. @pyqtSlot(int)
  976. def slot_balanceLeftChanged(self, value):
  977. self.host.set_balance_left(self.fPluginId, value)
  978. if self.fParent is not None:
  979. self.fParent.editDialogParameterValueChanged(self.fPluginId, PARAMETER_BALANCE_LEFT, value)
  980. @pyqtSlot(int)
  981. def slot_balanceRightChanged(self, value):
  982. self.host.set_balance_right(self.fPluginId, value)
  983. if self.fParent is not None:
  984. self.fParent.editDialogParameterValueChanged(self.fPluginId, PARAMETER_BALANCE_RIGHT, value)
  985. @pyqtSlot(int)
  986. def slot_panChanged(self, value):
  987. self.host.set_panning(self.fPluginId, value)
  988. if self.fParent is not None:
  989. self.fParent.editDialogParameterValueChanged(self.fPluginId, PARAMETER_PANNING, value)
  990. @pyqtSlot(int)
  991. def slot_ctrlChannelChanged(self, value):
  992. self.fControlChannel = value-1
  993. self.host.set_ctrl_channel(self.fPluginId, self.fControlChannel)
  994. self.ui.keyboard.allNotesOff()
  995. self._updateCtrlPrograms()
  996. #------------------------------------------------------------------
  997. @pyqtSlot(int, float)
  998. def slot_parameterValueChanged(self, parameterId, value):
  999. self.host.set_parameter_value(self.fPluginId, parameterId, value)
  1000. if self.fParent is not None:
  1001. self.fParent.editDialogParameterValueChanged(self.fPluginId, parameterId, value)
  1002. @pyqtSlot(int, int)
  1003. def slot_parameterMidiControlChanged(self, parameterId, control):
  1004. self.host.set_parameter_midi_cc(self.fPluginId, parameterId, control)
  1005. @pyqtSlot(int, int)
  1006. def slot_parameterMidiChannelChanged(self, parameterId, channel):
  1007. self.host.set_parameter_midi_channel(self.fPluginId, parameterId, channel-1)
  1008. #------------------------------------------------------------------
  1009. @pyqtSlot(int)
  1010. def slot_programIndexChanged(self, index):
  1011. self.host.set_program(self.fPluginId, index)
  1012. if self.fParent is not None:
  1013. self.fParent.editDialogProgramChanged(self.fPluginId, index)
  1014. self._updateParameterValues()
  1015. @pyqtSlot(int)
  1016. def slot_midiProgramIndexChanged(self, index):
  1017. self.host.set_midi_program(self.fPluginId, index)
  1018. if self.fParent is not None:
  1019. self.fParent.editDialogMidiProgramChanged(self.fPluginId, index)
  1020. self._updateParameterValues()
  1021. #------------------------------------------------------------------
  1022. @pyqtSlot(int)
  1023. def slot_noteOn(self, note):
  1024. if self.fControlChannel >= 0:
  1025. self.host.send_midi_note(self.fPluginId, self.fControlChannel, note, 100)
  1026. if self.fParent is not None:
  1027. self.fParent.editDialogNotePressed(self.fPluginId, note)
  1028. @pyqtSlot(int)
  1029. def slot_noteOff(self, note):
  1030. if self.fControlChannel >= 0:
  1031. self.host.send_midi_note(self.fPluginId, self.fControlChannel, note, 0)
  1032. if self.fParent is not None:
  1033. self.fParent.editDialogNoteReleased(self.fPluginId, note)
  1034. #------------------------------------------------------------------
  1035. @pyqtSlot()
  1036. def slot_finished(self):
  1037. if self.fParent is not None:
  1038. self.fParent.editDialogVisibilityChanged(self.fPluginId, False)
  1039. #------------------------------------------------------------------
  1040. @pyqtSlot()
  1041. def slot_knobCustomMenu(self):
  1042. knobName = self.sender().objectName()
  1043. if knobName == "dial_drywet":
  1044. minimum = 0.0
  1045. maximum = 1.0
  1046. default = 1.0
  1047. label = "Dry/Wet"
  1048. elif knobName == "dial_vol":
  1049. minimum = 0.0
  1050. maximum = 1.27
  1051. default = 1.0
  1052. label = "Volume"
  1053. elif knobName == "dial_b_left":
  1054. minimum = -1.0
  1055. maximum = 1.0
  1056. default = -1.0
  1057. label = "Balance-Left"
  1058. elif knobName == "dial_b_right":
  1059. minimum = -1.0
  1060. maximum = 1.0
  1061. default = 1.0
  1062. label = "Balance-Right"
  1063. elif knobName == "dial_pan":
  1064. minimum = -1.0
  1065. maximum = 1.0
  1066. default = 0.0
  1067. label = "Panning"
  1068. else:
  1069. minimum = 0.0
  1070. maximum = 1.0
  1071. default = 0.5
  1072. label = "Unknown"
  1073. current = self.sender().value() / 10
  1074. menu = QMenu(self)
  1075. actReset = menu.addAction(self.tr("Reset (%i%%)" % (default*100)))
  1076. menu.addSeparator()
  1077. actMinimum = menu.addAction(self.tr("Set to Minimum (%i%%)" % (minimum*100)))
  1078. actCenter = menu.addAction(self.tr("Set to Center"))
  1079. actMaximum = menu.addAction(self.tr("Set to Maximum (%i%%)" % (maximum*100)))
  1080. menu.addSeparator()
  1081. actSet = menu.addAction(self.tr("Set value..."))
  1082. if label not in ("Balance-Left", "Balance-Right"):
  1083. menu.removeAction(actCenter)
  1084. actSelected = menu.exec_(QCursor.pos())
  1085. if actSelected == actSet:
  1086. valueTry = QInputDialog.getDouble(self, self.tr("Set value"), label, current, minimum, maximum, 3)
  1087. if valueTry[1]:
  1088. value = valueTry[0] * 10
  1089. else:
  1090. return
  1091. elif actSelected == actMinimum:
  1092. value = minimum
  1093. elif actSelected == actMaximum:
  1094. value = maximum
  1095. elif actSelected == actReset:
  1096. value = default
  1097. elif actSelected == actCenter:
  1098. value = 0.0
  1099. else:
  1100. return
  1101. self.sender().setValue(value)
  1102. #------------------------------------------------------------------
  1103. @pyqtSlot()
  1104. def slot_channelCustomMenu(self):
  1105. menu = QMenu(self)
  1106. actNone = menu.addAction(self.tr("None"))
  1107. if self.fControlChannel+1 == 0:
  1108. actNone.setCheckable(True)
  1109. actNone.setChecked(True)
  1110. for i in range(1, 16+1):
  1111. action = menu.addAction("%i" % i)
  1112. if self.fControlChannel+1 == i:
  1113. action.setCheckable(True)
  1114. action.setChecked(True)
  1115. actSel = menu.exec_(QCursor.pos())
  1116. if not actSel:
  1117. pass
  1118. elif actSel == actNone:
  1119. self.ui.sb_ctrl_channel.setValue(0)
  1120. elif actSel:
  1121. selChannel = int(actSel.text())
  1122. self.ui.sb_ctrl_channel.setValue(selChannel)
  1123. #------------------------------------------------------------------
  1124. def _createParameterWidgets(self, paramType, paramListFull, tabPageName):
  1125. i = 1
  1126. for paramList, width in paramListFull:
  1127. if len(paramList) == 0:
  1128. break
  1129. tabIndex = self.ui.tabWidget.count()
  1130. tabPageContainer = QWidget(self.ui.tabWidget)
  1131. tabPageLayout = QVBoxLayout(tabPageContainer)
  1132. tabPageContainer.setLayout(tabPageLayout)
  1133. for paramInfo in paramList:
  1134. paramWidget = PluginParameter(tabPageContainer, self.host, paramInfo, self.fPluginId, tabIndex)
  1135. paramWidget.setLabelWidth(width)
  1136. tabPageLayout.addWidget(paramWidget)
  1137. self.fParameterList.append((paramType, paramInfo['index'], paramWidget))
  1138. if paramType == PARAMETER_INPUT:
  1139. paramWidget.valueChanged.connect(self.slot_parameterValueChanged)
  1140. paramWidget.midiControlChanged.connect(self.slot_parameterMidiControlChanged)
  1141. paramWidget.midiChannelChanged.connect(self.slot_parameterMidiChannelChanged)
  1142. tabPageLayout.addStretch()
  1143. self.ui.tabWidget.addTab(tabPageContainer, "%s (%i)" % (tabPageName, i))
  1144. i += 1
  1145. if paramType == PARAMETER_INPUT:
  1146. self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOff)
  1147. self.fTabIconTimers.append(ICON_STATE_OFF)
  1148. def _updateCtrlPrograms(self):
  1149. self.ui.keyboard.setEnabled(self.fControlChannel >= 0)
  1150. if self.fPluginInfo['category'] != PLUGIN_CATEGORY_SYNTH or self.fPluginInfo['type'] not in (PLUGIN_INTERNAL, PLUGIN_SF2, PLUGIN_GIG):
  1151. return
  1152. if self.fControlChannel < 0:
  1153. self.ui.cb_programs.setEnabled(False)
  1154. self.ui.cb_midi_programs.setEnabled(False)
  1155. return
  1156. self.ui.cb_programs.setEnabled(True)
  1157. self.ui.cb_midi_programs.setEnabled(True)
  1158. pIndex = self.host.get_current_program_index(self.fPluginId)
  1159. if self.ui.cb_programs.currentIndex() != pIndex:
  1160. self.setProgram(pIndex)
  1161. mpIndex = self.host.get_current_midi_program_index(self.fPluginId)
  1162. if self.ui.cb_midi_programs.currentIndex() != mpIndex:
  1163. self.setMidiProgram(mpIndex)
  1164. def _updateParameterValues(self):
  1165. for paramType, paramId, paramWidget in self.fParameterList:
  1166. paramWidget.blockSignals(True)
  1167. paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId))
  1168. paramWidget.blockSignals(False)
  1169. #------------------------------------------------------------------
  1170. def testTimer(self):
  1171. self.fIdleTimerId = self.startTimer(50)
  1172. #------------------------------------------------------------------
  1173. def closeEvent(self, event):
  1174. if self.fIdleTimerId != 0:
  1175. self.killTimer(self.fIdleTimerId)
  1176. self.fIdleTimerId = 0
  1177. self.host.engine_close()
  1178. QDialog.closeEvent(self, event)
  1179. def timerEvent(self, event):
  1180. if event.timerId() == self.fIdleTimerId:
  1181. self.host.engine_idle()
  1182. self.idleSlow()
  1183. QDialog.timerEvent(self, event)
  1184. def done(self, r):
  1185. QDialog.done(self, r)
  1186. self.close()
  1187. # ------------------------------------------------------------------------------------------------------------
  1188. # Main
  1189. if __name__ == '__main__':
  1190. from carla_app import CarlaApplication
  1191. from carla_host import initHost, loadHostSettings
  1192. app = CarlaApplication()
  1193. host = initHost("Widgets", None, False, False, False)
  1194. loadHostSettings(host)
  1195. host.engine_init("JACK", "Carla-Widgets")
  1196. host.add_plugin(BINARY_NATIVE, PLUGIN_DSSI, "/usr/lib/dssi/karplong.so", "karplong", "karplong", 0, None)
  1197. host.set_active(0, True)
  1198. #gui1 = CarlaAboutW(None, host)
  1199. #gui1.show()
  1200. gui2 = PluginEdit(None, host, 0)
  1201. gui2.testTimer()
  1202. gui2.show()
  1203. app.exit_exec()