/usr/share/ffado-mixer-qt4/ffado/ffadowindow.py is in ffado-mixer-qt4 2.1.0+svn2240-1ubuntu3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | #!/usr/bin/python
#
# Copyright (C) 2005-2008 by Pieter Palmers
# 2007-2009 by Arnold Krille
#
# This file is part of FFADO
# FFADO = Free Firewire (pro-)audio drivers for linux
#
# FFADO is based upon FreeBoB.
#
# 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 3 of the License, or
# (at your option) 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import os
from ffado.config import *
import subprocess
from PyQt4.QtCore import SIGNAL, SLOT, QObject, QTimer, Qt
from PyQt4.QtGui import *
from ffado.dbus_util import *
from ffado.panelmanager import PanelManager
from ffado.logginghandler import *
"""Just a small helper to ask the retry-question without a blocking messagebox"""
class StartDialog(QWidget):
def __init__(self, parent):
QWidget.__init__(self, parent)
self.setObjectName("Restart Dialog")
self.label = QLabel("<qt>Somehow the connection to the dbus-service of FFADO couldn't be established.<p>\nShall we take another try?</qt>",self)
self.button = QPushButton("Retry", self)
self.layout = QGridLayout(self)
self.layout.setContentsMargins( 50, 10, 50, 10 )
self.layout.addWidget(self.label, 0, 0, Qt.AlignHCenter|Qt.AlignBottom)
self.layout.addWidget(self.button, 1, 0, Qt.AlignHCenter|Qt.AlignTop)
class FFADOWindow(QMainWindow):
def __init__(self, parent):
QMainWindow.__init__(self, parent)
self.textlogger = QTextLogger(self)
dock = QDockWidget("Log Messages",self)
dock.setWidget(self.textlogger.textedit)
logging.getLogger('').addHandler(self.textlogger)
self.addDockWidget(Qt.BottomDockWidgetArea, dock)
self.statuslogger = QStatusLogger(self, self.statusBar(), 20)
logging.getLogger('').addHandler(self.statuslogger)
self.manager = PanelManager(self)
self.connect(self.manager, SIGNAL("connectionLost"), self.connectToDBUS)
filemenu = self.menuBar().addMenu("File")
quitaction = QAction("Quit", self)
quitaction.setShortcut(self.tr("Ctrl+q"))
self.connect(quitaction, SIGNAL("triggered()"), self, SLOT("close()"))
filemenu.addAction(quitaction)
editmenu = self.menuBar().addMenu("Edit")
self.updateaction = QAction("Update Mixer Panels", self)
self.updateaction.setEnabled(False)
self.connect(self.updateaction, SIGNAL("triggered()"), self.manager.updatePanels)
editmenu.addAction(self.updateaction)
refreshaction = QAction("Refresh Current Panels", self)
self.connect(refreshaction, SIGNAL("triggered()"), self.manager.refreshPanels)
editmenu.addAction(refreshaction)
helpmenu = self.menuBar().addMenu( "Help" )
aboutaction = QAction( "About FFADO", self )
self.connect( aboutaction, SIGNAL( "triggered()" ), self.aboutFFADO )
helpmenu.addAction( aboutaction )
aboutqtaction = QAction( "About Qt", self )
self.connect( aboutqtaction, SIGNAL( "triggered()" ), qApp, SLOT( "aboutQt()" ) )
helpmenu.addAction( aboutqtaction )
log.info( "Starting up" )
QTimer.singleShot( 1, self.tryStartDBUSServer )
def __del__(self):
log.info("__del__")
del self.manager
log.info("__del__ finished")
def closeEvent(self, event):
log.info("closeEvent()")
event.accept()
def connectToDBUS(self):
log.info("connectToDBUS")
try:
self.setupDeviceManager()
except dbus.DBusException, ex:
log.error("Could not communicate with the FFADO DBus service...")
if not hasattr(self,"retry"):
self.retry = StartDialog(self)
self.connect(self.retry.button, SIGNAL("clicked()"), self.tryStartDBUSServer)
if hasattr(self, "retry"):
self.manager.setParent(None)
self.setCentralWidget(self.retry)
self.retry.setEnabled(True)
def tryStartDBUSServer(self):
try:
self.setupDeviceManager()
except dbus.DBusException, ex:
if hasattr(self, "retry"):
self.retry.setEnabled(False)
subprocess.Popen(['ffado-dbus-server', '-v3']).pid
QTimer.singleShot(5000, self.connectToDBUS)
def setupDeviceManager(self):
devmgr = DeviceManagerInterface(FFADO_DBUS_SERVER, FFADO_DBUS_BASEPATH)
self.manager.setManager(devmgr)
if hasattr(self, "retry"):
self.retry.setParent(None)
self.setCentralWidget(self.manager)
self.updateaction.setEnabled(True)
def aboutFFADO(self):
QMessageBox.about( self, "About FFADO", """
<h1>ffado.org</h1>
<p>FFADO is the new approach to have firewire audio on linux.</p>
<p>© 2006-2008 by the FFADO developers<br />ffado is licensed under the GPLv3, for the full license text see <a href="http://www.gnu.org/licenses/">www.gnu.org/licenses</a> or the LICENSE.* files shipped with ffado.</p>
<p>FFADO developers are:<ul>
<li>Pieter Palmers
<li>Daniel Wagner
<li>Jonathan Woithe
<li>Arnold Krille
</ul>
""" )
def get_lock(process_name):
import socket
import sys
global lock_socket
lock_socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
try:
lock_socket.bind('\0' + process_name)
# Lock acquired
except socket.error:
print 'ffado-mixer instance is already running'
sys.exit()
def ffadomain(args):
#set up logging
import logging
logging.basicConfig( datefmt="%H:%M:%S", format="%(asctime)s %(name)-16s %(levelname)-8s %(message)s" )
if DEBUG:
debug_level = logging.DEBUG
else:
debug_level = logging.INFO
get_lock('ffado-mixer')
# main loggers:
logging.getLogger('main').setLevel(debug_level)
logging.getLogger('dbus').setLevel(debug_level)
logging.getLogger('registration').setLevel(debug_level)
logging.getLogger('panelmanager').setLevel(debug_level)
logging.getLogger('configparser').setLevel(logging.INFO)
# widgets:
logging.getLogger('matrixmixer').setLevel(debug_level)
logging.getLogger('crossbarrouter').setLevel(debug_level)
# mixers:
logging.getLogger('audiofire').setLevel(debug_level)
logging.getLogger('bridgeco').setLevel(debug_level)
logging.getLogger('edirolfa101').setLevel(debug_level)
logging.getLogger('edirolfa66').setLevel(debug_level)
logging.getLogger('motu').setLevel(debug_level)
logging.getLogger('rme').setLevel(debug_level)
logging.getLogger('phase24').setLevel(debug_level)
logging.getLogger('phase88').setLevel(debug_level)
logging.getLogger('quatafire').setLevel(debug_level)
logging.getLogger('saffirebase').setLevel(debug_level)
logging.getLogger('saffire').setLevel(debug_level)
logging.getLogger('saffirepro').setLevel(debug_level)
logging.getLogger('global').setLevel(debug_level)
log = logging.getLogger('main')
app = QApplication(args)
app.setWindowIcon( QIcon( SHAREDIR + "/icons/hi64-apps-ffado.png" ) )
app.setOrganizationName("FFADO")
app.setOrganizationDomain("ffado.org")
app.setApplicationName("ffado-mixer")
mainwindow = FFADOWindow(None)
# rock & roll
mainwindow.show()
return app.exec_()
if __name__ == "__main__":
import sys
sys.exit(ffadomain(sys.argv))
#
# vim: ts=4 sw=4 et
|