Changeset 2649

Show
Ignore:
Timestamp:
11/08/16 03:59:05 (7 years ago)
Author:
jwoithe
Message:

matrixmixer: eliminate 'QtGui?' suffixes from the python code body.

Files:

Legend:

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

    r2546 r2649  
    2222 
    2323from PyQt4 import QtGui, QtCore, Qt 
     24from PyQt4.QtGui import QColor, QAbstractSlider, QDoubleSpinBox, QWidgetAction 
     25from PyQt4.QtGui import QAction, QPainter, QWidget, QGridLayout, QLabel 
     26from PyQt4.QtGui import QLayout, QSlider, QLineEdit, QPalette, 
     27from PyQt4.QtGui import QVBoxLayout, QHBoxLayout, QTabWidget, QToolBar 
     28from PyQt4.QtGui import QComboBox, QScrollArea, QPushButton, QSizePolicy 
    2429import dbus, math, decimal 
    2530 
     
    8085        lc = self.colors[low] 
    8186        hc = self.colors[high] 
    82         return QtGui.QColor( 
     87        return QColor( 
    8388                (1-f)*lc.red()   + f*hc.red(), 
    8489                (1-f)*lc.green() + f*hc.green(), 
     
    8893    def __init__(self): 
    8994        ColorForNumber.__init__(self) 
    90         self.addColor(             0.0, QtGui.QColor(  0,   0,   0)) 
    91         self.addColor(             1.0, QtGui.QColor(  0,   0, 128)) 
    92         self.addColor(   math.pow(2,6), QtGui.QColor(  0, 255,   0)) 
    93         self.addColor(  math.pow(2,14), QtGui.QColor(255, 255,   0)) 
    94         self.addColor(math.pow(2,16)-1, QtGui.QColor(255,   0,   0)) 
     95        self.addColor(             0.0, QColor(  0,   0,   0)) 
     96        self.addColor(             1.0, QColor(  0,   0, 128)) 
     97        self.addColor(   math.pow(2,6), QColor(  0, 255,   0)) 
     98        self.addColor(  math.pow(2,14), QColor(255, 255,   0)) 
     99        self.addColor(math.pow(2,16)-1, QColor(255,   0,   0)) 
    95100 
    96101    def getFrgdColor(self, color): 
    97102        if color.valueF() < 0.6: 
    98             return QtGui.QColor(255, 255, 255) 
    99         else: 
    100             return QtGui.QColor(0, 0, 0) 
     103            return QColor(255, 255, 255) 
     104        else: 
     105            return QColor(0, 0, 0) 
    101106     
    102 class MixerNode(QtGui.QAbstractSlider): 
     107class MixerNode(QAbstractSlider): 
    103108    def __init__(self, input, output, value, max, muted, inverted, parent, matrix_obj): 
    104         QtGui.QAbstractSlider.__init__(self, parent) 
     109        QAbstractSlider.__init__(self, parent) 
    105110        #log.debug("MixerNode.__init__( %i, %i, %i, %i, %s )" % (input, output, value, max, str(parent)) ) 
    106111 
     
    129134        self.connect(self.mapper, QtCore.SIGNAL("mapped(const QString&)"), self.directValues) 
    130135 
    131         self.spinbox = QtGui.QDoubleSpinBox(self) 
     136        self.spinbox = QDoubleSpinBox(self) 
    132137        self.spinbox.setRange(-40, 12) 
    133138        self.spinbox.setSuffix(" dB") 
     
    136141 
    137142        self.connect(self.spinbox, QtCore.SIGNAL("valueChanged(const QString&)"), self.directValues) 
    138         action = QtGui.QWidgetAction(self) 
     143        action = QWidgetAction(self) 
    139144        action.setDefaultWidget(self.spinbox) 
    140145        self.addAction(action) 
    141146 
    142147        for text in ["3 dB", "0 dB", "-3 dB", "-20 dB", "-inf dB"]: 
    143             action = QtGui.QAction(text, self) 
     148            action = QAction(text, self) 
    144149            self.connect(action, QtCore.SIGNAL("triggered()"), self.mapper, QtCore.SLOT("map()")) 
    145150            self.mapper.setMapping(action, text) 
     
    149154        self.mute_action = None 
    150155        if (muted != None): 
    151             action = QtGui.QAction(text, self) 
     156            action = QAction(text, self) 
    152157            action.setSeparator(True) 
    153158            self.addAction(action) 
    154             self.mute_action = QtGui.QAction("Mute", self) 
     159            self.mute_action = QAction("Mute", self) 
    155160            self.mute_action.setCheckable(True) 
    156161            self.mute_action.setChecked(muted) 
     
    163168        if (inverted != None): 
    164169            if (muted == None): 
    165                 action = QtGui.QAction(text, self) 
     170                action = QAction(text, self) 
    166171                action.setSeparator(True) 
    167172                self.addAction(action) 
    168             self.inv_action = QtGui.QAction("Invert", self) 
     173            self.inv_action = QAction("Invert", self) 
    169174            self.inv_action.setCheckable(True) 
    170175            self.inv_action.setChecked(inverted) 
     
    226231 
    227232    def paintEvent(self, ev): 
    228         p = QtGui.QPainter(self) 
     233        p = QPainter(self) 
    229234        rect = self.rect() 
    230235        v = self.value() 
    231236        if (self.mute_action!=None and self.mute_action.isChecked()): 
    232             color = QtGui.QColor(64, 64, 64) 
     237            color = QColor(64, 64, 64) 
    233238        else: 
    234239            color = self.bgcolors.getColor(v) 
     
    270275        self.update() 
    271276 
    272 class MixerChannel(QtGui.QWidget): 
     277class MixerChannel(QWidget): 
    273278    def __init__(self, number, parent=None, name="", smallFont=False): 
    274         QtGui.QWidget.__init__(self, parent) 
    275         layout = QtGui.QGridLayout(self) 
     279        QWidget.__init__(self, parent) 
     280        layout = QGridLayout(self) 
    276281        self.number = number 
    277282        self.name = name 
    278         self.lbl = QtGui.QLabel(self) 
     283        self.lbl = QLabel(self) 
    279284        self.lbl.setAlignment(Qt.Qt.AlignCenter) 
    280285        if (smallFont): 
     
    287292        self.setContextMenuPolicy(Qt.Qt.ActionsContextMenu) 
    288293 
    289         action = QtGui.QAction("Make this channel small", self) 
     294        action = QAction("Make this channel small", self) 
    290295        action.setCheckable(True) 
    291296        self.connect(action, QtCore.SIGNAL("triggered(bool)"), self.hideChannel) 
     
    301306 
    302307# Matrix view widget 
    303 class MatrixControlView(QtGui.QWidget): 
     308class MatrixControlView(QWidget): 
    304309    def __init__(self, servername, basepath, parent=None, sliderMaxValue=-1, mutespath=None, invertspath=None, smallFont=False, shortname=False, shortcolname="Ch", shortrowname="Ch", transpose=False): 
    305         QtGui.QWidget.__init__(self, parent) 
     310        QWidget.__init__(self, parent) 
    306311 
    307312        self.bus = dbus.SessionBus() 
     
    335340            self.inverts_interface = dbus.Interface(self.inverts_dev, dbus_interface="org.ffado.Control.Element.MatrixMixer") 
    336341 
    337         layout = QtGui.QGridLayout(self) 
    338         layout.setSizeConstraint(QtGui.QLayout.SetNoConstraint); 
     342        layout = QGridLayout(self) 
     343        layout.setSizeConstraint(QLayout.SetNoConstraint); 
    339344        self.setLayout(layout) 
    340345 
     
    640645        return True 
    641646 
    642 class VolumeSlider(QtGui.QSlider): 
     647class VolumeSlider(QSlider): 
    643648    def __init__(self, In, Out, value, parent): 
    644         QtGui.QSlider.__init__(self, QtCore.Qt.Vertical, parent) 
    645  
    646         self.setTickPosition(QtGui.QSlider.TicksBothSides) 
     649        QSlider.__init__(self, QtCore.Qt.Vertical, parent) 
     650 
     651        self.setTickPosition(QSlider.TicksBothSides) 
    647652        v_min = 10.0*toDBvalue(0) 
    648653        v_max = 10.0*toDBvalue(65536) 
     
    673678 
    674679 
    675 class VolumeSliderValueInfo(QtGui.QLineEdit): 
     680class VolumeSliderValueInfo(QLineEdit): 
    676681    def __init__(self, In, Out, value, parent): 
    677         QtGui.QLineEdit.__init__(self, parent) 
     682        QLineEdit.__init__(self, parent) 
    678683 
    679684        self.setReadOnly(True) 
     
    695700        color = self.bgcolors.getColor(value) 
    696701        palette = self.palette() 
    697         palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Base, color) 
    698         palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Text, self.bgcolors.getFrgdColor(color)) 
     702        palette.setColor(QPalette.Active, QPalette.Base, color) 
     703        palette.setColor(QPalette.Active, QPalette.Text, self.bgcolors.getFrgdColor(color)) 
    699704        self.setPalette(palette) 
    700705 
     
    708713        self.setText(text) 
    709714         
    710 class BalanceSlider(QtGui.QSlider): 
     715class BalanceSlider(QSlider): 
    711716    def __init__(self, In, Out, value, parent): 
    712         QtGui.QSlider.__init__(self, QtCore.Qt.Horizontal, parent) 
     717        QSlider.__init__(self, QtCore.Qt.Horizontal, parent) 
    713718 
    714719        v_min = -50 
    715720        v_max = 50 
    716         self.setTickPosition(QtGui.QSlider.TicksBothSides) 
     721        self.setTickPosition(QSlider.TicksBothSides) 
    717722        self.setTickInterval((v_max-v_min)/2) 
    718723        self.setMinimum(v_min) 
     
    738743 
    739744# Slider view widget 
    740 class SliderControlView(QtGui.QWidget): 
     745class SliderControlView(QWidget): 
    741746    def __init__(self, parent, servername, basepath, rule="Columns_are_inputs", shortname=False, shortinname="Ch", shortoutname="Ch", stereochannels = []): 
    742         QtGui.QWidget.__init__(self, parent) 
     747        QWidget.__init__(self, parent) 
    743748 
    744749        self.bus = dbus.SessionBus() 
     
    760765        k = 0 
    761766        for i in range(self.nbOut): 
    762             widget = QtGui.QWidget(parent) 
    763             v_layout = QtGui.QVBoxLayout(widget) 
     767            widget = QWidget(parent) 
     768            v_layout = QVBoxLayout(widget) 
    764769            v_layout.setAlignment(Qt.Qt.AlignCenter) 
    765770            widget.setLayout(v_layout) 
     
    779784            # Mixer/Out info label 
    780785            if (self.nbOut > 1): 
    781                 lbl = QtGui.QLabel(widget) 
     786                lbl = QLabel(widget) 
    782787                lbl.setText(self.getOutName(i, self.shortname)) 
    783788                lbl.setAlignment(Qt.Qt.AlignCenter) 
     
    785790                self.out[i].lbl.append(lbl) 
    786791 
    787             h_layout_wid = QtGui.QWidget(widget) 
    788             h_layout = QtGui.QHBoxLayout(h_layout_wid) 
     792            h_layout_wid = QWidget(widget) 
     793            h_layout = QHBoxLayout(h_layout_wid) 
    789794            h_layout.setAlignment(Qt.Qt.AlignCenter) 
    790795            h_layout_wid.setLayout(h_layout) 
     
    795800 
    796801            for j in range(self.nbIn): 
    797                 h_v_layout_wid = QtGui.QWidget(h_layout_wid) 
    798                 h_v_layout = QtGui.QVBoxLayout(h_v_layout_wid) 
     802                h_v_layout_wid = QWidget(h_layout_wid) 
     803                h_v_layout = QVBoxLayout(h_v_layout_wid) 
    799804                h_v_layout.setAlignment(Qt.Qt.AlignCenter) 
    800805                h_v_layout_wid.setLayout(h_v_layout) 
     
    803808                # Mixer/In info label 
    804809                if (self.nbIn > 1): 
    805                     lbl = QtGui.QLabel(h_v_layout_wid) 
     810                    lbl = QLabel(h_v_layout_wid) 
    806811                    lbl.setText(self.getInName(j, self.shortname)) 
    807812                    lbl.setAlignment(Qt.Qt.AlignCenter) 
     
    809814                    self.out[i].lbl.append(lbl) 
    810815 
    811                 h_v_h_layout_wid = QtGui.QWidget(h_v_layout_wid) 
    812                 h_v_h_layout = QtGui.QHBoxLayout(h_v_h_layout_wid) 
     816                h_v_h_layout_wid = QWidget(h_v_layout_wid) 
     817                h_v_h_layout = QHBoxLayout(h_v_h_layout_wid) 
    813818                h_v_h_layout.setAlignment(Qt.Qt.AlignCenter) 
    814819                h_v_h_layout_wid.setLayout(h_v_h_layout) 
     
    11041109from functools import partial 
    11051110 
    1106 class MatrixMixer(QtGui.QWidget): 
    1107     def __init__(self, servername, basepath, parent=None, rule="Columns_are_inputs", sliderMaxValue=-1, mutespath=None, invertspath=None, smallFont=False, taborientation=QtGui.QTabWidget.West, tabshape=QtGui.QTabWidget.Triangular): 
    1108         QtGui.QWidget.__init__(self, parent) 
     1111class MatrixMixer(QWidget): 
     1112    def __init__(self, servername, basepath, parent=None, rule="Columns_are_inputs", sliderMaxValue=-1, mutespath=None, invertspath=None, smallFont=False, taborientation=QTabWidget.West, tabshape=QTabWidget.Triangular): 
     1113        QWidget.__init__(self, parent) 
    11091114        self.servername = servername 
    11101115        self.basepath = basepath 
     
    11141119        self.smallFont = smallFont 
    11151120 
    1116         self.layout = QtGui.QVBoxLayout(self) 
     1121        self.layout = QVBoxLayout(self) 
    11171122        self.setLayout(self.layout) 
    11181123 
    11191124        # Mixer view Tool bar 
    1120         mxv_set = QtGui.QToolBar("View settings", self) 
     1125        mxv_set = QToolBar("View settings", self) 
    11211126 
    11221127        # Here is a hack; the first action button appears to behaves strangely, 
    11231128        # possibly a PyQt bug (or an unsufficient fair implementation of it) 
    11241129        # Feel free to remove the next three lines at a time in the future 
    1125         hack = QtGui.QAction(" ", mxv_set) 
     1130        hack = QAction(" ", mxv_set) 
    11261131        hack.setDisabled(True) 
    11271132        mxv_set.addAction(hack) 
    11281133 
    1129         transpose_matrix = QtGui.QAction("Transpose", mxv_set) 
     1134        transpose_matrix = QAction("Transpose", mxv_set) 
    11301135        self.transpose = False 
    11311136        transpose_matrix.setShortcut('Ctrl+T') 
     
    11351140        mxv_set.addSeparator() 
    11361141 
    1137         self.hide_matrix = QtGui.QAction("Hide matrix", mxv_set) 
     1142        self.hide_matrix = QAction("Hide matrix", mxv_set) 
    11381143        self.hide_matrix_bool = False 
    11391144        mxv_set.addAction(self.hide_matrix) 
     
    11411146        mxv_set.addSeparator() 
    11421147 
    1143         self.hide_per_output = QtGui.QAction("Hide per Output", mxv_set) 
     1148        self.hide_per_output = QAction("Hide per Output", mxv_set) 
    11441149        self.hide_per_output_bool = False 
    11451150        mxv_set.addAction(self.hide_per_output) 
     
    11471152        mxv_set.addSeparator() 
    11481153 
    1149         self.use_short_names = QtGui.QAction("Short names", mxv_set) 
     1154        self.use_short_names = QAction("Short names", mxv_set) 
    11501155        self.short_names_bool = False 
    11511156        mxv_set.addAction(self.use_short_names) 
     
    11541159        mxv_set.addSeparator() 
    11551160 
    1156         font_switch_lbl = QtGui.QLabel(mxv_set) 
     1161        font_switch_lbl = QLabel(mxv_set) 
    11571162        font_switch_lbl.setText("Font size ") 
    11581163        mxv_set.addWidget(font_switch_lbl) 
    1159         font_switch = QtGui.QComboBox(mxv_set) 
     1164        font_switch = QComboBox(mxv_set) 
    11601165        font_switch.setToolTip("Labels font size") 
    11611166        font = font_switch.font() 
     
    11721177        # First tab is for matrix view 
    11731178        # Next are for "per Out" view 
    1174         self.tabs = QtGui.QTabWidget(self) 
     1179        self.tabs = QTabWidget(self) 
    11751180        self.tabs.setTabPosition(taborientation) 
    11761181        self.tabs.setTabShape(tabshape) 
     
    11871192        self.connect(self.matrix, QtCore.SIGNAL("valueChanged"), self.matrixControlChanged) 
    11881193 
    1189         self.scrollarea_matrix = QtGui.QScrollArea(self.tabs) 
     1194        self.scrollarea_matrix = QScrollArea(self.tabs) 
    11901195        self.scrollarea_matrix.setWidgetResizable(True) 
    11911196        self.scrollarea_matrix.setWidget(self.matrix) 
     
    12041209                nb_out_mono = self.matrix.cols 
    12051210 
    1206         stereo_switch_lbl = QtGui.QLabel(mxv_set) 
     1211        stereo_switch_lbl = QLabel(mxv_set) 
    12071212        stereo_switch_lbl.setText("Stereo: ") 
    12081213        mxv_set.addWidget(stereo_switch_lbl) 
     
    12121217        self.stereo_switch = [] 
    12131218        for i in range(nb_out_mono/2): 
    1214             stereo_switch = QtGui.QPushButton("%d+%d" % (2*i+1, 2*i+2), mxv_set) 
     1219            stereo_switch = QPushButton("%d+%d" % (2*i+1, 2*i+2), mxv_set) 
    12151220            stereo_switch.setToolTip("Set these output channels as stereo") 
    12161221            stereo_switch.setCheckable(True) 
    12171222            stereo_switch.clicked.connect(partial(self.switchStereoChannel, i)) 
    12181223            stereo_switch.setMinimumSize(stereo_switch_lbl.fontMetrics().boundingRect("%d+%d" % (nb_out_mono, nb_out_mono)).size()*1.05) 
    1219             stereo_switch.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)) 
     1224            stereo_switch.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) 
    12201225            stereo_switch.is_stereo = False 
    12211226            mxv_set.addWidget(stereo_switch) 
     
    12271232        self.connect(self.perOut, QtCore.SIGNAL("valueChanged"), self.sliderControlChanged) 
    12281233        for i in range(self.perOut.nbOut): 
    1229             self.perOut.out[i].scrollarea = QtGui.QScrollArea(self.tabs) 
     1234            self.perOut.out[i].scrollarea = QScrollArea(self.tabs) 
    12301235            self.perOut.out[i].scrollarea.setWidgetResizable(True) 
    12311236            self.perOut.out[i].scrollarea.setWidget(self.perOut.out[i]) 
     
    12421247        self.connect(self.matrix, QtCore.SIGNAL("valueChanged"), self.matrixControlChanged) 
    12431248 
    1244         self.scrollarea_matrix = QtGui.QScrollArea(self.tabs) 
     1249        self.scrollarea_matrix = QScrollArea(self.tabs) 
    12451250        self.scrollarea_matrix.setWidgetResizable(True) 
    12461251        self.scrollarea_matrix.setWidget(self.matrix) 
     
    13831388        current = 0 
    13841389        for i in range(self.perOut.nbOut): 
    1385             self.perOut.out[i].scrollarea = QtGui.QScrollArea(self.tabs) 
     1390            self.perOut.out[i].scrollarea = QScrollArea(self.tabs) 
    13861391            self.perOut.out[i].scrollarea.setWidgetResizable(True) 
    13871392            self.perOut.out[i].scrollarea.setWidget(self.perOut.out[i])