Show
Ignore:
Timestamp:
08/30/09 15:36:59 (15 years ago)
Author:
arnonym
Message:

Smaller buttons for the router-states. The group names have an increasing off-by-one error I can't put my finger on now...

Files:

Legend:

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

    r1643 r1644  
    3232        self.tabs = QtGui.QTabWidget(self) 
    3333        self.layout.addWidget(self.tabs) 
    34         #self.mixerwidget = QtGui.QScrollArea(self) 
    35         #self.mixerwidget.setWidgetResizable(True) 
    36         #self.layout.addWidget(self.mixerwidget) 
    3734 
    3835    def buildMixer(self): 
     
    4037        #print self.hw.getText("/Generic/Nickname") 
    4138        self.matrix = MatrixMixer(self.hw.servername, self.hw.basepath+"/EAP/MatrixMixer", self) 
    42         #self.mixerwidget.setWidget(self.matrix) 
    4339        scrollarea = QtGui.QScrollArea(self.tabs) 
    4440        scrollarea.setWidgetResizable(True) 
  • trunk/libffado/support/mixer-qt4/ffado/widgets/crossbarrouter.py

    r1643 r1644  
    2323 
    2424 
     25class CrossbarState(QtGui.QAbstractButton): 
     26    def __init__(self, title, parent=None): 
     27        QtGui.QAbstractButton.__init__(self, parent) 
     28        self.setText(title) 
     29        self.setToolTip(title) 
     30 
     31        self.setMinimumSize(QtCore.QSize(10, 10)) 
     32 
     33    def paintEvent(self, event): 
     34        p = QtGui.QPainter(self) 
     35        color = QtGui.QColor(0, 255, 0) 
     36        if self.isChecked(): 
     37            color = QtGui.QColor(255, 0, 0) 
     38        p.fillRect(self.rect(), color) 
     39 
    2540 
    2641class CrossbarRouter(QtGui.QWidget): 
     
    4358        print "Available destinations (%i=?%i) %s" % (self.interface.getNbDestinations(), len(self.destinations), str(self.destinations)) 
    4459 
     60        self.innames = [] 
     61        self.ingroups = {} 
     62        for ch in self.sources: 
     63            tmp = ch.split(":")[0] 
     64            if not tmp in self.ingroups: 
     65                self.ingroups[tmp] = 0 
     66                self.innames.append(tmp) 
     67            self.ingroups[tmp] = self.ingroups[tmp] + 1 
     68        print self.ingroups 
     69        self.outnames = [] 
     70        self.outgroups = {} 
     71        for ch in self.destinations: 
     72            tmp = ch.split(":")[0] 
     73            if not tmp in self.outgroups: 
     74                self.outgroups[tmp] = 0 
     75                self.outnames.append(tmp) 
     76            self.outgroups[tmp] = self.outgroups[tmp] + 1 
     77        print self.outgroups 
     78 
    4579        self.layout = QtGui.QGridLayout(self) 
    4680        self.setLayout(self.layout) 
    4781 
     82        tmp = 1 
     83        for group in self.innames: 
     84            lbl = QtGui.QLabel(group, self) 
     85            self.layout.addWidget(lbl, 0, tmp + self.innames.index(group), 1, self.ingroups[group]) 
     86            tmp += self.ingroups[group] 
     87        tmp = 1 
     88        for group in self.outnames: 
     89            lbl = QtGui.QLabel(group, self) 
     90            self.layout.addWidget(lbl, tmp + self.outnames.index(group), 0, self.outgroups[group], 1) 
     91            tmp += self.outgroups[group] 
    4892        #for i in range(len(self.sources)): 
    4993        #    lbl = QtGui.QLabel(self.sources[i], self) 
     
    5397        #    self.layout.addWidget(lbl, i+1, 0) 
    5498 
    55         for i in range(0, len(self.sources)): 
     99        for i in range(0, min(600, len(self.sources))): 
    56100            print "Checking connections for source %s" % self.sources[i] 
    57             for j in range(0, len(self.destinations)): 
    58                 if self.interface.canConnect(i, j): 
    59                     checkbox = QtGui.QPushButton("%s->%s" % (self.sources[i], self.destinations[j]), self) 
     101            for j in range(0, min(600, len(self.destinations))): 
     102                if self.interface.canConnect(i, j) and self.sources[i].split(":")[0] != self.destinations[j].split(":")[0]: 
     103                    #checkbox = QtGui.QPushButton("%s->%s" % (self.sources[i], self.destinations[j]), self) 
     104                    checkbox = CrossbarState("%s->%s" % (self.sources[i], self.destinations[j]), self) 
    60105                    checkbox.setCheckable(True) 
    61106                    checkbox.setChecked(self.interface.getConnectionState(i, j)) 
    62                     self.layout.addWidget(checkbox, j, i) 
    63                     #self.layout.addWidget(checkbox, j+1, i+1) 
     107                    #self.layout.addWidget(checkbox, j, i) 
     108                    self.layout.addWidget(checkbox, j+1, i+1) 
    64109# 
    65110# vim: sw=4 ts=4 et