Changeset 1802 for trunk

Show
Ignore:
Timestamp:
02/17/10 14:08:15 (14 years ago)
Author:
arnonym
Message:
  • Start ffado-dbus-daemon if its not running. (old)
  • Retry if ffado-dbus-daemon stops while the mixer runs. (new)
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/support/mixer-qt4/ffado/ffadowindow.py

    r1748 r1802  
    2727from ffado.config import * 
    2828 
    29 import o
     29import subproces
    3030 
    3131from PyQt4.QtCore import SIGNAL, SLOT, QObject, QTimer, Qt 
     
    4343        QWidget.__init__(self, parent) 
    4444        self.setObjectName("Restart Dialog") 
    45         self.label = QLabel("Somehow the connection to the dbus-service of FFADO couldn't be established.\nShall we take another try?",self) 
     45        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) 
    4646        self.button = QPushButton("Retry", self) 
    4747        self.layout = QGridLayout(self) 
    48         self.layout.addWidget(self.label, 0, 0, Qt.AlignCenter) 
    49         self.layout.addWidget(self.button, 1, 0, Qt.AlignCenter) 
     48        self.layout.setContentsMargins( 50, 10, 50, 10 ) 
     49        self.layout.addWidget(self.label, 0, 0, Qt.AlignHCenter|Qt.AlignBottom) 
     50        self.layout.addWidget(self.button, 1, 0, Qt.AlignHCenter|Qt.AlignTop) 
    5051 
    5152class FFADOWindow(QMainWindow): 
     
    6364 
    6465        self.manager = PanelManager(self) 
     66        self.connect(self.manager, SIGNAL("connectionLost"), self.connectToDBUS) 
    6567 
    6668        filemenu = self.menuBar().addMenu("File") 
     
    98100 
    99101    def connectToDBUS(self): 
     102        log.info("connectToDBUS") 
    100103        try: 
    101104            self.setupDeviceManager() 
     
    104107            if not hasattr(self,"retry"): 
    105108                self.retry = StartDialog(self) 
     109                self.connect(self.retry.button, SIGNAL("clicked()"), self.tryStartDBUSServer) 
     110            if hasattr(self, "retry"): 
     111                self.manager.setParent(None) 
    106112                self.setCentralWidget(self.retry) 
    107                 self.connect(self.retry.button, SIGNAL("clicked()"), self.tryStartDBUSServer) 
    108             self.retry.setEnabled(True) 
     113                self.retry.setEnabled(True) 
    109114 
    110115    def tryStartDBUSServer(self): 
     
    112117            self.setupDeviceManager() 
    113118        except dbus.DBusException, ex: 
    114             self.retry.setEnabled(False) 
    115             os.spawnlp( os.P_NOWAIT, "ffado-dbus-server" ) 
    116             QTimer.singleShot(2000, self.connectToDBUS) 
     119            if hasattr(self, "retry"): 
     120                self.retry.setEnabled(False) 
     121            subprocess.Popen(['ffado-dbus-server', '-v3']).pid 
     122            QTimer.singleShot(5000, self.connectToDBUS) 
    117123 
    118124    def setupDeviceManager(self): 
    119125        devmgr = DeviceManagerInterface(FFADO_DBUS_SERVER, FFADO_DBUS_BASEPATH) 
    120         #nbDevices = devmgr.getNbDevices() 
    121126        self.manager.setManager(devmgr) 
     127        if hasattr(self, "retry"): 
     128            self.retry.setParent(None) 
    122129        self.setCentralWidget(self.manager) 
    123130        self.updateaction.setEnabled(True) 
  • trunk/libffado/support/mixer-qt4/ffado/panelmanager.py

    r1707 r1802  
    139139        #log.debug("PanelManager::pollPanels()") 
    140140        # only when not modifying the tabs 
    141         if self.tabs.isEnabled()
    142             for guid in self.panels.keys(): 
    143                 w = self.panels[guid] 
    144                 for child in w.children(): 
    145                     #log.debug("poll child %s,%s" % (guid,child)) 
    146                     if 'polledUpdate' in dir(child): 
    147                         try
     141        try
     142            if self.tabs.isEnabled(): 
     143                for guid in self.panels.keys(): 
     144                    w = self.panels[guid] 
     145                    for child in w.children(): 
     146                        #log.debug("poll child %s,%s" % (guid,child)) 
     147                        if 'polledUpdate' in dir(child)
    148148                            child.polledUpdate() 
    149                         except: 
    150                             log.error("error in polled update") 
    151                             raise 
     149        except: 
     150            log.error("error in pollPanels") 
     151            self.commCheck() 
    152152 
    153153    def devlistPreUpdate(self): 
     
    201201            nbDevices = self.devmgr.getNbDevices() 
    202202        except: 
    203             log.debug("comms lost") 
     203            log.error("The communication with ffado-dbus-server was lost.") 
    204204            self.tabs.setEnabled(False) 
    205             self.tabs.hide() 
    206             self.status.lblMessage.setText("Failed to communicate with DBUS server. Please restart it and restart ffadomixer...") 
    207             self.status.show() 
     205            self.polltimer.stop() 
    208206            self.alivetimer.stop() 
     207            keys = self.panels.keys() 
     208            for panel in keys: 
     209                w = self.panels[panel] 
     210                del self.panels[panel] 
     211                w.deleteLater() 
     212            self.emit(SIGNAL("connectionLost")) 
    209213 
    210214    def updatePanels(self):