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.

1655 lines
66KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla widgets code
  4. # Copyright (C) 2011-2013 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 (Global)
  19. try:
  20. from PyQt5.QtCore import QByteArray, QSettings
  21. from PyQt5.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath
  22. from PyQt5.QtWidgets import QDialog, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget
  23. except:
  24. from PyQt4.QtCore import QByteArray, QSettings
  25. from PyQt4.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath
  26. from PyQt4.QtGui import QDialog, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget
  27. # ------------------------------------------------------------------------------------------------------------
  28. # Imports (Custom)
  29. import ui_carla_about
  30. import ui_carla_edit
  31. import ui_carla_parameter
  32. import ui_carla_plugin
  33. from carla_shared import *
  34. # ------------------------------------------------------------------------------------------------------------
  35. # Carla GUI defines
  36. ICON_STATE_NULL = 0
  37. ICON_STATE_OFF = 1
  38. ICON_STATE_WAIT = 2
  39. ICON_STATE_ON = 3
  40. # ------------------------------------------------------------------------------------------------------------
  41. # Fake plugin info for easy testing
  42. gFakePluginInfo = {
  43. "type": PLUGIN_NONE,
  44. "category": PLUGIN_CATEGORY_SYNTH,
  45. "hints": PLUGIN_CAN_DRYWET|PLUGIN_CAN_VOLUME|PLUGIN_CAN_PANNING, # PLUGIN_IS_SYNTH
  46. "optionsAvailable": 0x1FF, # all
  47. "optionsEnabled": 0x1FF, # all
  48. "binary": "AwesoomeBinary.yeah",
  49. "name": "Awesoome Name",
  50. "label": "awesoomeLabel",
  51. "maker": "Awesoome Maker",
  52. "copyright": "Awesoome Copyright",
  53. "iconName": "plugin",
  54. "uniqueId": 0,
  55. "latency": 0
  56. }
  57. gFakeParamInfo = {
  58. 'type': PARAMETER_INPUT,
  59. 'hints': PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE,
  60. 'name': "Parameter Name",
  61. 'unit': "",
  62. 'scalePoints': [],
  63. 'index': 0,
  64. 'default': 0.0,
  65. 'minimum': 0.0,
  66. 'maximum': 1.0,
  67. 'step': 0.01,
  68. 'stepSmall': 0.01,
  69. 'stepLarge': 0.01,
  70. 'midiCC': -1,
  71. 'midiChannel': 1,
  72. 'current': 0.0
  73. }
  74. gFakeCountInfo = {
  75. "ins": 0,
  76. "outs": 0,
  77. "total": 0
  78. }
  79. # ------------------------------------------------------------------------------------------------------------
  80. # Carla About dialog
  81. class CarlaAboutW(QDialog):
  82. def __init__(self, parent):
  83. QDialog.__init__(self, parent)
  84. self.ui = ui_carla_about.Ui_CarlaAboutW()
  85. self.ui.setupUi(self)
  86. if Carla.isControl:
  87. extraInfo = " - <b>%s</b>" % self.tr("OSC Bridge Version")
  88. else:
  89. extraInfo = ""
  90. self.ui.l_about.setText(self.tr(""
  91. "<br>Version %s"
  92. "<br>Carla is a Multi-Plugin Host for JACK%s.<br>"
  93. "<br>Copyright (C) 2011-2013 falkTX<br>"
  94. "" % (VERSION, extraInfo)))
  95. if Carla.host is None:
  96. self.ui.l_extended.hide()
  97. self.ui.tabWidget.removeTab(1)
  98. self.ui.tabWidget.removeTab(1)
  99. self.adjustSize()
  100. else:
  101. self.ui.l_extended.setText(cString(Carla.host.get_extended_license_text()))
  102. if Carla.host.is_engine_running():
  103. self.ui.le_osc_url_tcp.setText(cString(Carla.host.get_host_osc_url_tcp()))
  104. self.ui.le_osc_url_udp.setText(cString(Carla.host.get_host_osc_url_udp()))
  105. else:
  106. self.ui.le_osc_url_tcp.setText(self.tr("(Engine not running)"))
  107. self.ui.le_osc_url_udp.setText(self.tr("(Engine not running)"))
  108. self.ui.l_osc_cmds.setText(""
  109. " /set_active <i-value>\n"
  110. " /set_drywet <f-value>\n"
  111. " /set_volume <f-value>\n"
  112. " /set_balance_left <f-value>\n"
  113. " /set_balance_right <f-value>\n"
  114. " /set_panning <f-value>\n"
  115. " /set_parameter_value <i-index> <f-value>\n"
  116. " /set_parameter_midi_cc <i-index> <i-cc>\n"
  117. " /set_parameter_midi_channel <i-index> <i-channel>\n"
  118. " /set_program <i-index>\n"
  119. " /set_midi_program <i-index>\n"
  120. " /note_on <i-note> <i-velo>\n"
  121. " /note_off <i-note>\n"
  122. )
  123. self.ui.l_example.setText("/Carla/2/set_parameter_value 5 1.0")
  124. self.ui.l_example_help.setText("<i>(as in this example, \"2\" is the plugin number and \"5\" the parameter)</i>")
  125. self.ui.l_ladspa.setText(self.tr("Everything! (Including LRDF)"))
  126. self.ui.l_dssi.setText(self.tr("Everything! (Including CustomData/Chunks)"))
  127. self.ui.l_lv2.setText(self.tr("About 80&#37; complete (using custom extensions)<br/>"
  128. "Implemented Feature/Extensions:"
  129. "<ul>"
  130. "<li>http://lv2plug.in/ns/ext/atom</li>"
  131. "<li>http://lv2plug.in/ns/ext/buf-size</li>"
  132. "<li>http://lv2plug.in/ns/ext/data-access</li>"
  133. #"<li>http://lv2plug.in/ns/ext/dynmanifest</li>"
  134. "<li>http://lv2plug.in/ns/ext/event</li>"
  135. "<li>http://lv2plug.in/ns/ext/instance-access</li>"
  136. "<li>http://lv2plug.in/ns/ext/log</li>"
  137. "<li>http://lv2plug.in/ns/ext/midi</li>"
  138. #"<li>http://lv2plug.in/ns/ext/morph</li>"
  139. "<li>http://lv2plug.in/ns/ext/options</li>"
  140. "<li>http://lv2plug.in/ns/ext/parameters</li>"
  141. #"<li>http://lv2plug.in/ns/ext/patch</li>"
  142. #"<li>http://lv2plug.in/ns/ext/port-groups</li>"
  143. #"<li>http://lv2plug.in/ns/ext/port-props</li>"
  144. "<li>http://lv2plug.in/ns/ext/presets</li>"
  145. #"<li>http://lv2plug.in/ns/ext/resize-port</li>"
  146. "<li>http://lv2plug.in/ns/ext/state</li>"
  147. "<li>http://lv2plug.in/ns/ext/time</li>"
  148. "<li>http://lv2plug.in/ns/ext/uri-map</li>"
  149. "<li>http://lv2plug.in/ns/ext/urid</li>"
  150. #"<li>http://lv2plug.in/ns/ext/worker</li>"
  151. "<li>http://lv2plug.in/ns/extensions/ui</li>"
  152. "<li>http://lv2plug.in/ns/extensions/units</li>"
  153. "<li>http://kxstudio.sf.net/ns/lv2ext/external-ui</li>"
  154. "<li>http://kxstudio.sf.net/ns/lv2ext/programs</li>"
  155. "<li>http://kxstudio.sf.net/ns/lv2ext/rtmempool</li>"
  156. "<li>http://ll-plugins.nongnu.org/lv2/ext/midimap</li>"
  157. "<li>http://ll-plugins.nongnu.org/lv2/ext/miditype</li>"
  158. "</ul>"))
  159. self.ui.l_vst.setText(self.tr("<p>About 85&#37; complete (missing vst bank/presets and some minor stuff)</p>"))
  160. def done(self, r):
  161. QDialog.done(self, r)
  162. self.close()
  163. # ------------------------------------------------------------------------------------------------------------
  164. # Plugin Parameter
  165. class PluginParameter(QWidget):
  166. midiControlChanged = pyqtSignal(int, int)
  167. midiChannelChanged = pyqtSignal(int, int)
  168. valueChanged = pyqtSignal(int, float)
  169. def __init__(self, parent, pInfo, pluginId, tabIndex):
  170. QWidget.__init__(self, parent)
  171. self.ui = ui_carla_parameter.Ui_PluginParameter()
  172. self.ui.setupUi(self)
  173. # -------------------------------------------------------------
  174. # Internal stuff
  175. self.fMidiControl = -1
  176. self.fMidiChannel = 1
  177. self.fParameterId = pInfo['index']
  178. self.fPluginId = pluginId
  179. self.fTabIndex = tabIndex
  180. # -------------------------------------------------------------
  181. # Set-up GUI
  182. pType = pInfo['type']
  183. pHints = pInfo['hints']
  184. self.ui.label.setText(pInfo['name'])
  185. self.ui.widget.setName(pInfo['name'])
  186. if pType == PARAMETER_INPUT:
  187. self.ui.widget.setMinimum(pInfo['minimum'])
  188. self.ui.widget.setMaximum(pInfo['maximum'])
  189. self.ui.widget.setDefault(pInfo['default'])
  190. self.ui.widget.setValue(pInfo['current'], False)
  191. self.ui.widget.setLabel(pInfo['unit'])
  192. self.ui.widget.setStep(pInfo['step'])
  193. self.ui.widget.setStepSmall(pInfo['stepSmall'])
  194. self.ui.widget.setStepLarge(pInfo['stepLarge'])
  195. self.ui.widget.setScalePoints(pInfo['scalePoints'], bool(pHints & PARAMETER_USES_SCALEPOINTS))
  196. if not pHints & PARAMETER_IS_ENABLED:
  197. self.ui.label.setEnabled(False)
  198. self.ui.widget.setEnabled(False)
  199. self.ui.widget.setReadOnly(True)
  200. self.ui.sb_control.setEnabled(False)
  201. self.ui.sb_channel.setEnabled(False)
  202. elif not pHints & PARAMETER_IS_AUTOMABLE:
  203. self.ui.sb_control.setEnabled(False)
  204. self.ui.sb_channel.setEnabled(False)
  205. if pHints & PARAMETER_IS_READ_ONLY:
  206. self.ui.widget.setReadOnly(True)
  207. elif pType == PARAMETER_OUTPUT:
  208. self.ui.widget.setMinimum(pInfo['minimum'])
  209. self.ui.widget.setMaximum(pInfo['maximum'])
  210. self.ui.widget.setValue(pInfo['current'], False)
  211. self.ui.widget.setLabel(pInfo['unit'])
  212. self.ui.widget.setReadOnly(True)
  213. if not pHints & PARAMETER_IS_AUTOMABLE:
  214. self.ui.sb_control.setEnabled(False)
  215. self.ui.sb_channel.setEnabled(False)
  216. else:
  217. self.ui.widget.setVisible(False)
  218. self.ui.sb_control.setVisible(False)
  219. self.ui.sb_channel.setVisible(False)
  220. if pHints & PARAMETER_USES_CUSTOM_TEXT:
  221. self.ui.widget.setTextCallback(self._textCallBack)
  222. self.ui.widget.updateAll()
  223. self.setMidiControl(pInfo['midiCC'])
  224. self.setMidiChannel(pInfo['midiChannel'])
  225. # -------------------------------------------------------------
  226. # Set-up connections
  227. self.ui.sb_control.customContextMenuRequested.connect(self.slot_controlSpinboxCustomMenu)
  228. self.ui.sb_channel.customContextMenuRequested.connect(self.slot_channelSpinboxCustomMenu)
  229. self.ui.sb_control.valueChanged.connect(self.slot_controlSpinboxChanged)
  230. self.ui.sb_channel.valueChanged.connect(self.slot_channelSpinboxChanged)
  231. self.ui.widget.valueChanged.connect(self.slot_widgetValueChanged)
  232. # -------------------------------------------------------------
  233. def pluginId(self):
  234. return self.fPluginId
  235. def tabIndex(self):
  236. return self.fTabIndex
  237. def setDefault(self, value):
  238. self.ui.widget.setDefault(value)
  239. def setValue(self, value, send=True):
  240. self.ui.widget.setValue(value, send)
  241. def setMidiControl(self, control):
  242. self.fMidiControl = control
  243. self.ui.sb_control.blockSignals(True)
  244. self.ui.sb_control.setValue(control)
  245. self.ui.sb_control.blockSignals(False)
  246. def setMidiChannel(self, channel):
  247. self.fMidiChannel = channel
  248. self.ui.sb_channel.blockSignals(True)
  249. self.ui.sb_channel.setValue(channel)
  250. self.ui.sb_channel.blockSignals(False)
  251. def setLabelWidth(self, width):
  252. self.ui.label.setMinimumWidth(width)
  253. self.ui.label.setMaximumWidth(width)
  254. @pyqtSlot()
  255. def slot_controlSpinboxCustomMenu(self):
  256. menu = QMenu(self)
  257. actNone = menu.addAction(self.tr("None"))
  258. if self.fMidiControl == -1:
  259. actNone.setCheckable(True)
  260. actNone.setChecked(True)
  261. for cc in MIDI_CC_LIST:
  262. action = menu.addAction(cc)
  263. if self.fMidiControl != -1 and int(cc.split(" ")[0], 16) == self.fMidiControl:
  264. action.setCheckable(True)
  265. action.setChecked(True)
  266. actSel = menu.exec_(QCursor.pos())
  267. if not actSel:
  268. pass
  269. elif actSel == actNone:
  270. self.ui.sb_control.setValue(-1)
  271. else:
  272. selControlStr = actSel.text()
  273. selControl = int(selControlStr.split(" ")[0], 16)
  274. self.ui.sb_control.setValue(selControl)
  275. @pyqtSlot()
  276. def slot_channelSpinboxCustomMenu(self):
  277. menu = QMenu(self)
  278. for i in range(1, 16+1):
  279. action = menu.addAction("%i" % i)
  280. if self.fMidiChannel == i:
  281. action.setCheckable(True)
  282. action.setChecked(True)
  283. actSel = menu.exec_(QCursor.pos())
  284. if actSel:
  285. selChannel = int(actSel.text())
  286. self.ui.sb_channel.setValue(selChannel)
  287. @pyqtSlot(int)
  288. def slot_controlSpinboxChanged(self, control):
  289. if self.fMidiControl != control:
  290. self.midiControlChanged.emit(self.fParameterId, control)
  291. self.fMidiControl = control
  292. @pyqtSlot(int)
  293. def slot_channelSpinboxChanged(self, channel):
  294. if self.fMidiChannel != channel:
  295. self.midiChannelChanged.emit(self.fParameterId, channel)
  296. self.fMidiChannel = channel
  297. @pyqtSlot(float)
  298. def slot_widgetValueChanged(self, value):
  299. self.valueChanged.emit(self.fParameterId, value)
  300. def _textCallBack(self):
  301. return cString(Carla.host.get_parameter_text(self.fPluginId, self.fParameterId))
  302. # ------------------------------------------------------------------------------------------------------------
  303. # Plugin Editor (Built-in)
  304. class PluginEdit(QDialog):
  305. def __init__(self, parent, pluginId):
  306. QDialog.__init__(self, Carla.gui)
  307. self.ui = ui_carla_edit.Ui_PluginEdit()
  308. self.ui.setupUi(self)
  309. # -------------------------------------------------------------
  310. # Internal stuff
  311. self.fGeometry = QByteArray()
  312. self.fPluginId = pluginId
  313. self.fPuginInfo = None
  314. self.fRealParent = parent
  315. self.fCurrentProgram = -1
  316. self.fCurrentMidiProgram = -1
  317. self.fCurrentStateFilename = None
  318. self.fControlChannel = 0
  319. self.fScrollAreaSetup = False
  320. self.fParameterCount = 0
  321. self.fParameterList = [] # (type, id, widget)
  322. self.fParametersToUpdate = [] # (id, value)
  323. self.fPlayingNotes = [] # (channel, note)
  324. self.fTabIconOff = QIcon(":/bitmaps/led_off.png")
  325. self.fTabIconOn = QIcon(":/bitmaps/led_yellow.png")
  326. self.fTabIconCount = 0
  327. self.fTabIconTimers = []
  328. # -------------------------------------------------------------
  329. # Set-up GUI
  330. self.ui.dial_drywet.setCustomPaint(self.ui.dial_drywet.CUSTOM_PAINT_CARLA_WET)
  331. self.ui.dial_drywet.setPixmap(3)
  332. self.ui.dial_drywet.setLabel("Dry/Wet")
  333. self.ui.dial_vol.setCustomPaint(self.ui.dial_vol.CUSTOM_PAINT_CARLA_VOL)
  334. self.ui.dial_vol.setPixmap(3)
  335. self.ui.dial_vol.setLabel("Volume")
  336. self.ui.dial_b_left.setCustomPaint(self.ui.dial_b_left.CUSTOM_PAINT_CARLA_L)
  337. self.ui.dial_b_left.setPixmap(4)
  338. self.ui.dial_b_left.setLabel("L")
  339. self.ui.dial_b_right.setCustomPaint(self.ui.dial_b_right.CUSTOM_PAINT_CARLA_R)
  340. self.ui.dial_b_right.setPixmap(4)
  341. self.ui.dial_b_right.setLabel("R")
  342. self.ui.keyboard.setMode(self.ui.keyboard.HORIZONTAL)
  343. self.ui.keyboard.setOctaves(10)
  344. self.ui.sb_ctrl_channel.setValue(self.fControlChannel+1)
  345. self.ui.scrollArea.ensureVisible(self.ui.keyboard.width() / 3, 0)
  346. self.ui.scrollArea.setEnabled(False)
  347. self.ui.scrollArea.setVisible(False)
  348. self.reloadAll()
  349. # -------------------------------------------------------------
  350. # Set-up connections
  351. self.finished.connect(self.slot_finished)
  352. self.ui.ch_fixed_buffer.clicked.connect(self.slot_optionChanged)
  353. self.ui.ch_force_stereo.clicked.connect(self.slot_optionChanged)
  354. self.ui.ch_map_program_changes.clicked.connect(self.slot_optionChanged)
  355. self.ui.ch_use_chunks.clicked.connect(self.slot_optionChanged)
  356. self.ui.ch_send_control_changes.clicked.connect(self.slot_optionChanged)
  357. self.ui.ch_send_channel_pressure.clicked.connect(self.slot_optionChanged)
  358. self.ui.ch_send_note_aftertouch.clicked.connect(self.slot_optionChanged)
  359. self.ui.ch_send_pitchbend.clicked.connect(self.slot_optionChanged)
  360. self.ui.ch_send_all_sound_off.clicked.connect(self.slot_optionChanged)
  361. self.ui.dial_drywet.valueChanged.connect(self.slot_dryWetChanged)
  362. self.ui.dial_vol.valueChanged.connect(self.slot_volumeChanged)
  363. self.ui.dial_b_left.valueChanged.connect(self.slot_balanceLeftChanged)
  364. self.ui.dial_b_right.valueChanged.connect(self.slot_balanceRightChanged)
  365. self.ui.sb_ctrl_channel.valueChanged.connect(self.slot_ctrlChannelChanged)
  366. self.ui.dial_drywet.customContextMenuRequested.connect(self.slot_knobCustomMenu)
  367. self.ui.dial_vol.customContextMenuRequested.connect(self.slot_knobCustomMenu)
  368. self.ui.dial_b_left.customContextMenuRequested.connect(self.slot_knobCustomMenu)
  369. self.ui.dial_b_right.customContextMenuRequested.connect(self.slot_knobCustomMenu)
  370. self.ui.sb_ctrl_channel.customContextMenuRequested.connect(self.slot_channelCustomMenu)
  371. self.ui.keyboard.noteOn.connect(self.slot_noteOn)
  372. self.ui.keyboard.noteOff.connect(self.slot_noteOff)
  373. self.ui.cb_programs.currentIndexChanged.connect(self.slot_programIndexChanged)
  374. self.ui.cb_midi_programs.currentIndexChanged.connect(self.slot_midiProgramIndexChanged)
  375. if Carla.isLocal:
  376. self.ui.b_save_state.clicked.connect(self.slot_stateSave)
  377. self.ui.b_load_state.clicked.connect(self.slot_stateLoad)
  378. else:
  379. self.ui.b_load_state.setEnabled(False)
  380. self.ui.b_save_state.setEnabled(False)
  381. # -------------------------------------------------------------
  382. def reloadAll(self):
  383. if Carla.host is not None:
  384. self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId)
  385. self.fPluginInfo['binary'] = cString(self.fPluginInfo['binary'])
  386. self.fPluginInfo['name'] = cString(self.fPluginInfo['name'])
  387. self.fPluginInfo['label'] = cString(self.fPluginInfo['label'])
  388. self.fPluginInfo['maker'] = cString(self.fPluginInfo['maker'])
  389. self.fPluginInfo['copyright'] = cString(self.fPluginInfo['copyright'])
  390. self.fPluginInfo['iconName'] = cString(self.fPluginInfo['iconName'])
  391. if not Carla.isLocal:
  392. self.fPluginInfo['hints'] &= ~PLUGIN_HAS_GUI
  393. else:
  394. self.fPluginInfo = gFakePluginInfo
  395. self.reloadInfo()
  396. self.reloadParameters()
  397. self.reloadPrograms()
  398. if self.fPluginInfo['type'] == PLUGIN_LV2:
  399. self.ui.b_save_state.setEnabled(False)
  400. if not self.ui.scrollArea.isEnabled():
  401. self.resize(self.width(), self.height()-self.ui.scrollArea.height())
  402. def reloadInfo(self):
  403. if Carla.host is not None:
  404. pluginName = cString(Carla.host.get_real_plugin_name(self.fPluginId))
  405. audioCountInfo = Carla.host.get_audio_port_count_info(self.fPluginId)
  406. midiCountInfo = Carla.host.get_midi_port_count_info(self.fPluginId)
  407. paramCountInfo = Carla.host.get_parameter_count_info(self.fPluginId)
  408. else:
  409. pluginName = ""
  410. audioCountInfo = gFakeCountInfo
  411. midiCountInfo = gFakeCountInfo
  412. paramCountInfo = gFakeCountInfo
  413. pluginType = self.fPluginInfo['type']
  414. pluginHints = self.fPluginInfo['hints']
  415. #if pluginType == PLUGIN_INTERNAL:
  416. #self.ui.le_type.setText(self.tr("Internal"))
  417. #elif pluginType == PLUGIN_LADSPA:
  418. #self.ui.le_type.setText("LADSPA")
  419. #elif pluginType == PLUGIN_DSSI:
  420. #self.ui.le_type.setText("DSSI")
  421. #elif pluginType == PLUGIN_LV2:
  422. #self.ui.le_type.setText("LV2")
  423. #elif pluginType == PLUGIN_VST:
  424. #self.ui.le_type.setText("VST")
  425. #elif pluginType == PLUGIN_AU:
  426. #self.ui.le_type.setText("AU")
  427. #elif pluginType == PLUGIN_CSOUND:
  428. #self.ui.le_type.setText("CSOUND")
  429. #elif pluginType == PLUGIN_GIG:
  430. #self.ui.le_type.setText("GIG")
  431. #elif pluginType == PLUGIN_SF2:
  432. #self.ui.le_type.setText("SF2")
  433. #elif pluginType == PLUGIN_SFZ:
  434. #self.ui.le_type.setText("SFZ")
  435. #else:
  436. #self.ui.le_type.setText(self.tr("Unknown"))
  437. #self.ui.le_name.setText(pluginName)
  438. #self.ui.le_name.setToolTip(pluginName)
  439. #self.ui.le_label.setText(self.fPluginInfo['label'])
  440. #self.ui.le_label.setToolTip(self.fPluginInfo['label'])
  441. #self.ui.le_maker.setText(self.fPluginInfo['maker'])
  442. #self.ui.le_maker.setToolTip(self.fPluginInfo['maker'])
  443. #self.ui.le_copyright.setText(self.fPluginInfo['copyright'])
  444. #self.ui.le_copyright.setToolTip(self.fPluginInfo['copyright'])
  445. #self.ui.le_unique_id.setText(str(self.fPluginInfo['uniqueId']))
  446. #self.ui.le_unique_id.setToolTip(str(self.fPluginInfo['uniqueId']))
  447. #self.ui.le_ains.setText(str(audioCountInfo['ins']))
  448. #self.ui.le_aouts.setText(str(audioCountInfo['outs']))
  449. #self.ui.le_params.setText(str(paramCountInfo['ins']))
  450. self.ui.label_plugin.setText("\n%s\n" % self.fPluginInfo['name'])
  451. self.setWindowTitle(self.fPluginInfo['name'])
  452. #if self.fPluginInfo['latency'] > 0:
  453. #self.ui.le_latency.setText("%i samples" % self.fPluginInfo['latency'])
  454. #else:
  455. #self.ui.le_latency.setText(self.tr("None"))
  456. self.ui.dial_drywet.setEnabled(pluginHints & PLUGIN_CAN_DRYWET)
  457. self.ui.dial_vol.setEnabled(pluginHints & PLUGIN_CAN_VOLUME)
  458. self.ui.dial_b_left.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)
  459. self.ui.dial_b_right.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)
  460. self.ui.ch_fixed_buffer.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FIXED_BUFFER)
  461. self.ui.ch_fixed_buffer.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FIXED_BUFFER)
  462. self.ui.ch_force_stereo.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FORCE_STEREO)
  463. self.ui.ch_force_stereo.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FORCE_STEREO)
  464. self.ui.ch_map_program_changes.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_MAP_PROGRAM_CHANGES)
  465. self.ui.ch_map_program_changes.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_MAP_PROGRAM_CHANGES)
  466. self.ui.ch_use_chunks.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_USE_CHUNKS)
  467. self.ui.ch_use_chunks.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_USE_CHUNKS)
  468. self.ui.ch_send_control_changes.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_CONTROL_CHANGES)
  469. self.ui.ch_send_control_changes.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_CONTROL_CHANGES)
  470. self.ui.ch_send_channel_pressure.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_CHANNEL_PRESSURE)
  471. self.ui.ch_send_channel_pressure.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_CHANNEL_PRESSURE)
  472. self.ui.ch_send_note_aftertouch.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
  473. self.ui.ch_send_note_aftertouch.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
  474. self.ui.ch_send_pitchbend.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_PITCHBEND)
  475. self.ui.ch_send_pitchbend.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_PITCHBEND)
  476. self.ui.ch_send_all_sound_off.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
  477. self.ui.ch_send_all_sound_off.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
  478. if self.fPluginInfo['type'] != PLUGIN_VST:
  479. self.ui.tab_programs.setCurrentIndex(1)
  480. # Show/hide keyboard
  481. showKeyboard = (pluginHints & PLUGIN_IS_SYNTH) != 0 or (midiCountInfo['ins'] > 0 < midiCountInfo['outs'])
  482. self.ui.scrollArea.setEnabled(showKeyboard)
  483. self.ui.scrollArea.setVisible(showKeyboard)
  484. # Force-Update parent for new hints
  485. if self.fRealParent:
  486. self.fRealParent.recheckPluginHints(pluginHints)
  487. def reloadParameters(self):
  488. # Reset
  489. self.fParameterCount = 0
  490. self.fParameterList = []
  491. self.fParametersToUpdate = []
  492. self.fTabIconCount = 0
  493. self.fTabIconTimers = []
  494. # Remove all previous parameters
  495. for x in range(self.ui.tabWidget.count()-1):
  496. self.ui.tabWidget.widget(1).deleteLater()
  497. self.ui.tabWidget.removeTab(1)
  498. if Carla.host is None:
  499. paramFakeListFull = []
  500. paramFakeList = []
  501. paramFakeWidth = QFontMetrics(self.font()).width(gFakeParamInfo['name'])
  502. paramFakeList.append(gFakeParamInfo)
  503. paramFakeListFull.append((paramFakeList, paramFakeWidth))
  504. self._createParameterWidgets(PARAMETER_INPUT, paramFakeListFull, self.tr("Parameters"))
  505. return
  506. parameterCount = Carla.host.get_parameter_count(self.fPluginId)
  507. if parameterCount <= 0:
  508. pass
  509. elif parameterCount <= Carla.maxParameters:
  510. paramInputListFull = []
  511. paramOutputListFull = []
  512. paramInputList = [] # ([params], width)
  513. paramInputWidth = 0
  514. paramOutputList = [] # ([params], width)
  515. paramOutputWidth = 0
  516. for i in range(parameterCount):
  517. paramInfo = Carla.host.get_parameter_info(self.fPluginId, i)
  518. paramData = Carla.host.get_parameter_data(self.fPluginId, i)
  519. paramRanges = Carla.host.get_parameter_ranges(self.fPluginId, i)
  520. paramValue = Carla.host.get_current_parameter_value(self.fPluginId, i)
  521. if paramData['type'] not in (PARAMETER_INPUT, PARAMETER_OUTPUT):
  522. continue
  523. parameter = {
  524. 'type': paramData['type'],
  525. 'hints': paramData['hints'],
  526. 'name': cString(paramInfo['name']),
  527. 'unit': cString(paramInfo['unit']),
  528. 'scalePoints': [],
  529. 'index': paramData['index'],
  530. 'default': paramRanges['def'],
  531. 'minimum': paramRanges['min'],
  532. 'maximum': paramRanges['max'],
  533. 'step': paramRanges['step'],
  534. 'stepSmall': paramRanges['stepSmall'],
  535. 'stepLarge': paramRanges['stepLarge'],
  536. 'midiCC': paramData['midiCC'],
  537. 'midiChannel': paramData['midiChannel']+1,
  538. 'current': paramValue
  539. }
  540. for j in range(paramInfo['scalePointCount']):
  541. scalePointInfo = Carla.host.get_parameter_scalepoint_info(self.fPluginId, i, j)
  542. parameter['scalePoints'].append({
  543. 'value': scalePointInfo['value'],
  544. 'label': cString(scalePointInfo['label'])
  545. })
  546. #parameter['name'] = parameter['name'][:30] + (parameter['name'][30:] and "...")
  547. # -----------------------------------------------------------------
  548. # Get width values, in packs of 10
  549. if parameter['type'] == PARAMETER_INPUT:
  550. paramInputWidthTMP = QFontMetrics(self.font()).width(parameter['name'])
  551. if paramInputWidthTMP > paramInputWidth:
  552. paramInputWidth = paramInputWidthTMP
  553. paramInputList.append(parameter)
  554. if len(paramInputList) == 10:
  555. paramInputListFull.append((paramInputList, paramInputWidth))
  556. paramInputList = []
  557. paramInputWidth = 0
  558. else:
  559. paramOutputWidthTMP = QFontMetrics(self.font()).width(parameter['name'])
  560. if paramOutputWidthTMP > paramOutputWidth:
  561. paramOutputWidth = paramOutputWidthTMP
  562. paramOutputList.append(parameter)
  563. if len(paramOutputList) == 10:
  564. paramOutputListFull.append((paramOutputList, paramOutputWidth))
  565. paramOutputList = []
  566. paramOutputWidth = 0
  567. # for i in range(parameterCount)
  568. else:
  569. # Final page width values
  570. if 0 < len(paramInputList) < 10:
  571. paramInputListFull.append((paramInputList, paramInputWidth))
  572. if 0 < len(paramOutputList) < 10:
  573. paramOutputListFull.append((paramOutputList, paramOutputWidth))
  574. # -----------------------------------------------------------------
  575. # Create parameter tabs + widgets
  576. self._createParameterWidgets(PARAMETER_INPUT, paramInputListFull, self.tr("Parameters"))
  577. self._createParameterWidgets(PARAMETER_OUTPUT, paramOutputListFull, self.tr("Outputs"))
  578. else: # > Carla.maxParameters
  579. fakeName = self.tr("This plugin has too many parameters to display here!")
  580. paramFakeListFull = []
  581. paramFakeList = []
  582. paramFakeWidth = QFontMetrics(self.font()).width(fakeName)
  583. parameter = {
  584. 'type': PARAMETER_UNKNOWN,
  585. 'hints': 0,
  586. 'name': fakeName,
  587. 'unit': "",
  588. 'scalePoints': [],
  589. 'index': 0,
  590. 'default': 0.0,
  591. 'minimum': 0.0,
  592. 'maximum': 0.0,
  593. 'step': 0.0,
  594. 'stepSmall': 0.0,
  595. 'stepLarge': 0.0,
  596. 'midiCC': -1,
  597. 'midiChannel': 1,
  598. 'current': 0.0
  599. }
  600. paramFakeList.append(parameter)
  601. paramFakeListFull.append((paramFakeList, paramFakeWidth))
  602. self._createParameterWidgets(PARAMETER_UNKNOWN, paramFakeListFull, self.tr("Information"))
  603. def reloadPrograms(self):
  604. # Programs
  605. self.ui.cb_programs.blockSignals(True)
  606. self.ui.cb_programs.clear()
  607. programCount = Carla.host.get_program_count(self.fPluginId) if Carla.host is not None else 0
  608. if programCount > 0:
  609. self.ui.cb_programs.setEnabled(True)
  610. self.ui.label_programs.setEnabled(True)
  611. for i in range(programCount):
  612. pName = cString(Carla.host.get_program_name(self.fPluginId, i))
  613. #pName = pName[:40] + (pName[40:] and "...")
  614. self.ui.cb_programs.addItem(pName)
  615. self.fCurrentProgram = Carla.host.get_current_program_index(self.fPluginId)
  616. self.ui.cb_programs.setCurrentIndex(self.fCurrentProgram)
  617. else:
  618. self.fCurrentProgram = -1
  619. self.ui.cb_programs.setEnabled(False)
  620. self.ui.label_programs.setEnabled(False)
  621. self.ui.cb_programs.blockSignals(False)
  622. # MIDI Programs
  623. self.ui.cb_midi_programs.blockSignals(True)
  624. self.ui.cb_midi_programs.clear()
  625. midiProgramCount = Carla.host.get_midi_program_count(self.fPluginId) if Carla.host is not None else 0
  626. if midiProgramCount > 0:
  627. self.ui.cb_midi_programs.setEnabled(True)
  628. self.ui.label_midi_programs.setEnabled(True)
  629. for i in range(midiProgramCount):
  630. mpData = Carla.host.get_midi_program_data(self.fPluginId, i)
  631. mpBank = int(mpData['bank'])
  632. mpProg = int(mpData['program'])
  633. mpName = cString(mpData['name'])
  634. #mpName = mpName[:40] + (mpName[40:] and "...")
  635. self.ui.cb_midi_programs.addItem("%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName))
  636. self.fCurrentMidiProgram = Carla.host.get_current_midi_program_index(self.fPluginId)
  637. self.ui.cb_midi_programs.setCurrentIndex(self.fCurrentMidiProgram)
  638. else:
  639. self.fCurrentMidiProgram = -1
  640. self.ui.cb_midi_programs.setEnabled(False)
  641. self.ui.label_midi_programs.setEnabled(False)
  642. self.ui.cb_midi_programs.blockSignals(False)
  643. if self.fPluginInfo['type'] == PLUGIN_LV2:
  644. self.ui.b_load_state.setEnabled(programCount > 0)
  645. def updateInfo(self):
  646. # Update current program text
  647. if self.ui.cb_programs.count() > 0:
  648. pIndex = self.ui.cb_programs.currentIndex()
  649. pName = cString(Carla.host.get_program_name(self.fPluginId, pIndex))
  650. #pName = pName[:40] + (pName[40:] and "...")
  651. self.ui.cb_programs.setItemText(pIndex, pName)
  652. # Update current midi program text
  653. if self.ui.cb_midi_programs.count() > 0:
  654. mpIndex = self.ui.cb_midi_programs.currentIndex()
  655. mpData = Carla.host.get_midi_program_data(self.fPluginId, mpIndex)
  656. mpBank = int(mpData['bank'])
  657. mpProg = int(mpData['program'])
  658. mpName = cString(mpData['name'])
  659. #mpName = mpName[:40] + (mpName[40:] and "...")
  660. self.ui.cb_midi_programs.setItemText(mpIndex, "%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName))
  661. # Update all parameter values
  662. for paramType, paramId, paramWidget in self.fParameterList:
  663. paramWidget.setValue(Carla.host.get_current_parameter_value(self.fPluginId, paramId), False)
  664. paramWidget.update()
  665. self.fParametersToUpdate = []
  666. def clearNotes(self):
  667. self.fPlayingNotes = []
  668. self.ui.keyboard.allNotesOff()
  669. def setParameterValue(self, parameterId, value):
  670. for paramItem in self.fParametersToUpdate:
  671. if paramItem[0] == parameterId:
  672. paramItem[1] = value
  673. break
  674. else:
  675. self.fParametersToUpdate.append([parameterId, value])
  676. def setParameterDefault(self, parameterId, value):
  677. for paramType, paramId, paramWidget in self.fParameterList:
  678. if paramId == parameterId:
  679. paramWidget.setDefault(value)
  680. break
  681. def setParameterMidiControl(self, parameterId, control):
  682. for paramType, paramId, paramWidget in self.fParameterList:
  683. if paramId == parameterId:
  684. paramWidget.setMidiControl(control)
  685. break
  686. def setParameterMidiChannel(self, parameterId, channel):
  687. for paramType, paramId, paramWidget in self.fParameterList:
  688. if paramId == parameterId:
  689. paramWidget.setMidiChannel(channel+1)
  690. break
  691. def setProgram(self, index):
  692. self.ui.cb_programs.blockSignals(True)
  693. self.ui.cb_programs.setCurrentIndex(index)
  694. self.ui.cb_programs.blockSignals(False)
  695. def setMidiProgram(self, index):
  696. self.ui.cb_midi_programs.blockSignals(True)
  697. self.ui.cb_midi_programs.setCurrentIndex(index)
  698. self.ui.cb_midi_programs.blockSignals(False)
  699. def sendNoteOn(self, channel, note):
  700. if self.fControlChannel == channel:
  701. self.ui.keyboard.sendNoteOn(note, False)
  702. if len(self.fPlayingNotes) == 0 and self.fRealParent:
  703. self.fRealParent.ui.led_midi.setChecked(True)
  704. playItem = (channel, note)
  705. if playItem not in self.fPlayingNotes:
  706. self.fPlayingNotes.append(playItem)
  707. def sendNoteOff(self, channel, note):
  708. if self.fControlChannel == channel:
  709. self.ui.keyboard.sendNoteOff(note, False)
  710. if len(self.fPlayingNotes) == 1 and self.fRealParent:
  711. self.fRealParent.ui.led_midi.setChecked(False)
  712. playItem = (channel, note)
  713. if playItem in self.fPlayingNotes:
  714. self.fPlayingNotes.remove(playItem)
  715. def setVisible(self, yesNo):
  716. if yesNo:
  717. if not self.fGeometry.isNull():
  718. self.restoreGeometry(self.fGeometry)
  719. else:
  720. self.fGeometry = self.saveGeometry()
  721. QDialog.setVisible(self, yesNo)
  722. def idleSlow(self):
  723. # Check Tab icons
  724. for i in range(len(self.fTabIconTimers)):
  725. if self.fTabIconTimers[i] == ICON_STATE_ON:
  726. self.fTabIconTimers[i] = ICON_STATE_WAIT
  727. elif self.fTabIconTimers[i] == ICON_STATE_WAIT:
  728. self.fTabIconTimers[i] = ICON_STATE_OFF
  729. elif self.fTabIconTimers[i] == ICON_STATE_OFF:
  730. self.fTabIconTimers[i] = ICON_STATE_NULL
  731. self.ui.tabWidget.setTabIcon(i+1, self.fTabIconOff)
  732. # Check parameters needing update
  733. for index, value in self.fParametersToUpdate:
  734. if index == PARAMETER_DRYWET:
  735. self.ui.dial_drywet.blockSignals(True)
  736. self.ui.dial_drywet.setValue(value * 1000)
  737. self.ui.dial_drywet.blockSignals(False)
  738. elif index == PARAMETER_VOLUME:
  739. self.ui.dial_vol.blockSignals(True)
  740. self.ui.dial_vol.setValue(value * 1000)
  741. self.ui.dial_vol.blockSignals(False)
  742. elif index == PARAMETER_BALANCE_LEFT:
  743. self.ui.dial_b_left.blockSignals(True)
  744. self.ui.dial_b_left.setValue(value * 1000)
  745. self.ui.dial_b_left.blockSignals(False)
  746. elif index == PARAMETER_BALANCE_RIGHT:
  747. self.ui.dial_b_right.blockSignals(True)
  748. self.ui.dial_b_right.setValue(value * 1000)
  749. self.ui.dial_b_right.blockSignals(False)
  750. #elif index == PARAMETER_PANNING:
  751. #self.ui.dial_pan.blockSignals(True)
  752. #self.ui.dial_pan.setValue(value * 1000, True, False)
  753. #self.ui.dial_pan.blockSignals(False)
  754. elif index == PARAMETER_CTRL_CHANNEL:
  755. self.fControlChannel = int(value)
  756. self.ui.sb_ctrl_channel.blockSignals(True)
  757. self.ui.sb_ctrl_channel.setValue(self.fControlChannel+1)
  758. self.ui.sb_ctrl_channel.blockSignals(False)
  759. self.ui.keyboard.allNotesOff()
  760. self._updateCtrlMidiProgram()
  761. elif index >= 0:
  762. for paramType, paramId, paramWidget in self.fParameterList:
  763. if paramId != index:
  764. continue
  765. paramWidget.setValue(value, False)
  766. if paramType == PARAMETER_INPUT:
  767. tabIndex = paramWidget.tabIndex()
  768. if self.fTabIconTimers[tabIndex-1] == ICON_STATE_NULL:
  769. self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOn)
  770. self.fTabIconTimers[tabIndex-1] = ICON_STATE_ON
  771. break
  772. # Clear all parameters
  773. self.fParametersToUpdate = []
  774. # Update parameter outputs
  775. for paramType, paramId, paramWidget in self.fParameterList:
  776. if paramType == PARAMETER_OUTPUT:
  777. value = Carla.host.get_current_parameter_value(self.fPluginId, paramId)
  778. paramWidget.setValue(value, False)
  779. @pyqtSlot()
  780. def slot_stateSave(self):
  781. if self.fPluginInfo['type'] == PLUGIN_LV2:
  782. # TODO
  783. return
  784. if self.fCurrentStateFilename:
  785. askTry = QMessageBox.question(self, self.tr("Overwrite?"), self.tr("Overwrite previously created file?"), QMessageBox.Ok|QMessageBox.Cancel)
  786. if askTry == QMessageBox.Ok:
  787. Carla.host.save_plugin_state(self.fPluginId, self.fCurrentStateFilename)
  788. return
  789. self.fCurrentStateFilename = None
  790. fileFilter = self.tr("Carla State File (*.carxs)")
  791. filenameTry = QFileDialog.getSaveFileName(self, self.tr("Save Plugin State File"), filter=fileFilter)
  792. if filenameTry:
  793. if not filenameTry.lower().endswith(".carxs"):
  794. filenameTry += ".carxs"
  795. self.fCurrentStateFilename = filenameTry
  796. Carla.host.save_plugin_state(self.fPluginId, self.fCurrentStateFilename)
  797. @pyqtSlot()
  798. def slot_stateLoad(self):
  799. if self.fPluginInfo['type'] == PLUGIN_LV2:
  800. presetList = []
  801. for i in range(Carla.host.get_program_count(self.fPluginId)):
  802. presetList.append("%03i - %s" % (i+1, cString(Carla.host.get_program_name(self.fPluginId, i))))
  803. ret = QInputDialog.getItem(self, self.tr("Open LV2 Preset"), self.tr("Select an LV2 Preset:"), presetList, 0, False)
  804. if ret[1]:
  805. index = int(ret[0].split(" - ", 1)[0])-1
  806. Carla.host.set_midi_program(self.fPluginId, -1)
  807. Carla.host.set_program(self.fPluginId, index)
  808. self.setMidiProgram(-1)
  809. return
  810. fileFilter = self.tr("Carla State File (*.carxs)")
  811. filenameTry = QFileDialog.getOpenFileName(self, self.tr("Open Plugin State File"), filter=fileFilter)
  812. if filenameTry:
  813. self.fCurrentStateFilename = filenameTry
  814. Carla.host.load_plugin_state(self.fPluginId, self.fCurrentStateFilename)
  815. @pyqtSlot(bool)
  816. def slot_optionChanged(self, clicked):
  817. sender = self.sender()
  818. if sender == self.ui.ch_fixed_buffer:
  819. option = PLUGIN_OPTION_FIXED_BUFFER
  820. elif sender == self.ui.ch_force_stereo:
  821. option = PLUGIN_OPTION_FORCE_STEREO
  822. elif sender == self.ui.ch_map_program_changes:
  823. option = PLUGIN_OPTION_MAP_PROGRAM_CHANGES
  824. elif sender == self.ui.ch_use_chunks:
  825. option = PLUGIN_OPTION_USE_CHUNKS
  826. elif sender == self.ui.ch_send_control_changes:
  827. option = PLUGIN_OPTION_SEND_CONTROL_CHANGES
  828. elif sender == self.ui.ch_send_channel_pressure:
  829. option = PLUGIN_OPTION_SEND_CHANNEL_PRESSURE
  830. elif sender == self.ui.ch_send_note_aftertouch:
  831. option = PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH
  832. elif sender == self.ui.ch_send_pitchbend:
  833. option = PLUGIN_OPTION_SEND_PITCHBEND
  834. elif sender == self.ui.ch_send_all_sound_off:
  835. option = PLUGIN_OPTION_SEND_ALL_SOUND_OFF
  836. else:
  837. return
  838. Carla.host.set_option(self.fPluginId, option, clicked)
  839. @pyqtSlot(int)
  840. def slot_dryWetChanged(self, value):
  841. Carla.host.set_drywet(self.fPluginId, float(value)/1000)
  842. @pyqtSlot(int)
  843. def slot_volumeChanged(self, value):
  844. Carla.host.set_volume(self.fPluginId, float(value)/1000)
  845. @pyqtSlot(int)
  846. def slot_balanceLeftChanged(self, value):
  847. Carla.host.set_balance_left(self.fPluginId, float(value)/1000)
  848. @pyqtSlot(int)
  849. def slot_balanceRightChanged(self, value):
  850. Carla.host.set_balance_right(self.fPluginId, float(value)/1000)
  851. @pyqtSlot(int)
  852. def slot_panningChanged(self, value):
  853. Carla.host.set_panning(self.fPluginId, float(value)/1000)
  854. @pyqtSlot(int)
  855. def slot_ctrlChannelChanged(self, value):
  856. self.fControlChannel = value-1
  857. Carla.host.set_ctrl_channel(self.fPluginId, self.fControlChannel)
  858. self.ui.keyboard.allNotesOff()
  859. self._updateCtrlMidiProgram()
  860. @pyqtSlot(int, float)
  861. def slot_parameterValueChanged(self, parameterId, value):
  862. Carla.host.set_parameter_value(self.fPluginId, parameterId, value)
  863. @pyqtSlot(int, int)
  864. def slot_parameterMidiControlChanged(self, parameterId, control):
  865. Carla.host.set_parameter_midi_cc(self.fPluginId, parameterId, control)
  866. @pyqtSlot(int, int)
  867. def slot_parameterMidiChannelChanged(self, parameterId, channel):
  868. Carla.host.set_parameter_midi_channel(self.fPluginId, parameterId, channel-1)
  869. @pyqtSlot(int)
  870. def slot_programIndexChanged(self, index):
  871. self.fCurrentProgram = index
  872. Carla.host.set_program(self.fPluginId, index)
  873. @pyqtSlot(int)
  874. def slot_midiProgramIndexChanged(self, index):
  875. self.fCurrentMidiProgram = index
  876. Carla.host.set_midi_program(self.fPluginId, index)
  877. @pyqtSlot(int)
  878. def slot_noteOn(self, note):
  879. if self.fControlChannel >= 0:
  880. Carla.host.send_midi_note(self.fPluginId, self.fControlChannel, note, 100)
  881. @pyqtSlot(int)
  882. def slot_noteOff(self, note):
  883. if self.fControlChannel >= 0:
  884. Carla.host.send_midi_note(self.fPluginId, self.fControlChannel, note, 0)
  885. @pyqtSlot()
  886. def slot_finished(self):
  887. if self.fRealParent:
  888. self.fRealParent.editClosed()
  889. @pyqtSlot()
  890. def slot_knobCustomMenu(self):
  891. dialName = self.sender().objectName()
  892. if dialName == "dial_drywet":
  893. minimum = 0
  894. maximum = 100
  895. default = 100
  896. label = "Dry/Wet"
  897. elif dialName == "dial_vol":
  898. minimum = 0
  899. maximum = 127
  900. default = 100
  901. label = "Volume"
  902. elif dialName == "dial_b_left":
  903. minimum = -100
  904. maximum = 100
  905. default = -100
  906. label = "Balance-Left"
  907. elif dialName == "dial_b_right":
  908. minimum = -100
  909. maximum = 100
  910. default = 100
  911. label = "Balance-Right"
  912. elif dialName == "dial_panning":
  913. minimum = -100
  914. maximum = 100
  915. default = 0
  916. label = "Panning"
  917. else:
  918. minimum = 0
  919. maximum = 100
  920. default = 100
  921. label = "Unknown"
  922. current = self.sender().value() / 10
  923. menu = QMenu(self)
  924. actReset = menu.addAction(self.tr("Reset (%i%%)" % default))
  925. menu.addSeparator()
  926. actMinimum = menu.addAction(self.tr("Set to Minimum (%i%%)" % minimum))
  927. actCenter = menu.addAction(self.tr("Set to Center"))
  928. actMaximum = menu.addAction(self.tr("Set to Maximum (%i%%)" % maximum))
  929. menu.addSeparator()
  930. actSet = menu.addAction(self.tr("Set value..."))
  931. if label not in ("Balance-Left", "Balance-Right"):
  932. menu.removeAction(actCenter)
  933. actSelected = menu.exec_(QCursor.pos())
  934. if actSelected == actSet:
  935. valueTry = QInputDialog.getInteger(self, self.tr("Set value"), label, current, minimum, maximum, 1)
  936. if valueTry[1]:
  937. value = valueTry[0] * 10
  938. else:
  939. return
  940. elif actSelected == actMinimum:
  941. value = minimum * 10
  942. elif actSelected == actMaximum:
  943. value = maximum * 10
  944. elif actSelected == actReset:
  945. value = default * 10
  946. elif actSelected == actCenter:
  947. value = 0
  948. else:
  949. return
  950. if label == "Dry/Wet":
  951. self.ui.dial_drywet.setValue(value)
  952. elif label == "Volume":
  953. self.ui.dial_vol.setValue(value)
  954. elif label == "Balance-Left":
  955. self.ui.dial_b_left.setValue(value)
  956. elif label == "Balance-Right":
  957. self.ui.dial_b_right.setValue(value)
  958. #elif label == "Panning":
  959. #self.ui.dial_panning.setValue(value)
  960. @pyqtSlot()
  961. def slot_channelCustomMenu(self):
  962. menu = QMenu(self)
  963. actNone = menu.addAction(self.tr("None"))
  964. if self.fControlChannel+1 == 0:
  965. actNone.setCheckable(True)
  966. actNone.setChecked(True)
  967. for i in range(1, 16+1):
  968. action = menu.addAction("%i" % i)
  969. if self.fControlChannel+1 == i:
  970. action.setCheckable(True)
  971. action.setChecked(True)
  972. actSel = menu.exec_(QCursor.pos())
  973. if not actSel:
  974. pass
  975. elif actSel == actNone:
  976. self.ui.sb_ctrl_channel.setValue(0)
  977. elif actSel:
  978. selChannel = int(actSel.text())
  979. self.ui.sb_ctrl_channel.setValue(selChannel)
  980. def _createParameterWidgets(self, paramType, paramListFull, tabPageName):
  981. i = 1
  982. for paramList, width in paramListFull:
  983. if len(paramList) == 0:
  984. break
  985. tabIndex = self.ui.tabWidget.count()
  986. tabPageContainer = QWidget(self.ui.tabWidget)
  987. tabPageLayout = QVBoxLayout(tabPageContainer)
  988. tabPageContainer.setLayout(tabPageLayout)
  989. for paramInfo in paramList:
  990. paramWidget = PluginParameter(tabPageContainer, paramInfo, self.fPluginId, tabIndex)
  991. paramWidget.setLabelWidth(width)
  992. tabPageLayout.addWidget(paramWidget)
  993. self.fParameterList.append((paramType, paramInfo['index'], paramWidget))
  994. if paramType == PARAMETER_INPUT:
  995. paramWidget.valueChanged.connect(self.slot_parameterValueChanged)
  996. paramWidget.midiControlChanged.connect(self.slot_parameterMidiControlChanged)
  997. paramWidget.midiChannelChanged.connect(self.slot_parameterMidiChannelChanged)
  998. tabPageLayout.addStretch()
  999. self.ui.tabWidget.addTab(tabPageContainer, "%s (%i)" % (tabPageName, i))
  1000. i += 1
  1001. if paramType == PARAMETER_INPUT:
  1002. self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOff)
  1003. self.fTabIconTimers.append(ICON_STATE_NULL)
  1004. def _updateCtrlMidiProgram(self):
  1005. if self.fPluginInfo['type'] not in (PLUGIN_INTERNAL, PLUGIN_SF2):
  1006. return
  1007. elif not self.fPluginInfo['hints'] & PLUGIN_IS_SYNTH:
  1008. return
  1009. if self.fControlChannel < 0:
  1010. self.ui.cb_midi_programs.setEnabled(False)
  1011. return
  1012. self.ui.cb_midi_programs.setEnabled(True)
  1013. mpIndex = Carla.host.get_current_midi_program_index(self.fPluginId)
  1014. if self.ui.cb_midi_programs.currentIndex() != mpIndex:
  1015. self.setMidiProgram(mpIndex)
  1016. def showEvent(self, event):
  1017. if not self.fScrollAreaSetup:
  1018. self.fScrollAreaSetup = True
  1019. minHeight = self.ui.scrollArea.height()+2
  1020. self.ui.scrollArea.setMinimumHeight(minHeight)
  1021. self.ui.scrollArea.setMaximumHeight(minHeight)
  1022. QDialog.showEvent(self, event)
  1023. def done(self, r):
  1024. QDialog.done(self, r)
  1025. self.close()
  1026. # ------------------------------------------------------------------------------------------------------------
  1027. # Plugin Widget
  1028. class PluginWidget(QFrame):
  1029. def __init__(self, parent, pluginId):
  1030. QFrame.__init__(self, parent)
  1031. self.ui = ui_carla_plugin.Ui_PluginWidget()
  1032. self.ui.setupUi(self)
  1033. # -------------------------------------------------------------
  1034. # Internal stuff
  1035. self.fPluginId = pluginId
  1036. self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId) if Carla.host is not None else gFakePluginInfo
  1037. self.fPluginInfo['binary'] = cString(self.fPluginInfo['binary'])
  1038. self.fPluginInfo['name'] = cString(self.fPluginInfo['name'])
  1039. self.fPluginInfo['label'] = cString(self.fPluginInfo['label'])
  1040. self.fPluginInfo['maker'] = cString(self.fPluginInfo['maker'])
  1041. self.fPluginInfo['copyright'] = cString(self.fPluginInfo['copyright'])
  1042. self.fPluginInfo['iconName'] = cString(self.fPluginInfo['iconName'])
  1043. if not Carla.isLocal:
  1044. self.fPluginInfo['hints'] &= ~PLUGIN_HAS_GUI
  1045. self.fLastGreenLedState = False
  1046. self.fLastBlueLedState = False
  1047. self.fParameterIconTimer = ICON_STATE_NULL
  1048. if Carla.processMode == PROCESS_MODE_CONTINUOUS_RACK or Carla.host is None:
  1049. self.fPeaksInputCount = 2
  1050. self.fPeaksOutputCount = 2
  1051. else:
  1052. audioCountInfo = Carla.host.get_audio_port_count_info(self.fPluginId)
  1053. self.fPeaksInputCount = int(audioCountInfo['ins'])
  1054. self.fPeaksOutputCount = int(audioCountInfo['outs'])
  1055. if self.fPeaksInputCount > 2:
  1056. self.fPeaksInputCount = 2
  1057. if self.fPeaksOutputCount > 2:
  1058. self.fPeaksOutputCount = 2
  1059. if self.palette().window().color().lightness() > 100:
  1060. # Light background
  1061. labelColor = "333"
  1062. isLight = True
  1063. self.fColorTop = QColor(60, 60, 60)
  1064. self.fColorBottom = QColor(47, 47, 47)
  1065. self.fColorSeprtr = QColor(70, 70, 70)
  1066. else:
  1067. # Dark background
  1068. labelColor = "BBB"
  1069. isLight = False
  1070. self.fColorTop = QColor(60, 60, 60)
  1071. self.fColorBottom = QColor(47, 47, 47)
  1072. self.fColorSeprtr = QColor(70, 70, 70)
  1073. # -------------------------------------------------------------
  1074. # Set-up GUI
  1075. self.setStyleSheet("""
  1076. QLabel#label_name {
  1077. color: #%s;
  1078. }""" % labelColor)
  1079. if isLight:
  1080. self.ui.b_enable.setPixmaps(":/bitmaps/button_off2.png", ":/bitmaps/button_on2.png", ":/bitmaps/button_off2.png")
  1081. self.ui.b_edit.setPixmaps(":/bitmaps/button_edit2.png", ":/bitmaps/button_edit_down2.png", ":/bitmaps/button_edit_hover2.png")
  1082. if self.fPluginInfo['iconName'] == "distrho":
  1083. self.ui.b_gui.setPixmaps(":/bitmaps/button_distrho2.png", ":/bitmaps/button_distrho_down2.png", ":/bitmaps/button_distrho_hover2.png")
  1084. elif self.fPluginInfo['iconName'] == "file":
  1085. self.ui.b_gui.setPixmaps(":/bitmaps/button_file2.png", ":/bitmaps/button_file_down2.png", ":/bitmaps/button_file_hover2.png")
  1086. else:
  1087. self.ui.b_gui.setPixmaps(":/bitmaps/button_gui2.png", ":/bitmaps/button_gui_down2.png", ":/bitmaps/button_gui_hover2.png")
  1088. else:
  1089. self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png")
  1090. self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png")
  1091. if self.fPluginInfo['iconName'] == "distrho":
  1092. self.ui.b_gui.setPixmaps(":/bitmaps/button_distrho.png", ":/bitmaps/button_distrho_down.png", ":/bitmaps/button_distrho_hover.png")
  1093. elif self.fPluginInfo['iconName'] == "file":
  1094. self.ui.b_gui.setPixmaps(":/bitmaps/button_file.png", ":/bitmaps/button_file_down.png", ":/bitmaps/button_file_hover.png")
  1095. else:
  1096. self.ui.b_gui.setPixmaps(":/bitmaps/button_gui.png", ":/bitmaps/button_gui_down.png", ":/bitmaps/button_gui_hover.png")
  1097. self.ui.led_control.setColor(self.ui.led_control.YELLOW)
  1098. self.ui.led_control.setEnabled(False)
  1099. self.ui.led_midi.setColor(self.ui.led_midi.RED)
  1100. self.ui.led_midi.setEnabled(False)
  1101. self.ui.led_audio_in.setColor(self.ui.led_audio_in.GREEN)
  1102. self.ui.led_audio_in.setEnabled(False)
  1103. self.ui.led_audio_out.setColor(self.ui.led_audio_out.BLUE)
  1104. self.ui.led_audio_out.setEnabled(False)
  1105. self.ui.peak_in.setColor(self.ui.peak_in.GREEN)
  1106. self.ui.peak_in.setChannels(self.fPeaksInputCount)
  1107. self.ui.peak_in.setOrientation(self.ui.peak_in.HORIZONTAL)
  1108. self.ui.peak_out.setColor(self.ui.peak_in.BLUE)
  1109. self.ui.peak_out.setChannels(self.fPeaksOutputCount)
  1110. self.ui.peak_out.setOrientation(self.ui.peak_out.HORIZONTAL)
  1111. self.ui.label_name.setText(self.fPluginInfo['name'])
  1112. self.ui.edit_dialog = PluginEdit(self, self.fPluginId)
  1113. self.ui.edit_dialog.hide()
  1114. self.setMinimumHeight(32)
  1115. self.setMaximumHeight(32)
  1116. # -------------------------------------------------------------
  1117. # Set-up connections
  1118. self.customContextMenuRequested.connect(self.slot_showCustomMenu)
  1119. self.ui.b_enable.clicked.connect(self.slot_enableClicked)
  1120. self.ui.b_gui.clicked.connect(self.slot_guiClicked)
  1121. self.ui.b_edit.clicked.connect(self.slot_editClicked)
  1122. # -------------------------------------------------------------
  1123. def idleFast(self):
  1124. # Input peaks
  1125. if self.fPeaksInputCount > 0:
  1126. if self.fPeaksInputCount > 1:
  1127. peak1 = Carla.host.get_input_peak_value(self.fPluginId, 1)
  1128. peak2 = Carla.host.get_input_peak_value(self.fPluginId, 2)
  1129. ledState = bool(peak1 != 0.0 or peak2 != 0.0)
  1130. self.ui.peak_in.displayMeter(1, peak1)
  1131. self.ui.peak_in.displayMeter(2, peak2)
  1132. else:
  1133. peak = Carla.host.get_input_peak_value(self.fPluginId, 1)
  1134. ledState = bool(peak != 0.0)
  1135. self.ui.peak_in.displayMeter(1, peak)
  1136. if self.fLastGreenLedState != ledState:
  1137. self.fLastGreenLedState = ledState
  1138. self.ui.led_audio_in.setChecked(ledState)
  1139. # Output peaks
  1140. if self.fPeaksOutputCount > 0:
  1141. if self.fPeaksOutputCount > 1:
  1142. peak1 = Carla.host.get_output_peak_value(self.fPluginId, 1)
  1143. peak2 = Carla.host.get_output_peak_value(self.fPluginId, 2)
  1144. ledState = bool(peak1 != 0.0 or peak2 != 0.0)
  1145. self.ui.peak_out.displayMeter(1, peak1)
  1146. self.ui.peak_out.displayMeter(2, peak2)
  1147. else:
  1148. peak = Carla.host.get_output_peak_value(self.fPluginId, 1)
  1149. ledState = bool(peak != 0.0)
  1150. self.ui.peak_out.displayMeter(1, peak)
  1151. if self.fLastBlueLedState != ledState:
  1152. self.fLastBlueLedState = ledState
  1153. self.ui.led_audio_out.setChecked(ledState)
  1154. def idleSlow(self):
  1155. # Parameter Activity LED
  1156. if self.fParameterIconTimer == ICON_STATE_ON:
  1157. self.fParameterIconTimer = ICON_STATE_WAIT
  1158. self.ui.led_control.setChecked(True)
  1159. elif self.fParameterIconTimer == ICON_STATE_WAIT:
  1160. self.fParameterIconTimer = ICON_STATE_OFF
  1161. elif self.fParameterIconTimer == ICON_STATE_OFF:
  1162. self.fParameterIconTimer = ICON_STATE_NULL
  1163. self.ui.led_control.setChecked(False)
  1164. # Update edit dialog
  1165. self.ui.edit_dialog.idleSlow()
  1166. def editClosed(self):
  1167. self.ui.b_edit.setChecked(False)
  1168. def recheckPluginHints(self, hints):
  1169. self.fPluginInfo['hints'] = hints
  1170. self.ui.b_gui.setEnabled(hints & PLUGIN_HAS_GUI)
  1171. def setActive(self, active, sendGui=False, sendCallback=True):
  1172. if sendGui: self.ui.b_enable.setChecked(active)
  1173. if sendCallback: Carla.host.set_active(self.fPluginId, active)
  1174. if active:
  1175. self.ui.edit_dialog.clearNotes()
  1176. self.ui.led_midi.setChecked(False)
  1177. def setParameterDefault(self, parameterId, value):
  1178. self.ui.edit_dialog.setParameterDefault(parameterId, value)
  1179. def setParameterValue(self, parameterId, value):
  1180. self.fParameterIconTimer = ICON_STATE_ON
  1181. if parameterId == PARAMETER_ACTIVE:
  1182. return self.setActive(bool(value), True, False)
  1183. self.ui.edit_dialog.setParameterValue(parameterId, value)
  1184. def setParameterMidiControl(self, parameterId, control):
  1185. self.ui.edit_dialog.setParameterMidiControl(parameterId, control)
  1186. def setParameterMidiChannel(self, parameterId, channel):
  1187. self.ui.edit_dialog.setParameterMidiChannel(parameterId, channel)
  1188. def setProgram(self, index):
  1189. self.fParameterIconTimer = ICON_STATE_ON
  1190. self.ui.edit_dialog.setProgram(index)
  1191. def setMidiProgram(self, index):
  1192. self.fParameterIconTimer = ICON_STATE_ON
  1193. self.ui.edit_dialog.setMidiProgram(index)
  1194. def sendNoteOn(self, channel, note):
  1195. self.ui.edit_dialog.sendNoteOn(channel, note)
  1196. def sendNoteOff(self, channel, note):
  1197. self.ui.edit_dialog.sendNoteOff(channel, note)
  1198. def setId(self, idx):
  1199. self.fPluginId = idx
  1200. self.ui.edit_dialog.fPluginId = idx
  1201. @pyqtSlot()
  1202. def slot_showCustomMenu(self):
  1203. menu = QMenu(self)
  1204. actActive = menu.addAction(self.tr("Disable") if self.ui.b_enable.isChecked() else self.tr("Enable"))
  1205. menu.addSeparator()
  1206. actGui = menu.addAction(self.tr("Show GUI"))
  1207. actGui.setCheckable(True)
  1208. actGui.setChecked(self.ui.b_gui.isChecked())
  1209. actGui.setEnabled(self.ui.b_gui.isEnabled())
  1210. actEdit = menu.addAction(self.tr("Edit"))
  1211. actEdit.setCheckable(True)
  1212. actEdit.setChecked(self.ui.b_edit.isChecked())
  1213. menu.addSeparator()
  1214. actClone = menu.addAction(self.tr("Clone"))
  1215. actRename = menu.addAction(self.tr("Rename..."))
  1216. actRemove = menu.addAction(self.tr("Remove"))
  1217. actSel = menu.exec_(QCursor.pos())
  1218. if not actSel:
  1219. return
  1220. if actSel == actActive:
  1221. self.setActive(not self.ui.b_enable.isChecked(), True, True)
  1222. elif actSel == actGui:
  1223. self.ui.b_gui.click()
  1224. elif actSel == actEdit:
  1225. self.ui.b_edit.click()
  1226. elif actSel == actClone:
  1227. if not Carla.host.clone_plugin(self.fPluginId):
  1228. CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
  1229. cString(Carla.host.get_last_error()), QMessageBox.Ok, QMessageBox.Ok)
  1230. elif actSel == actRename:
  1231. oldName = self.fPluginInfo['name']
  1232. newNameTry = QInputDialog.getText(self, self.tr("Rename Plugin"), self.tr("New plugin name:"), QLineEdit.Normal, oldName)
  1233. if not (newNameTry[1] and newNameTry[0] and oldName != newNameTry[0]):
  1234. return
  1235. newName = newNameTry[0]
  1236. if Carla.host is None or Carla.host.rename_plugin(self.fPluginId, newName):
  1237. self.fPluginInfo['name'] = newName
  1238. self.ui.edit_dialog.fPluginInfo['name'] = newName
  1239. self.ui.edit_dialog.reloadInfo()
  1240. self.ui.label_name.setText(newName)
  1241. else:
  1242. CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
  1243. cString(Carla.host.get_last_error()), QMessageBox.Ok, QMessageBox.Ok)
  1244. elif actSel == actRemove:
  1245. if not Carla.host.remove_plugin(self.fPluginId):
  1246. CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
  1247. cString(Carla.host.get_last_error()), QMessageBox.Ok, QMessageBox.Ok)
  1248. @pyqtSlot(bool)
  1249. def slot_enableClicked(self, yesNo):
  1250. self.setActive(yesNo, False, True)
  1251. @pyqtSlot(bool)
  1252. def slot_guiClicked(self, show):
  1253. Carla.host.show_gui(self.fPluginId, show)
  1254. @pyqtSlot(bool)
  1255. def slot_editClicked(self, show):
  1256. self.ui.edit_dialog.setVisible(show)
  1257. def paintEvent(self, event):
  1258. painter = QPainter(self)
  1259. painter.save()
  1260. areaX = self.ui.area_right.x()+7
  1261. painter.setPen(self.fColorSeprtr.lighter(110))
  1262. painter.setBrush(self.fColorBottom)
  1263. painter.setRenderHint(QPainter.Antialiasing, True)
  1264. # name -> leds arc
  1265. path = QPainterPath()
  1266. path.moveTo(areaX-20, self.height()-4)
  1267. path.cubicTo(areaX, self.height()-5, areaX-20, 4.75, areaX, 4.75)
  1268. path.lineTo(areaX, self.height()-5)
  1269. painter.drawPath(path)
  1270. painter.setPen(self.fColorSeprtr)
  1271. painter.setRenderHint(QPainter.Antialiasing, False)
  1272. # separator lines
  1273. painter.drawLine(0, self.height()-5, areaX-20, self.height()-5)
  1274. painter.drawLine(areaX, 4, self.width(), 4)
  1275. painter.setPen(self.fColorBottom)
  1276. painter.setBrush(self.fColorBottom)
  1277. # top, bottom and left lines
  1278. painter.drawLine(0, 0, self.width(), 0)
  1279. painter.drawRect(0, self.height()-4, areaX, 4)
  1280. painter.drawRoundedRect(areaX-20, self.height()-5, areaX, 5, 22, 22)
  1281. painter.drawLine(0, 0, 0, self.height())
  1282. # fill the rest
  1283. painter.drawRect(areaX-1, 5, self.width(), self.height())
  1284. # bottom 1px line
  1285. painter.setPen(self.fColorSeprtr)
  1286. painter.drawLine(0, self.height()-1, self.width(), self.height()-1)
  1287. painter.restore()
  1288. QFrame.paintEvent(self, event)
  1289. # ------------------------------------------------------------------------------------------------------------
  1290. # TESTING
  1291. hasGL = True
  1292. from PyQt5.QtWidgets import QApplication
  1293. app = QApplication(sys.argv)
  1294. #gui = PluginParameter(None, pInfo, 0, 0)
  1295. #gui = PluginEdit(None, 0)
  1296. gui = PluginWidget(None, 0)
  1297. gui.show()
  1298. app.exec_()