def _createTrackProgress(self, parent, track): w = QWidget(parent) l = QVBoxLayout(w) p = QProgressBar(w) p.setRange(0, 100) p.setValue(track['progress']) w.progress = p label = QLabel(w) label.setContentsMargins(5, 2, 5, 2) label.setOpenExternalLinks(True) label.setWordWrap(True) if track['name'] is not None: label.setText(track['name']) elif track['error']: label.setText('<font color="red">%s</font>' % track['error']) p.setValue(100) w.label = label l.addWidget(label) l.addWidget(p) w.setLayout(l) return w
def __init__(self, parent, looper_number, looper_settings): global commands super(LooperWidget, self).__init__(parent) self.verticalLayout = QVBoxLayout(self) self.hwidget = QWidget() self.verticalLayout.addWidget(self.hwidget) self.horizontalLayout = QHBoxLayout(self.hwidget) self.buttons = [] self.sliders = [] self.number = looper_number for number,name in commands: button = QPushButton(self, text=QApplication.translate("MainWindow", name.title(), None, QApplication.UnicodeUTF8)) self.buttons.append(button) self.horizontalLayout.addWidget(self.buttons[-1]) button.command = number button.clicked.connect(self.onButtonClicked) for d in looper_settings: widget = QWidget() widget.setMaximumHeight(90) widget.setMaximumWidth (90) widget.setMinimumHeight(90) widget.setMinimumWidth (90) layout = QVBoxLayout(widget) name = d["lv2:name"][0].replace("Looper ","", 1) widget.label = QLabel(name) widget.label.setAlignment(Qt.AlignCenter) widget.dial = QDial() layout.addWidget(widget.dial) layout.addWidget(widget.label) self.sliders.append(widget) widget.dial.setMaximum(int(d["lv2:maximum"][0] * 100.0)) widget.dial.setMinimum(int(d["lv2:minimum"][0] * 100.0)) widget.dial.setValue (int(d["lv2:default"][0] * 100.0)) widget.dial.name = SlimMessage.Looper.Setting.__dict__[name.upper()] widget.dial.valueChanged.connect(self.onSliderChanged) self.verticalLayout.addWidget(widget)