|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
-
- # Carla Native Plugins
- # Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
- #
- # This program is free software; you can redistribute it and/or
- # modify it under the terms of the GNU General Public License as
- # published by the Free Software Foundation; either version 2 of
- # the License, or any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # For a full copy of the GNU General Public License see the doc/GPL.txt file.
-
- # -----------------------------------------------------------------------
- # Imports (ExternalUI)
-
- from carla_style import CarlaApplication
- from externalui import ExternalUI
- from digitalpeakmeter import DigitalPeakMeter
-
- # -----------------------------------------------------------------------
- # External UI
-
- class DistrhoUIBigMeter(ExternalUI, DigitalPeakMeter):
- def __init__(self):
- ExternalUI.__init__(self)
- DigitalPeakMeter.__init__(self, None)
-
- channels = 2 #6 if argv[0].endswith("bigmeterM-ui") else 2
-
- self.setChannels(channels)
- self.setColor(self.GREEN)
- self.setOrientation(self.VERTICAL)
-
- #self.setSmoothRelease(0) # till 5
-
- self.resize(30, 400)
- self.setWindowTitle(self.fUiName)
-
- self.fIdleTimer = self.startTimer(30)
-
- self.showUiIfTesting()
-
- # -------------------------------------------------------------------
- # DSP Callbacks
-
- def d_parameterChanged(self, index, value):
- if index == 0:
- color = int(value)
-
- if color not in (self.GREEN, self.BLUE):
- return
-
- self.setColor(color)
-
- else:
- self.displayMeter(index, value)
-
- # -------------------------------------------------------------------
- # ExternalUI Callbacks
-
- def d_uiShow(self):
- self.show()
-
- def d_uiHide(self):
- self.hide()
-
- def d_uiQuit(self):
- self.close()
- app.quit()
-
- def d_uiTitleChanged(self, uiTitle):
- self.setWindowTitle(uiTitle)
-
- # -------------------------------------------------------------------
- # Qt events
-
- def timerEvent(self, event):
- if event.timerId() == self.fIdleTimer and not self.idleExternalUI():
- self.d_uiQuit()
- DigitalPeakMeter.timerEvent(self, event)
-
- def closeEvent(self, event):
- self.closeExternalUI()
- DigitalPeakMeter.closeEvent(self, event)
-
- #--------------- main ------------------
- if __name__ == '__main__':
- import resources_rc
- app = CarlaApplication("BigMeter")
- gui = DistrhoUIBigMeter()
- app.exit_exec()
|