root/branches/libffado-2.0/support/mixer-qt4/ffado-mixer.in

Revision 1394, 4.5 kB (checked in by ppalmers, 12 years ago)

rename all debug and mixer tools to start with ffado-*

  • Property svn:executable set to *
Line 
1 #!/usr/bin/python
2 #
3 # Copyright (C) 2005-2008 by Pieter Palmers
4 #               2007-2008 by Arnold Krille
5 #
6 # This file is part of FFADO
7 # FFADO = Free Firewire (pro-)audio drivers for linux
8 #
9 # FFADO is based upon FreeBoB.
10 #
11 # This program is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 #
24
25 #
26 # QT 4 version
27 #
28
29 import sys
30
31 # Add the path of the installed ffado-mixer-modules
32 sys.path.append( "$PYTHONDIR" )
33
34 from ffadomixer_config import POLL_SLEEP_TIME_MSEC, FFADO_DBUS_SERVER, FFADO_DBUS_BASEPATH
35
36 import os
37 import time
38
39 from PyQt4.QtCore import SIGNAL, SLOT, QObject, QTimer
40 from PyQt4.QtGui import QApplication, QMessageBox
41
42 from ffado_dbus_util import *
43
44 from ffado_panelmanager import PanelManager
45
46 if __name__ == "__main__":
47     #set up logging
48     import logging
49     logging.basicConfig()
50
51     if $DEBUG:
52         debug_level = logging.DEBUG
53     else:
54         debug_level = logging.INFO
55
56     logging.getLogger('main').setLevel(debug_level)
57     logging.getLogger('dbus').setLevel(debug_level)
58     logging.getLogger('registration').setLevel(debug_level)
59     logging.getLogger('panelmanager').setLevel(debug_level)
60
61     logging.getLogger('global').setLevel(debug_level)
62
63     logging.getLogger('audiofire').setLevel(debug_level)
64     logging.getLogger('bridgeco').setLevel(debug_level)
65     logging.getLogger('edirolfa101').setLevel(debug_level)
66     logging.getLogger('edirolfa66').setLevel(debug_level)
67     logging.getLogger('motu').setLevel(debug_level)
68     logging.getLogger('phase24').setLevel(debug_level)
69     logging.getLogger('phase88').setLevel(debug_level)
70     logging.getLogger('quatafire').setLevel(debug_level)
71     logging.getLogger('saffirebase').setLevel(debug_level)
72     logging.getLogger('saffire').setLevel(debug_level)
73     logging.getLogger('saffirepro').setLevel(debug_level)
74
75     log = logging.getLogger('main')
76
77     app = QApplication(sys.argv)
78
79     msg = QMessageBox()
80
81     repeat = 1
82     while repeat > 0:
83         try:
84             devmgr = DeviceManagerInterface(FFADO_DBUS_SERVER, FFADO_DBUS_BASEPATH)
85             nbDevices = devmgr.getNbDevices()
86             repeat -= 1
87         except dbus.DBusException, ex:
88             log.error("")
89             log.error("")
90             log.error("===========================================================")
91             log.error("ERROR: Could not communicate with the FFADO DBus service...")
92             log.error("===========================================================")
93             log.error("")
94             log.error("")
95             tmp = msg.question( msg, "FFADO-DBus not found", "<qt><b>The connection to FFADOs DBus service could not be established.</b><p>Probably you didn't start the ffado-dbus-server. Should I try this now?</qt>", QMessageBox.Yes, QMessageBox.No )
96             if tmp == QMessageBox.No:
97                 sys.exit(-1)
98             else:
99                 os.spawnlp( os.P_NOWAIT, "ffado-dbus-server" )
100                 nb_checks = 20
101                 while nb_checks > 0:
102                     nb_checks = nb_checks - 1
103                     try:
104                         devmgr = DeviceManagerInterface(FFADO_DBUS_SERVER, FFADO_DBUS_BASEPATH)
105                         nbDevices = devmgr.getNbDevices()
106                         nb_checks = 0
107                         repeat = 0
108                     except dbus.DBusException, ex:
109                         time.sleep( 1 )
110
111     manager = PanelManager(None, devmgr)
112
113     # create a timer to poll the panels
114     polltimer = QTimer()
115     QObject.connect( polltimer, SIGNAL('timeout()'), manager.pollPanels )
116     polltimer.start( POLL_SLEEP_TIME_MSEC )
117
118     # create a timer to initialize the panel after the main form is shown
119     # since initialization can take a while
120     showtimer = QTimer()
121     QObject.connect( showtimer, SIGNAL('timeout()'), manager.updatePanels )
122     showtimer.setSingleShot(True)
123     showtimer.start( POLL_SLEEP_TIME_MSEC )
124
125     # rock & roll
126     manager.show()
127     QObject.connect(app,SIGNAL("lastWindowClosed()"),app,SLOT("quit()"))
128     app.exec_()
Note: See TracBrowser for help on using the browser.