root/trunk/libffado/support/mixer-qt4/ffado/mixer/saffirepro.py

Revision 1640, 23.7 kB (checked in by arnonym, 12 years ago)

Make it more pythonic.

All ffado stuff is now in packages getting installed to the official python dirs. Ideally this would allow other apps to use the stuff from us.

Maybe the generic widgets (that are used by multiple mixers) should go into ffado/widgets...

  • Property svn:mergeinfo set to
Line 
1 #
2 # Copyright (C) 2005-2008 by Pieter Palmers
3 #
4 # This file is part of FFADO
5 # FFADO = Free Firewire (pro-)audio drivers for linux
6 #
7 # FFADO is based upon FreeBoB.
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 2 of the License, or
12 # (at your option) version 3 of the License.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 #
22
23 from PyQt4.QtGui import QWidget, QHBoxLayout, QMessageBox
24 from ffado.config import *
25 from ffado.mixer.saffire_base import SaffireMixerBase
26
27 import logging
28 log = logging.getLogger('saffirepro')
29
30 class SaffireProMixer(QWidget):
31     def __init__(self,parent = None):
32         QWidget.__init__(self, parent)
33
34         self.have_adat = False
35         self.samplerate = None
36         self.is_pro10 = None
37
38         # make a layout
39         self.layout = QHBoxLayout()
40         self.setLayout(self.layout)
41
42     def show(self):
43         self.selectCorrectMode()
44         QWidget.show(self)
45
46     def getDisplayTitle(self):
47         try:
48             return self.nickname.text()
49         except:
50             if self.is_pro10:
51                 return "SaffirePRO10"
52             else:
53                 return "SaffirePRO26"
54
55     def selectCorrectMode(self):
56         if self.samplerate <= 96000:
57             log.debug("large")
58             self.small.hide()
59             self.large.initValues()
60             self.large.show()
61         else:
62             log.debug("small")
63             self.large.hide()
64             self.small.initValues()
65             self.small.show()
66
67     def initValues(self):
68         self.is_not_streaming = self.samplerateselect.canChangeValue()
69         selected = self.samplerateselect.selected()
70         self.samplerate = int(self.samplerateselect.getEnumLabel( selected ))
71         log.debug("detected samplerate %d" % self.samplerate)
72
73         # adat on PRO26 makes a difference
74         modelId = self.configrom.getModelId()
75         if modelId == 0x00000003: # PRO26
76             self.is_pro10 = False
77             state = self.hw.getDiscrete('/Control/ADATDisable')
78             if state:
79                 self.have_adat = False
80                 log.debug("detected PRO26, ADAT disabled")
81             else:
82                 self.have_adat = True
83                 log.debug("detected PRO26, ADAT enabled")
84         elif modelId == 0x00000006: # PRO10
85             self.is_pro10 = True
86             self.have_adat = False
87
88         # create the child widgets
89         self.small = SaffireProMixerSmall(self)
90         self.layout.addWidget(self.small)
91         self.large = SaffireProMixerLarge(self)
92         self.layout.addWidget(self.large)
93
94         self.small.hw = self.hw
95         self.small.configrom = self.configrom
96
97         self.large.hw = self.hw
98         self.large.configrom = self.configrom
99
100         self.selectCorrectMode()
101
102     def polledUpdate(self):
103         self.is_not_streaming = self.samplerateselect.canChangeValue()
104         if self.samplerate <= 96000:
105             self.large.polledUpdate()
106         else:
107             self.small.polledUpdate()
108
109 class SaffireProMixerLarge(QWidget, SaffireMixerBase):
110     def __init__(self,parent = None):
111         self.my_parent = parent
112         QWidget.__init__(self,parent)
113         SaffireMixerBase.__init__(self)
114         uicLoad("ffado/mixer/saffirepro_large", self)
115         self.have_adat = False
116         log.debug("Init large Saffire Pro mixer window")
117
118         self.VolumeControls={
119             self.sldIMixAnalog1L: ['/Mixer/InputMix', 0, 0],
120             self.sldIMixAnalog1R: ['/Mixer/InputMix', 0, 1],
121             self.sldIMixAnalog2L: ['/Mixer/InputMix', 1, 0],
122             self.sldIMixAnalog2R: ['/Mixer/InputMix', 1, 1],
123             self.sldIMixAnalog3L: ['/Mixer/InputMix', 2, 0],
124             self.sldIMixAnalog3R: ['/Mixer/InputMix', 2, 1],
125             self.sldIMixAnalog4L: ['/Mixer/InputMix', 3, 0],
126             self.sldIMixAnalog4R: ['/Mixer/InputMix', 3, 1],
127             self.sldIMixAnalog5L: ['/Mixer/InputMix', 4, 0],
128             self.sldIMixAnalog5R: ['/Mixer/InputMix', 4, 1],
129             self.sldIMixAnalog6L: ['/Mixer/InputMix', 5, 0],
130             self.sldIMixAnalog6R: ['/Mixer/InputMix', 5, 1],
131             self.sldIMixAnalog7L: ['/Mixer/InputMix', 6, 0],
132             self.sldIMixAnalog7R: ['/Mixer/InputMix', 6, 1],
133             self.sldIMixAnalog8L: ['/Mixer/InputMix', 7, 0],
134             self.sldIMixAnalog8R: ['/Mixer/InputMix', 7, 1],
135             self.sldIMixAnalog9L: ['/Mixer/InputMix', 8, 0],
136             self.sldIMixAnalog9R: ['/Mixer/InputMix', 8, 1],
137             self.sldIMixAnalog10L: ['/Mixer/InputMix', 9, 0],
138             self.sldIMixAnalog10R: ['/Mixer/InputMix', 9, 1],
139             self.sldIMixADAT11L: ['/Mixer/InputMix', 10, 0],
140             self.sldIMixADAT11R: ['/Mixer/InputMix', 10, 1],
141             self.sldIMixADAT12L: ['/Mixer/InputMix', 11, 0],
142             self.sldIMixADAT12R: ['/Mixer/InputMix', 11, 1],
143             self.sldIMixADAT13L: ['/Mixer/InputMix', 12, 0],
144             self.sldIMixADAT13R: ['/Mixer/InputMix', 12, 1],
145             self.sldIMixADAT14L: ['/Mixer/InputMix', 13, 0],
146             self.sldIMixADAT14R: ['/Mixer/InputMix', 13, 1],
147             self.sldIMixADAT15L: ['/Mixer/InputMix', 14, 0],
148             self.sldIMixADAT15R: ['/Mixer/InputMix', 14, 1],
149             self.sldIMixADAT16L: ['/Mixer/InputMix', 15, 0],
150             self.sldIMixADAT16R: ['/Mixer/InputMix', 15, 1],
151             self.sldIMixADAT17L: ['/Mixer/InputMix', 16, 0],
152             self.sldIMixADAT17R: ['/Mixer/InputMix', 16, 1],
153             self.sldIMixADAT18L: ['/Mixer/InputMix', 17, 0],
154             self.sldIMixADAT18R: ['/Mixer/InputMix', 17, 1],
155             self.sldIMixADAT21L: ['/Mixer/InputMix', 18, 0],
156             self.sldIMixADAT21R: ['/Mixer/InputMix', 18, 1],
157             self.sldIMixADAT22L: ['/Mixer/InputMix', 19, 0],
158             self.sldIMixADAT22R: ['/Mixer/InputMix', 19, 1],
159             self.sldIMixADAT23L: ['/Mixer/InputMix', 20, 0],
160             self.sldIMixADAT23R: ['/Mixer/InputMix', 20, 1],
161             self.sldIMixADAT24L: ['/Mixer/InputMix', 21, 0],
162             self.sldIMixADAT24R: ['/Mixer/InputMix', 21, 1],
163             self.sldIMixADAT25L: ['/Mixer/InputMix', 22, 0],
164             self.sldIMixADAT25R: ['/Mixer/InputMix', 22, 1],
165             self.sldIMixADAT26L: ['/Mixer/InputMix', 23, 0],
166             self.sldIMixADAT26R: ['/Mixer/InputMix', 23, 1],
167             self.sldIMixADAT27L: ['/Mixer/InputMix', 24, 0],
168             self.sldIMixADAT27R: ['/Mixer/InputMix', 24, 1],
169             self.sldIMixADAT28L: ['/Mixer/InputMix', 25, 0],
170             self.sldIMixADAT28R: ['/Mixer/InputMix', 25, 1],
171            
172             self.sldOMixPC1O1: ['/Mixer/OutputMix', 0, 0],
173             self.sldOMixPC2O2: ['/Mixer/OutputMix', 1, 1],
174             self.sldOMixPC3O3: ['/Mixer/OutputMix', 2, 2],
175             self.sldOMixPC4O4: ['/Mixer/OutputMix', 3, 3],
176             self.sldOMixPC5O5: ['/Mixer/OutputMix', 4, 4],
177             self.sldOMixPC6O6: ['/Mixer/OutputMix', 5, 5],
178             self.sldOMixPC7O7: ['/Mixer/OutputMix', 6, 6],
179             self.sldOMixPC8O8: ['/Mixer/OutputMix', 7, 7],
180             self.sldOMixPC9O9: ['/Mixer/OutputMix', 8, 8],
181             self.sldOMixPC10O10: ['/Mixer/OutputMix', 9, 9],
182            
183             self.sldOMixPC1O3: ['/Mixer/OutputMix', 0, 2],
184             self.sldOMixPC2O4: ['/Mixer/OutputMix', 1, 3],
185             self.sldOMixPC1O5: ['/Mixer/OutputMix', 0, 4],
186             self.sldOMixPC2O6: ['/Mixer/OutputMix', 1, 5],
187             self.sldOMixPC1O7: ['/Mixer/OutputMix', 0, 6],
188             self.sldOMixPC2O8: ['/Mixer/OutputMix', 1, 7],
189             self.sldOMixPC1O9: ['/Mixer/OutputMix', 0, 8],
190             self.sldOMixPC2O10: ['/Mixer/OutputMix', 1, 9],
191            
192             self.sldOMixIMixO1: ['/Mixer/OutputMix', 10, 0],
193             self.sldOMixIMixO2: ['/Mixer/OutputMix', 11, 1],
194             self.sldOMixIMixO3: ['/Mixer/OutputMix', 10, 2],
195             self.sldOMixIMixO4: ['/Mixer/OutputMix', 11, 3],
196             self.sldOMixIMixO5: ['/Mixer/OutputMix', 10, 4],
197             self.sldOMixIMixO6: ['/Mixer/OutputMix', 11, 5],
198             self.sldOMixIMixO7: ['/Mixer/OutputMix', 10, 6],
199             self.sldOMixIMixO8: ['/Mixer/OutputMix', 11, 7],
200             self.sldOMixIMixO9: ['/Mixer/OutputMix', 10, 8],
201             self.sldOMixIMixO10: ['/Mixer/OutputMix', 11, 9],
202             }
203
204
205         self.SelectorControls={
206             # control elements
207             self.chkInsert1: ['/Control/Insert1'],
208             self.chkInsert2: ['/Control/Insert2'],
209             self.chkPhantom14: ['/Control/Phantom_1to4'],
210             self.chkPhantom58: ['/Control/Phantom_5to8'],
211             self.chkAC3: ['/Control/AC3pass'],
212             self.chkMidiThru: ['/Control/MidiTru'],
213             self.chkHighVoltage: ['/Control/UseHighVoltageRail'],
214             #self.chkEnableADAT1: ['/Control/EnableAdat1'],
215             #self.chkEnableADAT2: ['/Control/EnableAdat2'],
216             #self.chkEnableSPDIF1: ['/Control/EnableSPDIF1'],
217             self.chkMidiEnable: ['/Control/MIDIEnable'],
218             self.chkAdatDisable: ['/Control/ADATDisable'],
219             # Mixer switches
220             self.chkMute12: ['/Mixer/Out12Mute', [self.chkHwCtrl12]],
221             self.chkHwCtrl12: ['/Mixer/Out12HwCtrl'],
222             self.chkPad12: ['/Mixer/Out12Pad'],
223             self.chkDim12: ['/Mixer/Out12Dim'],
224             self.chkMute34: ['/Mixer/Out34Mute', [self.chkHwCtrl34]],
225             self.chkHwCtrl34: ['/Mixer/Out34HwCtrl'],
226             self.chkPad34: ['/Mixer/Out34Pad'],
227             self.chkDim34: ['/Mixer/Out34Dim'],
228             self.chkMute56: ['/Mixer/Out56Mute', [self.chkHwCtrl56]],
229             self.chkHwCtrl56: ['/Mixer/Out56HwCtrl'],
230             self.chkPad56: ['/Mixer/Out56Pad'],
231             self.chkDim56: ['/Mixer/Out56Dim'],
232             self.chkMute78: ['/Mixer/Out78Mute', [self.chkHwCtrl78]],
233             self.chkHwCtrl78: ['/Mixer/Out78HwCtrl'],
234             self.chkPad78: ['/Mixer/Out78Pad'],
235             self.chkDim78: ['/Mixer/Out78Dim'],
236             # direct monitoring
237             self.chkMonitor1: ['/Mixer/DirectMonitorCH1'],
238             self.chkMonitor2: ['/Mixer/DirectMonitorCH2'],
239             self.chkMonitor3: ['/Mixer/DirectMonitorCH3'],
240             self.chkMonitor4: ['/Mixer/DirectMonitorCH4'],
241             self.chkMonitor5: ['/Mixer/DirectMonitorCH5'],
242             self.chkMonitor6: ['/Mixer/DirectMonitorCH6'],
243             self.chkMonitor7: ['/Mixer/DirectMonitorCH7'],
244             self.chkMonitor8: ['/Mixer/DirectMonitorCH8'],
245         }
246
247         self.VolumeControlsLowRes={
248             self.sldOut12Level:      ['/Mixer/Out12Level'],
249             self.sldOut34Level:      ['/Mixer/Out34Level'],
250             self.sldOut56Level:      ['/Mixer/Out56Level'],
251             self.sldOut78Level:      ['/Mixer/Out78Level'],
252         }
253
254         self.TriggerButtonControls={
255             self.btnReboot:        ['/Control/Reboot'],
256             self.btnIdentify:      ['/Control/FlashLed'],
257             self.btnSaveSettings:  ['/Control/SaveSettings'],
258         }
259
260         self.TextControls={
261         }
262
263         self.saveTextControls={
264         }
265
266         self.ComboControls={
267             self.comboStandalone:        ['/Control/StandaloneConfig'],
268         }
269
270     def updateMatrixVolume(self,a0):
271         SaffireMixerBase.updateMatrixVolume(self,a0)
272     def updateLowResVolume(self,a0):
273         SaffireMixerBase.updateLowResVolume(self,a0)
274     def updateSelector(self,a0):
275         sender = self.sender()
276         #if sender == self.chkAC3 and not self.my_parent.is_not_streaming:
277             #msg = QMessageBox()
278             #msg.question( msg, "Error", \
279                 #"<qt>Change not permitted. Is streaming active?</qt>", \
280                 #QMessageBox.Ok )
281             #self.chkAC3.setEnabled(False)
282             #if a0:
283                 #self.chkAC3.setChecked(False)
284             #else:
285                 #self.chkAC3.setChecked(True)
286             #return
287         if sender == self.chkMidiEnable and not self.my_parent.is_not_streaming:
288             msg = QMessageBox()
289             msg.question( msg, "Error", \
290                 "<qt>Change not permitted. Is streaming active?</qt>", \
291                 QMessageBox.Ok )
292             self.chkMidiEnable.setEnabled(False)
293             state = self.hw.getDiscrete(self.SelectorControls[self.chkMidiEnable][0])
294             if state:
295                 self.chkMidiEnable.setChecked(True)
296             else:
297                 self.chkMidiEnable.setChecked(False)
298             return
299         if sender == self.chkAdatDisable and not self.my_parent.is_not_streaming:
300             msg = QMessageBox()
301             msg.question( msg, "Error", \
302                 "<qt>Change not permitted. Is streaming active?</qt>", \
303                 QMessageBox.Ok )
304             self.chkAdatDisable.setEnabled(False)
305             state = self.hw.getDiscrete(self.SelectorControls[self.chkAdatDisable][0])
306             if state:
307                 self.chkAdatDisable.setChecked(True)
308             else:
309                 self.chkAdatDisable.setChecked(False)
310             return
311         SaffireMixerBase.updateSelector(self,a0)
312
313     def triggerButton(self):
314         sender = self.sender()
315         if sender == self.btnReboot and not self.my_parent.is_not_streaming:
316             msg = QMessageBox()
317             msg.question( msg, "Error", \
318                 "<qt>Operation not permitted. Is streaming active?</qt>", \
319                 QMessageBox.Ok )
320             self.btnReboot.setEnabled(False)
321             return
322         SaffireMixerBase.triggerButton(self)
323
324     def saveText(self):
325         SaffireMixerBase.saveText(self)
326     def initCombo(self, combo):
327         SaffireMixerBase.initCombo(self,combo)
328     def selectCombo(self, mode):
329         SaffireMixerBase.selectCombo(self,mode)
330
331     def updateValues(self):
332         for i in range(self.tabInputMix.count()):
333             self.tabInputMix.setTabEnabled(i, True)
334
335         if not self.my_parent.have_adat:
336             for i in range(self.tabInputMix.count()):
337                 page = self.tabInputMix.widget(i)
338                 name = page.objectName()
339                 if name[0:4] == "adat":
340                     self.tabInputMix.setTabEnabled(i, False)
341                 else:
342                     self.tabInputMix.setTabEnabled(i, True)
343
344         self.tabInputMix.setCurrentWidget(self.tabInputMix.widget(0))
345         SaffireMixerBase.updateValues(self)
346
347     def polledUpdate(self):
348         #log.debug("polled update (large)")
349         self.polledUpdateHwCtrl(self.chkHwCtrl12, self.sldOut12Level)
350         self.polledUpdateHwCtrl(self.chkHwCtrl34, self.sldOut34Level)
351         self.polledUpdateHwCtrl(self.chkHwCtrl56, self.sldOut56Level)
352         self.polledUpdateHwCtrl(self.chkHwCtrl78, self.sldOut78Level)
353
354         #make these inaccessible whenever streaming is running
355         #self.chkAC3.setEnabled(self.my_parent.is_not_streaming)
356         self.chkMidiEnable.setEnabled(self.my_parent.is_not_streaming)
357         self.chkAdatDisable.setEnabled(self.my_parent.is_not_streaming)
358         self.btnReboot.setEnabled(self.my_parent.is_not_streaming)
359
360     def polledUpdateHwCtrl(self, selector, volctrl):
361         state = selector.isChecked()
362         if state:
363             self.polledUpdateVolumeLowRes('/Mixer/MonitorDial', volctrl, 2)
364             volctrl.setEnabled(False)
365         else:
366             volctrl.setEnabled(True)
367
368 class SaffireProMixerSmall(QWidget, SaffireMixerBase):
369     def __init__(self,parent = None):
370         self.my_parent = parent
371         QWidget.__init__(self,parent)
372         SaffireMixerBase.__init__(self)
373         uicLoad("ffado/mixer/saffirepro_small", self)
374         log.debug("Init small Saffire Pro mixer window")
375
376         self.VolumeControls={
377
378             self.sldOMixPC1O1: ['/Mixer/OutputMix', 0, 0],
379             self.sldOMixPC2O2: ['/Mixer/OutputMix', 1, 1],
380             self.sldOMixPC3O3: ['/Mixer/OutputMix', 2, 2],
381             self.sldOMixPC4O4: ['/Mixer/OutputMix', 3, 3],
382             self.sldOMixPC5O5: ['/Mixer/OutputMix', 4, 4],
383             self.sldOMixPC6O6: ['/Mixer/OutputMix', 5, 5],
384             self.sldOMixPC7O7: ['/Mixer/OutputMix', 6, 6],
385             self.sldOMixPC8O8: ['/Mixer/OutputMix', 7, 7],
386             self.sldOMixPC9O9: ['/Mixer/OutputMix', 8, 8],
387             self.sldOMixPC10O10: ['/Mixer/OutputMix', 9, 9],
388            
389             self.sldOMixPC1O3: ['/Mixer/OutputMix', 0, 2],
390             self.sldOMixPC2O4: ['/Mixer/OutputMix', 1, 3],
391             self.sldOMixPC1O5: ['/Mixer/OutputMix', 0, 4],
392             self.sldOMixPC2O6: ['/Mixer/OutputMix', 1, 5],
393             self.sldOMixPC1O7: ['/Mixer/OutputMix', 0, 6],
394             self.sldOMixPC2O8: ['/Mixer/OutputMix', 1, 7],
395             self.sldOMixPC1O9: ['/Mixer/OutputMix', 0, 8],
396             self.sldOMixPC2O10: ['/Mixer/OutputMix', 1, 9],
397            
398             self.sldOMixIMixO1: ['/Mixer/OutputMix', 10, 0],
399             self.sldOMixIMixO2: ['/Mixer/OutputMix', 11, 1],
400             self.sldOMixIMixO3: ['/Mixer/OutputMix', 10, 2],
401             self.sldOMixIMixO4: ['/Mixer/OutputMix', 11, 3],
402             self.sldOMixIMixO5: ['/Mixer/OutputMix', 10, 4],
403             self.sldOMixIMixO6: ['/Mixer/OutputMix', 11, 5],
404             self.sldOMixIMixO7: ['/Mixer/OutputMix', 10, 6],
405             self.sldOMixIMixO8: ['/Mixer/OutputMix', 11, 7],
406             self.sldOMixIMixO9: ['/Mixer/OutputMix', 10, 8],
407             self.sldOMixIMixO10: ['/Mixer/OutputMix', 11, 9],
408             }
409
410
411         self.SelectorControls={
412             # control elements
413             self.chkInsert1: ['/Control/Insert1'],
414             self.chkInsert2: ['/Control/Insert2'],
415             self.chkPhantom14: ['/Control/Phantom_1to4'],
416             self.chkPhantom58: ['/Control/Phantom_5to8'],
417             self.chkAC3: ['/Control/AC3pass'],
418             self.chkMidiThru: ['/Control/MidiTru'],
419             self.chkHighVoltage: ['/Control/UseHighVoltageRail'],
420             #self.chkEnableADAT1: ['/Control/EnableAdat1'],
421             #self.chkEnableADAT2: ['/Control/EnableAdat2'],
422             #self.chkEnableSPDIF1: ['/Control/EnableSPDIF1'],
423             self.chkMidiEnable: ['/Control/MIDIEnable'],
424             self.chkAdatDisable: ['/Control/ADATDisable'],
425             # Mixer switches
426             self.chkMute12: ['/Mixer/Out12Mute'],
427             self.chkHwCtrl12: ['/Mixer/Out12HwCtrl'],
428             self.chkPad12: ['/Mixer/Out12Pad'],
429             self.chkDim12: ['/Mixer/Out12Dim'],
430             self.chkMute34: ['/Mixer/Out34Mute'],
431             self.chkHwCtrl34: ['/Mixer/Out34HwCtrl'],
432             self.chkPad34: ['/Mixer/Out34Pad'],
433             self.chkDim34: ['/Mixer/Out34Dim'],
434             self.chkMute56: ['/Mixer/Out56Mute'],
435             self.chkHwCtrl56: ['/Mixer/Out56HwCtrl'],
436             self.chkPad56: ['/Mixer/Out56Pad'],
437             self.chkDim56: ['/Mixer/Out56Dim'],
438             self.chkMute78: ['/Mixer/Out78Mute'],
439             self.chkHwCtrl78: ['/Mixer/Out78HwCtrl'],
440             self.chkPad78: ['/Mixer/Out78Pad'],
441             self.chkDim78: ['/Mixer/Out78Dim'],
442             # direct monitoring
443             self.chkMonitor1: ['/Mixer/DirectMonitorCH1'],
444             self.chkMonitor2: ['/Mixer/DirectMonitorCH2'],
445             self.chkMonitor3: ['/Mixer/DirectMonitorCH3'],
446             self.chkMonitor4: ['/Mixer/DirectMonitorCH4'],
447             self.chkMonitor5: ['/Mixer/DirectMonitorCH5'],
448             self.chkMonitor6: ['/Mixer/DirectMonitorCH6'],
449             self.chkMonitor7: ['/Mixer/DirectMonitorCH7'],
450             self.chkMonitor8: ['/Mixer/DirectMonitorCH8'],
451         }
452
453         self.VolumeControlsLowRes={
454             self.sldOut12Level:      ['/Mixer/Out12Level'],
455             self.sldOut34Level:      ['/Mixer/Out34Level'],
456             self.sldOut56Level:      ['/Mixer/Out56Level'],
457             self.sldOut78Level:      ['/Mixer/Out78Level'],
458         }
459
460         self.TriggerButtonControls={
461             self.btnReboot:        ['/Control/Reboot'],
462             self.btnIdentify:      ['/Control/FlashLed'],
463             self.btnSaveSettings:  ['/Control/SaveSettings'],
464         }
465
466         self.TextControls={
467         }
468
469         self.saveTextControls={
470         }
471
472         self.ComboControls={
473             self.comboStandalone:        ['/Control/StandaloneConfig'],
474         }
475
476     def updateMatrixVolume(self,a0):
477         SaffireMixerBase.updateMatrixVolume(self,a0)
478     def updateLowResVolume(self,a0):
479         SaffireMixerBase.updateLowResVolume(self,a0)
480     def updateSelector(self,a0):
481         sender = self.sender()
482         #if sender == self.chkAC3 and not self.my_parent.is_not_streaming:
483             #msg = QMessageBox()
484             #msg.question( msg, "Error", \
485                 #"<qt>Change not permitted. Is streaming active?</qt>", \
486                 #QMessageBox.Ok )
487             #self.chkAC3.setEnabled(False)
488             #if a0:
489                 #self.chkAC3.setChecked(False)
490             #else:
491                 #self.chkAC3.setChecked(True)
492             #return
493         if sender == self.chkMidiEnable and not self.my_parent.is_not_streaming:
494             msg = QMessageBox()
495             msg.question( msg, "Error", \
496                 "<qt>Change not permitted. Is streaming active?</qt>", \
497                 QMessageBox.Ok )
498             self.chkMidiEnable.setEnabled(False)
499             state = self.hw.getDiscrete(self.SelectorControls[self.chkMidiEnable][0])
500             if state:
501                 self.chkMidiEnable.setChecked(True)
502             else:
503                 self.chkMidiEnable.setChecked(False)
504             return
505         if sender == self.chkAdatDisable and not self.my_parent.is_not_streaming:
506             msg = QMessageBox()
507             msg.question( msg, "Error", \
508                 "<qt>Change not permitted. Is streaming active?</qt>", \
509                 QMessageBox.Ok )
510             self.chkAdatDisable.setEnabled(False)
511             state = self.hw.getDiscrete(self.SelectorControls[self.chkAdatDisable][0])
512             if state:
513                 self.chkAdatDisable.setChecked(True)
514             else:
515                 self.chkAdatDisable.setChecked(False)
516             return
517         SaffireMixerBase.updateSelector(self,a0)
518
519     def triggerButton(self):
520         sender = self.sender()
521         if sender == self.btnReboot and not self.my_parent.is_not_streaming:
522             msg = QMessageBox()
523             msg.question( msg, "Error", \
524                 "<qt>Operation not permitted. Is streaming active?</qt>", \
525                 QMessageBox.Ok )
526             self.btnReboot.setEnabled(False)
527             return
528         SaffireMixerBase.triggerButton(self)
529
530     def saveText(self):
531         SaffireMixerBase.saveText(self)
532     def initCombo(self, combo):
533         SaffireMixerBase.initCombo(self,combo)
534     def selectCombo(self, mode):
535         SaffireMixerBase.selectCombo(self,mode)
536
537     def updateValues(self):
538         SaffireMixerBase.updateValues(self)
539
540     def polledUpdate(self):
541         #log.debug("polled update (small)")
542         self.polledUpdateHwCtrl(self.chkHwCtrl12, self.sldOut12Level)
543         self.polledUpdateHwCtrl(self.chkHwCtrl34, self.sldOut34Level)
544         self.polledUpdateHwCtrl(self.chkHwCtrl56, self.sldOut56Level)
545         self.polledUpdateHwCtrl(self.chkHwCtrl78, self.sldOut78Level)
546
547         #make these inaccessible whenever streaming is running
548         #self.chkAC3.setEnabled(self.my_parent.is_not_streaming)
549         self.chkMidiEnable.setEnabled(self.my_parent.is_not_streaming)
550         self.chkAdatDisable.setEnabled(self.my_parent.is_not_streaming)
551         self.btnReboot.setEnabled(self.my_parent.is_not_streaming)
552
553     def polledUpdateHwCtrl(self, selector, volctrl):
554         state = selector.isChecked()
555         if state:
556             self.polledUpdateVolumeLowRes('/Mixer/MonitorDial', volctrl, 2)
557             volctrl.setEnabled(False)
558         else:
559             volctrl.setEnabled(True)
560
561 # vim: et
Note: See TracBrowser for help on using the browser.