root/branches/libffado-2.0/support/mixer-qt4/mixer_global.py

Revision 1367, 2.9 kB (checked in by ppalmers, 15 years ago)

use the python logging framework for the mixer debug messages (QT4 only)

Line 
1 #
2 # Copyright (C) 2008 by Arnold Krille
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, QMessageBox
24 from mixer_globalui import Ui_GlobalMixerUi
25
26 import logging
27 log = logging.getLogger('global')
28
29 class GlobalMixer( QWidget, Ui_GlobalMixerUi ):
30     def __init__( self, parent ):
31         QWidget.__init__( self, parent )
32         self.setupUi(self)
33
34     def clockChanged( self, clock ):
35         #print "updateClockSource( " + str(clock) + " )"
36         self.clockselect.select( clock )
37         selected = self.clockselect.selected()
38
39         if selected != clock:
40             clockname = self.clockselect.getEnumLabel( clock )
41             msg = QMessageBox()
42             msg.question( msg, "Failed to select clock source", \
43                 "<qt>Could not select %s as clock source.</qt>" % clockname, \
44                 QMessageBox.Ok )
45             self.clocksource.setCurrentIndex( selected )
46
47     def samplerateChanged( self, sr ):
48         log.debug("samplerateChanged( " + str(sr) + " )")
49         self.samplerateselect.select( sr )
50         selected = self.samplerateselect.selected()
51
52         if selected != sr:
53             srname = self.samplerateselect.getEnumLabel( sr )
54             msg = QMessageBox()
55             msg.question( msg, "Failed to select sample rate", \
56                 "<qt>Could not select %s as samplerate.</qt>" % srname, \
57                 QMessageBox.Ok )
58             self.samplerate.setCurrentIndex( selected )
59
60     def nicknameChanged( self, name ):
61         #print "nicknameChanged( %s )" % name
62         asciiData = name.toAscii()
63         self.nickname.setText( asciiData.data() )
64
65     def initValues( self ):
66         #print "GlobalMixer::initValues()"
67         nb_clocks = self.clockselect.count()
68         for i in range( nb_clocks ):
69             self.clocksource.insertItem( nb_clocks, self.clockselect.getEnumLabel( i ) )
70         self.clocksource.setCurrentIndex( self.clockselect.selected() )
71        
72         nb_rates = self.samplerateselect.count()
73         for i in range( nb_rates ):
74             self.samplerate.insertItem( nb_rates, self.samplerateselect.getEnumLabel( i ) )
75         self.samplerate.setCurrentIndex( self.samplerateselect.selected() )
76
77         self.txtNickname.setText( self.nickname.text() )
78
Note: See TracBrowser for help on using the browser.