From: <tr...@ff...> - 2008-04-28 21:38:22
|
Author: arnonym Date: 2008-04-28 14:37:56 -0700 (Mon, 28 Apr 2008) New Revision: 1062 Modified: trunk/libffado/support/mixer/SConscript trunk/libffado/support/mixer/ffadomixer.in trunk/libffado/support/mixer/mixer_dummy.py trunk/libffado/support/mixer/mixer_dummy.ui Log: * Introduce a top-level QTabWidget that contains all the mixers. * If the specific mixer has now specialized gui, the dummy is shown instead. * The generic mixer is not installed anymore, if it is found (because ffadomixer is executed in that directory or because the files of the generic mixer aren't delete by hand), it will be added as well. PS: Seems to be a good commit +237 lines, -242 lines Modified: trunk/libffado/support/mixer/SConscript =================================================================== --- trunk/libffado/support/mixer/SConscript 2008-04-28 18:51:44 UTC (rev 1061) +++ trunk/libffado/support/mixer/SConscript 2008-04-28 21:37:56 UTC (rev 1062) @@ -31,8 +31,8 @@ e['MIXERAPPS'] = [ 'phase24', 'phase88', 'saffirepro', 'saffire', 'saffirele', 'af2', 'bcoaudio5', 'edirolfa66', - 'mackie_generic', 'quatafire', 'motu', - 'generic', 'dummy' + 'mackie_generic', 'quatafire', 'motu', + 'dummy' ] e['OTHERAPPS'] = ['ffado_regdialog'] Modified: trunk/libffado/support/mixer/ffadomixer.in =================================================================== --- trunk/libffado/support/mixer/ffadomixer.in 2008-04-28 18:51:44 UTC (rev 1061) +++ trunk/libffado/support/mixer/ffadomixer.in 2008-04-28 21:37:56 UTC (rev 1062) @@ -49,7 +49,13 @@ from mixer_motu import * from mixer_dummy import * -from mixer_generic import * +use_generic = False +try: + from mixer_generic import * +except ImportError: + print "Didn't find the generic-mixer" +else: + use_generic = True SupportedDevices=[ [(0x000aac, 0x00000003),'Phase88Control'], @@ -243,14 +249,20 @@ repeat = 0 except dbus.DBusException, ex: time.sleep( 1 ) - + nbDevices=devmgr.getNbDevices() - - forms=[]; + + if nbDevices == 0: + print "No supported device found..." + msg.information( msg, "No mixer found", "Your device doesn't seem to have a supported mixer." ) + sys.exit( -1 ) + + mw = QTabWidget() + for idx in range(nbDevices): path=devmgr.getDeviceName(idx) print "Found device %d: %s" % (idx, path) - + cfgrom = ConfigRomInterface(server, basepath+'/DeviceManager/'+path) vendorId = cfgrom.getVendorId() modelId = cfgrom.getModelId() @@ -272,12 +284,12 @@ # using. if vendorId == 0x1f2: thisdev=(vendorId, 0x00000000) - + found_panel = False for dev in SupportedDevices: if dev[0] == thisdev: mixerapp = dev[1] - + # hack for the focusrite devices # Saffire: 0x130e010001???? # SaffireLE: 0x130e010004???? @@ -287,35 +299,30 @@ else: mixerapp = "SaffireLEMixer" print mixerapp - exec('forms.append('+mixerapp+'())') - forms[idx].hw = ControlInterface(server, basepath+'/DeviceManager/'+path) - forms[idx].configrom = cfgrom - forms[idx].clockselect = ClockSelectInterface(server, basepath+'/DeviceManager/'+path) - forms[idx].initValues() - forms[idx].show() + exec('tmp = '+mixerapp+'( mw )') + mw.addTab( tmp, mixerapp ) + tmp.hw = ControlInterface(server, basepath+'/DeviceManager/'+path) + tmp.configrom = cfgrom + tmp.clockselect = ClockSelectInterface(server, basepath+'/DeviceManager/'+path) + tmp.initValues() + tmp.show() found_panel = True if not found_panel: - forms.append( DummyMixer( ) ) - forms[idx].hw = ControlInterface(server, basepath+'/DeviceManager/'+path) - forms[idx].configrom = cfgrom - forms[idx].clockselect = ClockSelectInterface(server, basepath+'/DeviceManager/'+path) - forms[idx].initValues() - forms[idx].show() + tmp = DummyMixer( mw ) + mw.addTab( tmp, modelName+" (Dummy)" ) + tmp.hw = ControlInterface(server, basepath+'/DeviceManager/'+path) + tmp.configrom = cfgrom + tmp.clockselect = ClockSelectInterface(server, basepath+'/DeviceManager/'+path) + tmp.initValues() + tmp.show() - # note: the generic mixer is disabled for now... - use_generic = False # !!! HACK !!! if nbDevices > 0 and use_generic: - forms.append( GenericMixer( devmgr.bus, server ) ) - forms[-1].show() + mw.addTab( GenericMixer( devmgr.bus, server, mw ), "Generic Mixer" ) - if forms: - # not setting this makes that the app doesn't quit when the first window is closed - #app.setMainWidget(forms[0]) + if mw.count() > 0: + mw.show() QObject.connect(app,SIGNAL("lastWindowClosed()"),app,SLOT("quit()")) app.exec_loop() - else: - print "No supported device found..." - msg.information( msg, "No mixer found", "Your device doesn't seem to have a supported mixer." ) Modified: trunk/libffado/support/mixer/mixer_dummy.py =================================================================== --- trunk/libffado/support/mixer/mixer_dummy.py 2008-04-28 18:51:44 UTC (rev 1061) +++ trunk/libffado/support/mixer/mixer_dummy.py 2008-04-28 21:37:56 UTC (rev 1062) @@ -25,7 +25,7 @@ class DummyMixer(DummyMixerUI): def __init__(self,parent = None,name = None,modal = 0,fl = 0): - DummyMixerUI.__init__(self,parent,name,modal,fl) + DummyMixerUI.__init__(self,parent,name,fl) def init(self): print "Init Dummy mixer window" Modified: trunk/libffado/support/mixer/mixer_dummy.ui =================================================================== --- trunk/libffado/support/mixer/mixer_dummy.ui 2008-04-28 18:51:44 UTC (rev 1061) +++ trunk/libffado/support/mixer/mixer_dummy.ui 2008-04-28 21:37:56 UTC (rev 1062) @@ -17,7 +17,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. </comment> -<widget class="QDialog"> +<widget class="QWidget"> <property name="name"> <cstring>DummyMixerUI</cstring> </property> @@ -25,56 +25,48 @@ <rect> <x>0</x> <y>0</y> - <width>220</width> - <height>221</height> + <width>309</width> + <height>290</height> </rect> </property> <property name="caption"> <string>Dummy Panel</string> </property> - <widget class="QLabel"> + <grid> <property name="name"> - <cstring>textLabel1</cstring> + <cstring>unnamed</cstring> </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>210</width> - <height>170</height> - </rect> - </property> - <property name="text"> - <string>This panel is merely a placeholder for devices that don't have a mixer panel yet.</string> - </property> - <property name="alignment"> - <set>WordBreak|AlignVCenter</set> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>pushButton1</cstring> - </property> - <property name="geometry"> - <rect> - <x>90</x> - <y>180</y> - <width>121</width> - <height>31</height> - </rect> - </property> - <property name="text"> - <string>Close</string> - </property> - </widget> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>This panel is merely a placeholder for devices that don't have a mixer panel yet.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> </widget> <connections> - <connection> - <sender>pushButton1</sender> - <signal>clicked()</signal> - <receiver>DummyMixerUI</receiver> - <slot>close()</slot> - </connection> </connections> <slots> <slot>setFB2(int)</slot> |