def __init__(self, parentWidget, label = '', suffix = '', labelColumn = 1, value = 0.0, setAsDefault = True, minimum = 0.0, maximum = 360.0, notchSize = 1, notchTarget = 10.0, notchesVisible = True, wrapping = True, spanWidth = True ): """ Appends a QDial (Qt) widget to the bottom of I{parentWidget}, a Property Manager group box. @param parentWidget: The parent group box containing this widget. @type parentWidget: PM_GroupBox @see: U{B{QDial}<http://doc.trolltech.com/4/qdial.html>} """ if not parentWidget: return QDial.__init__(self) self.parentWidget = parentWidget self.label = label self.labelColumn = labelColumn self.setAsDefault = setAsDefault self.spanWidth = spanWidth self.suffix = suffix if label: # Create this widget's QLabel. self.labelWidget = QLabel() self.updateValueLabel() self.labelWidget.setText(self.value_label) # Set QDial minimum, maximum, then value self.setRange(minimum, maximum) self.setValue(value) # This must come after setDecimals(). if setAsDefault: self.setDefaultValue(value) self.notchSize = notchSize self.setNotchTarget(notchTarget) self.setNotchesVisible(notchesVisible) self.setWrapping(wrapping) parentWidget.addPmWidget(self)
def __init__(self, parentWidget, label='', suffix='', labelColumn=1, value=0.0, setAsDefault=True, minimum=0.0, maximum=360.0, notchSize=1, notchTarget=10.0, notchesVisible=True, wrapping=True, spanWidth=True): """ Appends a QDial (Qt) widget to the bottom of I{parentWidget}, a Property Manager group box. @param parentWidget: The parent group box containing this widget. @type parentWidget: PM_GroupBox @see: U{B{QDial}<http://doc.trolltech.com/4/qdial.html>} """ if not parentWidget: return QDial.__init__(self) self.parentWidget = parentWidget self.label = label self.labelColumn = labelColumn self.setAsDefault = setAsDefault self.spanWidth = spanWidth self.suffix = suffix if label: # Create this widget's QLabel. self.labelWidget = QLabel() self.updateValueLabel() self.labelWidget.setText(self.value_label) # Set QDial minimum, maximum, then value self.setRange(minimum, maximum) self.setValue(value) # This must come after setDecimals(). if setAsDefault: self.setDefaultValue(value) self.notchSize = notchSize self.setNotchTarget(notchTarget) self.setNotchesVisible(notchesVisible) self.setWrapping(wrapping) parentWidget.addPmWidget(self)
def setValue(self, value, setAsDefault = True): """ Sets the value of the dial to I{value}. setValue() will emit valueChanged() if the new value is different from the old one. @param value: The new dial value. @type value: float ## @param setAsDefault: Determines if the dial value is reset when ## the "Restore Defaults" button is clicked. If True, ## (the default) I{value} will be used as the reset ## value. ## @type setAsDefault: bool @note: The value will be rounded so it can be displayed with the current setting of decimals. @see: L{setDefaultValue} """ QDial.setValue(self, value) self.updateValueLabel()
def setValue(self, value, setAsDefault=True): """ Sets the value of the dial to I{value}. setValue() will emit valueChanged() if the new value is different from the old one. @param value: The new dial value. @type value: float ## @param setAsDefault: Determines if the dial value is reset when ## the "Restore Defaults" button is clicked. If True, ## (the default) I{value} will be used as the reset ## value. ## @type setAsDefault: bool @note: The value will be rounded so it can be displayed with the current setting of decimals. @see: L{setDefaultValue} """ QDial.setValue(self, value) self.updateValueLabel()
def __init__(self, parent=None): super(Pradio, self).__init__(parent) # logo................................... self.label = QLabel() self.pixmap = QPixmap('/usr/share/pradyo/plogo.png') self.label.setPixmap(self.pixmap) #/usr/share/pradyo/pradyo.py # progress barr..................................... self.bar =QProgressBar() self.bar.setMinimum(0) self.bar.setMaximum(100) self.bar.setValue(40) #label........................................... self.lcd = QLCDNumber(3) self.lcd.display('5') self.lcd.resize(50,50) # button.............................................. self.Btn1=QPushButton('Kiss FM') self.Btn2=QPushButton('Real FM') self.Btn3=QPushButton('Venus FM') self.Btn4=QPushButton('Kiss FM') self.Btn5=QPushButton('Nova FM') self.Btn6=QPushButton('Son FM') self.connect(self.Btn1, SIGNAL('clicked()'),partial(self.play,self.Btn1.text())) self.connect(self.Btn2, SIGNAL('clicked()'),partial(self.play,self.Btn2.text())) self.connect(self.Btn3, SIGNAL('clicked()'),partial(self.play,self.Btn3.text())) self.connect(self.Btn4, SIGNAL('clicked()'),partial(self.play,self.Btn4.text())) self.connect(self.Btn5, SIGNAL('clicked()'),partial(self.play,self.Btn5.text())) self.connect(self.Btn6, SIGNAL('clicked()'),partial(self.play,self.Btn6.text())) # ses buttonu........................................ self.dial = QDial() self.dial.setValue(30) self.connect(self.dial, SIGNAL("valueChanged(int)"),self.VolumeChange) self.dial.setNotchesVisible(True) # oynatma tuslarii...................................... self.PlayBtn = QtGui.QPushButton('', self) self.PlayBtn.setIcon(QtGui.QIcon('/usr/share/pradyo/a.png')) self.PlayBtn.setIconSize(QtCore.QSize(48,48)) # self.PlayBtn.clicked.connect(self.play) self.PlayBtn.setFlat(True) self.StopBtn = QtGui.QPushButton('', self) self.StopBtn.setIcon(QtGui.QIcon('/usr/share/pradyo/s.png')) self.StopBtn.setIconSize(QtCore.QSize(48,48)) self.StopBtn.setFlat(True) self.StopBtn.clicked.connect(self.stop_radio) # layout............................ grid = QGridLayout() grid.addWidget(self.PlayBtn,0,1) grid.addWidget(self.StopBtn,0,2) grid.addWidget(self.Btn1,1, 0, 3, 1) grid.addWidget(self.Btn2,1, 0, 7, 1) grid.addWidget(self.Btn3,1, 0, 11, 1) grid.addWidget(self.Btn4,1, 1, 3, 1) grid.addWidget(self.Btn5,1, 1, 7, 1) grid.addWidget(self.Btn6,1, 1, 11, 1) grid.addWidget(self.dial, 0, 4, 2, 1) grid.addWidget(self.label,0,0,1,1) self.setLayout(grid) self.setWindowTitle('Pradyo') self.setFixedSize(650, 300)
class Pradio(QDialog): def __init__(self, parent=None): super(Pradio, self).__init__(parent) # logo................................... self.label = QLabel() self.pixmap = QPixmap('/usr/share/pradyo/plogo.png') self.label.setPixmap(self.pixmap) #/usr/share/pradyo/pradyo.py # progress barr..................................... self.bar =QProgressBar() self.bar.setMinimum(0) self.bar.setMaximum(100) self.bar.setValue(40) #label........................................... self.lcd = QLCDNumber(3) self.lcd.display('5') self.lcd.resize(50,50) # button.............................................. self.Btn1=QPushButton('Kiss FM') self.Btn2=QPushButton('Real FM') self.Btn3=QPushButton('Venus FM') self.Btn4=QPushButton('Kiss FM') self.Btn5=QPushButton('Nova FM') self.Btn6=QPushButton('Son FM') self.connect(self.Btn1, SIGNAL('clicked()'),partial(self.play,self.Btn1.text())) self.connect(self.Btn2, SIGNAL('clicked()'),partial(self.play,self.Btn2.text())) self.connect(self.Btn3, SIGNAL('clicked()'),partial(self.play,self.Btn3.text())) self.connect(self.Btn4, SIGNAL('clicked()'),partial(self.play,self.Btn4.text())) self.connect(self.Btn5, SIGNAL('clicked()'),partial(self.play,self.Btn5.text())) self.connect(self.Btn6, SIGNAL('clicked()'),partial(self.play,self.Btn6.text())) # ses buttonu........................................ self.dial = QDial() self.dial.setValue(30) self.connect(self.dial, SIGNAL("valueChanged(int)"),self.VolumeChange) self.dial.setNotchesVisible(True) # oynatma tuslarii...................................... self.PlayBtn = QtGui.QPushButton('', self) self.PlayBtn.setIcon(QtGui.QIcon('/usr/share/pradyo/a.png')) self.PlayBtn.setIconSize(QtCore.QSize(48,48)) # self.PlayBtn.clicked.connect(self.play) self.PlayBtn.setFlat(True) self.StopBtn = QtGui.QPushButton('', self) self.StopBtn.setIcon(QtGui.QIcon('/usr/share/pradyo/s.png')) self.StopBtn.setIconSize(QtCore.QSize(48,48)) self.StopBtn.setFlat(True) self.StopBtn.clicked.connect(self.stop_radio) # layout............................ grid = QGridLayout() grid.addWidget(self.PlayBtn,0,1) grid.addWidget(self.StopBtn,0,2) grid.addWidget(self.Btn1,1, 0, 3, 1) grid.addWidget(self.Btn2,1, 0, 7, 1) grid.addWidget(self.Btn3,1, 0, 11, 1) grid.addWidget(self.Btn4,1, 1, 3, 1) grid.addWidget(self.Btn5,1, 1, 7, 1) grid.addWidget(self.Btn6,1, 1, 11, 1) grid.addWidget(self.dial, 0, 4, 2, 1) grid.addWidget(self.label,0,0,1,1) self.setLayout(grid) self.setWindowTitle('Pradyo') self.setFixedSize(650, 300) def VolumeChange(self): VolumeChange=self.dial.value() print(VolumeChange) player.set_property('volume', VolumeChange/100.0) def play(self,value): deg =str(value) player.set_state(gst.STATE_NULL) # print(value) # music_stream_uri=music_station[value] # print(music_stream_uri) music =music_station[deg] print(str(music)) player.set_property('uri',music) player.set_state(gst.STATE_PLAYING) self.PlayBtn.setIcon(QtGui.QIcon('/usr/share/pradyo/a.png')) self.PlayBtn.setIconSize(QtCore.QSize(48,48)) def stop_radio(self): print ("Radio stops") player.set_state(gst.STATE_NULL) self.PlayBtn.setIcon(QtGui.QIcon('/usr/share/pradyo/d.png')) self.PlayBtn.setIconSize(QtCore.QSize(48,48)) def Close(self): self.close()