Changeset 1668

Show
Ignore:
Timestamp:
09/18/09 14:00:59 (11 years ago)
Author:
arnonym
Message:
  • Use logging for the debug-output.
  • Add the ability to completely disconnect outputs from their input. This removes (should remove?) routes from the routing table.
Files:

Legend:

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

    r1648 r1668  
    150150        debug_level = logging.INFO 
    151151 
     152    # main loggers: 
    152153    logging.getLogger('main').setLevel(debug_level) 
    153154    logging.getLogger('dbus').setLevel(debug_level) 
     
    156157    logging.getLogger('configparser').setLevel(logging.INFO) 
    157158 
    158     logging.getLogger('global').setLevel(debug_level) 
     159    # widgets: 
     160    logging.getLogger('matrixmixer').setLevel(debug_level) 
     161    logging.getLogger('crossbarrouter').setLevel(debug_level) 
    159162 
     163    # mixers: 
    160164    logging.getLogger('audiofire').setLevel(debug_level) 
    161165    logging.getLogger('bridgeco').setLevel(debug_level) 
     
    170174    logging.getLogger('saffire').setLevel(debug_level) 
    171175    logging.getLogger('saffirepro').setLevel(debug_level) 
     176 
     177    logging.getLogger('global').setLevel(debug_level) 
    172178 
    173179    log = logging.getLogger('main') 
  • trunk/libffado/support/mixer-qt4/ffado/widgets/crossbarrouter.py

    r1656 r1668  
    2121from PyQt4 import QtGui, QtCore 
    2222import dbus 
     23 
     24import logging 
     25log = logging.getLogger("crossbarrouter") 
    2326 
    2427class VuMeter(QtGui.QFrame): 
     
    3942 
    4043    def setInput(self, input): 
    41         #print "VuMeter.setInput() %i->%i" % (self.output, input
     44        #log.debug("VuMeter.setInput() %i->%i" % (self.output, input)
    4245        self.input = input 
    4346 
     
    9194                self.ingroups[tmp] = 0 
    9295            self.ingroups[tmp] += 1 
    93         #print "Detected ingroups: %s" % str(self.ingroups
     96        #log.debug("Detected ingroups: %s" % str(self.ingroups)
    9497 
    9598        self.menu = QtGui.QMenu(self) 
    9699        self.btn.setMenu(self.menu) 
     100 
     101        action = QtGui.QAction("Disconnect", self) 
     102        action.setCheckable(True) 
     103        self.connect(action, QtCore.SIGNAL("toggled(bool)"), self.disconnectRoute) 
     104        self.exclusiveGroup.addAction(action) 
     105        self.menu.addAction(action) 
    97106 
    98107        for group in self.ingroups: 
     
    103112        self.vu.updateLevel(value) 
    104113 
     114    def disconnectRoute(self, checked): 
     115        log.debug("disconnectRoute( %s ) sender: %s" % (str(checked),str(self.sender()))) 
     116        dest = self.interface.getDestinationIndex(self.outname) 
     117        src = self.interface.getSourceName( self.interface.getSourceForDestination( dest ) ) 
     118        #log.debug(" source=%s destination=%s  possible? %s" % (src, self.outname, self.interface.canConnectNamed(src, self.outname))) 
     119        if not self.interface.setConnectionStateNamed(src, self.outname, False): 
     120            log.debug(" Changing the connection table was successfull.") 
     121        else: 
     122            log.warning(" Failed to change the connection table!") 
     123        self.peakValue(0) 
    105124 
    106125class InGroupMenu(QtGui.QMenu): 
     
    121140    def showMenu(self): 
    122141        #print "About to show the menu" 
    123         if len(self.actions()) < self.insize
     142        if len(self.actions()) < self.insize+1
    124143            # Do a lazy init of the sub-items. 
    125144            for i in range(self.insize): 
     
    140159    def connectionSwitched(self, checked): 
    141160        if self.lock: return 
    142         print "connectionSwitched( %s ) sender: %s" % (str(checked),str(self.sender())) 
     161        #log.debug("connectionSwitched( %s ) sender: %s" % (str(checked),str(self.sender()))) 
    143162        inname = str(self.sender().text()) 
    144         print " source=%s destination=%s  possible? %s" % (inname, self.outname, self.interface.canConnectNamed(inname, self.outname)) 
    145         print " connectionState is now %s" % self.interface.setConnectionStateNamed(inname, self.outname, checked) 
     163        #log.debug(" source=%s destination=%s  possible? %s" % (inname, self.outname, self.interface.canConnectNamed(inname, self.outname))) 
     164        if not self.interface.setConnectionStateNamed(inname, self.outname, checked): 
     165            log.warning(" Failed to change the routing.") 
    146166 
    147167 
     
    153173        self.interface = dbus.Interface(self.dev, dbus_interface="org.ffado.Control.Element.CrossbarRouter") 
    154174 
    155         print self.interface.getDestinations(
     175        log.info(self.interface.getDestinations()
    156176 
    157177        destinations = self.interface.getDestinationNames() 
  • trunk/libffado/support/mixer-qt4/ffado/widgets/matrixmixer.py

    r1666 r1668  
    2121from PyQt4 import QtGui, QtCore, Qt 
    2222import dbus 
     23 
     24import logging 
     25log = logging.getLogger("matrixmixer") 
    2326 
    2427class MixerNode(QtGui.QFrame): 
     
    181184        self.setPalette(palette) 
    182185 
    183         rows = self.interface.getRowCount() 
    184         cols = self.interface.getColCount() 
     186        rows = self.interface.getColCount() 
     187        cols = self.interface.getRowCount() 
     188        log.debug("Mixer has %i rows and %i columns" % (rows, cols)) 
    185189 
    186190        layout = QtGui.QGridLayout(self) 
     
    270274 
    271275    def valueChanged(self, n): 
    272         #print "MatrixNode.valueChanged( %s )" % str(n
     276        log.debug("MatrixNode.valueChanged( %s )" % str(n)
    273277        for tmp in n: 
    274278            self.interface.setValue(tmp[1], tmp[0], tmp[2])