Changeset 2701

Show
Ignore:
Timestamp:
06/04/17 00:23:13 (3 years ago)
Author:
jwoithe
Message:

ffado-mixer: add device mixers to "View" menu.

Xavier Forestier's November 2016 patchset included code which added an entry
for each active device's mixer to the "View" menu. For users with a number
of different devices this may prove useful. This commits Xavier's original
patch was with some minor changes to ensure the guid key is resolvable by
setTabVisible() under PyQt?4. It has not been tested under PyQt?5.

Files:

Legend:

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

    r2700 r2701  
    106106        self.refreshaction.triggered.connect(self.manager.refreshPanels) 
    107107        self.editmenu.addAction(self.refreshaction) 
     108        self.editmenu.addSeparator() 
     109        self.devices = {} 
    108110 
    109111        helpmenu = self.menuBar().addMenu( "&Help" ) 
  • trunk/libffado/support/mixer-qt4/ffado/panelmanager.py

    r2694 r2701  
    223223        self.tabs.removeTab(idx) 
    224224        w.deleteLater() 
     225        self.parent.editmenu.removeAction(self.parent.devices[guid]) 
     226        self.parent.devices.pop(guid, None) 
    225227 
    226228    def addPanel(self, idx): 
     
    355357          w.smixReadSetgs = mixerwidget.readSettings 
    356358          self.parent.openaction.setEnabled(True) 
     359 
     360        self.parent.devices[guid] = QAction(QIcon.fromTheme("audio-card"), str(title), self.parent) 
     361        # Ensure a standard type is passed to setDate() so a UserType is not 
     362        # adopted by the QVariant which underpins the QAction data.  "guid" 
     363        # is a dbus.String object; it will be stored as a UserType if passed 
     364        # directly, which makes it difficult to extract in setTabVisible(). 
     365        self.parent.devices[guid].setData(str(guid)) 
     366        self.parent.editmenu.addAction(self.parent.devices[guid]) 
     367        self.parent.devices[guid].triggered.connect(self.setTabVisible) 
     368     
     369    def setTabVisible(self) : 
     370        action = self.sender() 
     371        # Extract the action data and store as a dbus.String type so  
     372        # it is usable as a key into self.panels[]. 
     373        panel_key = dbus.String(action.data().toString()) 
     374        self.tabs.setCurrentIndex(self.tabs.indexOf(self.panels[panel_key])) 
    357375 
    358376    def displayPanels(self):