def __init__(self, parent=None):
super().__init__()
self.parent = parent
self.setFixedHeight(5)
self.setStyleSheet("""QSlider::groove:horizontal {
border: 1px solid red;
height: 6px;
margin: 2px 0;
border-radius: 3px;
}
QSlider::handle:horizontal {
background: red;
border: 1px solid red;
width: 3px;
margin: -8px 0;
border-radius: 1px;
}
QSlider::add-page:horizontal {
background: lightgray;
}
QSlider::sub-page:horizontal {
background: red;
}""")
python类QSlider()的实例源码
def __init__(self, mainWindow):
super().__init__(mainWindow, "")
self.mainWindow = mainWindow
self.layout.insertRow(0, QtWidgets.QLabel("Edit Grid"))
self.duration = CombinedTickWidget()
self.duration.setValue(constantsAndConfigs.gridRhythm)
self.layout.addRow("duration in ticks", self.duration)
self.opacity = QtWidgets.QSlider(QtCore.Qt.Horizontal)
self.opacity.setMinimum(0)
self.opacity.setMaximum(50)
self.opacityLabel = QtWidgets.QLabel("opacity: {}%".format(int(constantsAndConfigs.gridOpacity * 100)))
self.layout.addRow(self.opacityLabel, self.opacity)
self.opacity.valueChanged.connect(lambda: self.opacityLabel.setText("opacity: {}%".format(self.opacity.value())))
self.opacity.setValue(int(constantsAndConfigs.gridOpacity * 100))
self.opacity.valueChanged.connect(lambda: self.mainWindow.scoreView.scoreScene.grid.setOpacity(self.opacity.value() / 100)) #only react to changes after the initial value was set.
self.__call__()
def __init__(self, playbin, parent):
super().__init__(parent)
self._playbin = playbin
self._state = self.STATE_IDLE
self._started = None
self._updater = None
self._slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
self._elapsed = QtWidgets.QLabel('00:00:00')
self._remaining = QtWidgets.QLabel('00:00:00')
self._slider.setMinimum(0)
layout = QtWidgets.QHBoxLayout()
layout.setContentsMargins(2, 2, 2, 2)
layout.addWidget(self._elapsed)
layout.addWidget(self._slider, stretch=1)
layout.addWidget(self._remaining)
self.setLayout(layout)
self._slider.sliderPressed.connect(self._startDragging)
self._slider.sliderMoved.connect(self._drag)
self._slider.sliderReleased.connect(self._stopDragging)
self._updater = asyncio.get_event_loop().create_task(self._poll())
def saveSettings(self):
lineEdit_filemaskregex = self.findChild(QLineEdit, "lineEdit_filemaskregex")
cfg.settings.setValue('Options/FilemaskRegEx', lineEdit_filemaskregex.text())
lineEdit_mediainfo_path = self.findChild(QLineEdit, "lineEdit_mediainfo_path")
cfg.settings.setValue('Paths/mediainfo_bin', lineEdit_mediainfo_path.text())
lineEdit_mp3guessenc_path = self.findChild(QLineEdit, "lineEdit_mp3guessenc_path")
cfg.settings.setValue('Paths/mp3guessenc_bin', lineEdit_mp3guessenc_path.text())
lineEdit_aucdtect_path = self.findChild(QLineEdit, "lineEdit_aucdtect_path")
cfg.settings.setValue('Paths/aucdtect_bin', lineEdit_aucdtect_path.text())
lineEdit_sox_path = self.findChild(QLineEdit, "lineEdit_sox_path")
cfg.settings.setValue('Paths/sox_bin', lineEdit_sox_path.text())
lineEdit_ffprobe_path = self.findChild(QLineEdit, "lineEdit_ffprobe_path")
cfg.settings.setValue('Paths/ffprobe_bin', lineEdit_ffprobe_path.text())
checkBox_recursive = self.findChild(QCheckBox, "checkBox_recursive")
cfg.settings.setValue('Options/RecurseDirectories', checkBox_recursive.isChecked())
checkBox_followsymlinks = self.findChild(QCheckBox, "checkBox_followsymlinks")
cfg.settings.setValue('Options/FollowSymlinks', checkBox_followsymlinks.isChecked())
checkBox_cache = self.findChild(QCheckBox, "checkBox_cache")
cfg.settings.setValue('Options/UseCache', checkBox_cache.isChecked())
checkBox_cacheraw = self.findChild(QCheckBox, "checkBox_cacheraw")
cfg.settings.setValue('Options/CacheRawOutput', checkBox_cacheraw.isChecked())
spinBox_processes = self.findChild(QSpinBox, "spinBox_processes")
cfg.settings.setValue('Options/Processes', spinBox_processes.value())
spinBox_spectrogram_palette = self.findChild(QSpinBox, "spinBox_spectrogram_palette")
cfg.settings.setValue('Options/SpectrogramPalette', spinBox_spectrogram_palette.value())
checkBox_debug = self.findChild(QCheckBox, "checkBox_debug")
cfg.settings.setValue('Options/Debug', checkBox_debug.isChecked())
cfg.debug_enabled = checkBox_debug.isChecked()
checkBox_savewindowstate = self.findChild(QCheckBox, "checkBox_savewindowstate")
cfg.settings.setValue('Options/SaveWindowState', checkBox_savewindowstate.isChecked())
checkBox_clearfilelist = self.findChild(QCheckBox, "checkBox_clearfilelist")
cfg.settings.setValue('Options/ClearFilelist', checkBox_clearfilelist.isChecked())
checkBox_spectrogram = self.findChild(QCheckBox, "checkBox_spectrogram")
cfg.settings.setValue('Options/EnableSpectrogram', checkBox_spectrogram.isChecked())
checkBox_bitrate_graph = self.findChild(QCheckBox, "checkBox_bitrate_graph")
cfg.settings.setValue('Options/EnableBitGraph', checkBox_bitrate_graph.isChecked())
checkBox_aucdtect_scan = self.findChild(QCheckBox, "checkBox_aucdtect_scan")
cfg.settings.setValue('Options/auCDtect_scan', checkBox_aucdtect_scan.isChecked())
horizontalSlider_aucdtect_mode = self.findChild(QSlider, "horizontalSlider_aucdtect_mode")
cfg.settings.setValue('Options/auCDtect_mode', horizontalSlider_aucdtect_mode.value())
self.close()
def init_ui(self):
# Creating a label
self.sliderLabel = QLabel('Slider:', self)
# Creating a slider and setting its maximum and minimum value
self.slider = QSlider(self)
self.slider.setMinimum(0)
self.slider.setMaximum(100)
self.slider.setOrientation(Qt.Horizontal)
# Creating a horizontalBoxLayout
self.hboxLayout = QHBoxLayout(self)
# Adding the widgets
self.hboxLayout.addWidget(self.sliderLabel)
self.hboxLayout.addWidget(self.slider)
# Setting main layout
self.setLayout(self.hboxLayout)
# Setting a connection between slider position change and
# on_changed_value function
self.slider.valueChanged.connect(self.on_changed_value)
self.setWindowTitle("Dialog with a Slider")
self.show()
def makeWidget(self):
self.hideWidget = False
self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
self.slider.sigChanged = self.slider.valueChanged
return self.slider
# so we don't hide displayLabel
def setupUi(self, embeddedDialog):
embeddedDialog.setObjectName("embeddedDialog")
embeddedDialog.resize(407, 134)
self.formLayout = QtWidgets.QFormLayout(embeddedDialog)
self.formLayout.setObjectName("formLayout")
self.label = QtWidgets.QLabel(embeddedDialog)
self.label.setObjectName("label")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label)
self.layoutDirection = QtWidgets.QComboBox(embeddedDialog)
self.layoutDirection.setObjectName("layoutDirection")
self.layoutDirection.addItem("")
self.layoutDirection.addItem("")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.layoutDirection)
self.label_2 = QtWidgets.QLabel(embeddedDialog)
self.label_2.setObjectName("label_2")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_2)
self.fontComboBox = QtWidgets.QFontComboBox(embeddedDialog)
self.fontComboBox.setObjectName("fontComboBox")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.fontComboBox)
self.label_3 = QtWidgets.QLabel(embeddedDialog)
self.label_3.setObjectName("label_3")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_3)
self.style = QtWidgets.QComboBox(embeddedDialog)
self.style.setObjectName("style")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.style)
self.label_4 = QtWidgets.QLabel(embeddedDialog)
self.label_4.setObjectName("label_4")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_4)
self.spacing = QtWidgets.QSlider(embeddedDialog)
self.spacing.setOrientation(QtCore.Qt.Horizontal)
self.spacing.setObjectName("spacing")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.spacing)
self.label.setBuddy(self.layoutDirection)
self.label_2.setBuddy(self.fontComboBox)
self.label_3.setBuddy(self.style)
self.label_4.setBuddy(self.spacing)
self.retranslateUi(embeddedDialog)
QtCore.QMetaObject.connectSlotsByName(embeddedDialog)
def setupUi(self, embeddedDialog):
embeddedDialog.setObjectName("embeddedDialog")
embeddedDialog.resize(407, 134)
self.formLayout = QtWidgets.QFormLayout(embeddedDialog)
self.formLayout.setObjectName("formLayout")
self.label = QtWidgets.QLabel(embeddedDialog)
self.label.setObjectName("label")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label)
self.layoutDirection = QtWidgets.QComboBox(embeddedDialog)
self.layoutDirection.setObjectName("layoutDirection")
self.layoutDirection.addItem("")
self.layoutDirection.addItem("")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.layoutDirection)
self.label_2 = QtWidgets.QLabel(embeddedDialog)
self.label_2.setObjectName("label_2")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_2)
self.fontComboBox = QtWidgets.QFontComboBox(embeddedDialog)
self.fontComboBox.setObjectName("fontComboBox")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.fontComboBox)
self.label_3 = QtWidgets.QLabel(embeddedDialog)
self.label_3.setObjectName("label_3")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_3)
self.style = QtWidgets.QComboBox(embeddedDialog)
self.style.setObjectName("style")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.style)
self.label_4 = QtWidgets.QLabel(embeddedDialog)
self.label_4.setObjectName("label_4")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_4)
self.spacing = QtWidgets.QSlider(embeddedDialog)
self.spacing.setOrientation(QtCore.Qt.Horizontal)
self.spacing.setObjectName("spacing")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.spacing)
self.label.setBuddy(self.layoutDirection)
self.label_2.setBuddy(self.fontComboBox)
self.label_3.setBuddy(self.style)
self.label_4.setBuddy(self.spacing)
self.retranslateUi(embeddedDialog)
QtCore.QMetaObject.connectSlotsByName(embeddedDialog)
def __init__(self):
QWidget.__init__(self, flags=Qt.Widget)
self.dl = QDial()
self.sd = QSlider(Qt.Horizontal)
self.init_widget()
def __init__(self, parent = None):
QtWidgets.QWidget.__init__(self, parent)
self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Preferred)
self.label = QtWidgets.QLabel(self)
self.pause = QtWidgets.QPushButton('Play/Pause',self)
self.pause.clicked.connect(self.playPause)
self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)
self.slider.valueChanged.connect(self.sliderChanged)
self.status = QtWidgets.QLabel(self)
self.status.setAlignment(QtCore.Qt.AlignRight |
QtCore.Qt.AlignVCenter)
# Sets the image frames for this player to display
self.frame_rate = 30
self.max_frame_rate = 5.0
self.currentFrame = 0
self.frames = []
self.timer = None
self.redraw_signal.connect(self.updateImage)
topLayout = QtWidgets.QVBoxLayout(self)
topLayout.addWidget(self.label)
layout = QtWidgets.QHBoxLayout(self)
layout.addWidget(self.pause)
layout.addWidget(self.slider)
topLayout.addLayout(layout)
self.setLayout(topLayout)
self.reconfigurePlayer()
def setupUi(self, embeddedDialog):
embeddedDialog.setObjectName("embeddedDialog")
embeddedDialog.resize(407, 134)
self.formLayout = QtWidgets.QFormLayout(embeddedDialog)
self.formLayout.setObjectName("formLayout")
self.label = QtWidgets.QLabel(embeddedDialog)
self.label.setObjectName("label")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label)
self.layoutDirection = QtWidgets.QComboBox(embeddedDialog)
self.layoutDirection.setObjectName("layoutDirection")
self.layoutDirection.addItem("")
self.layoutDirection.addItem("")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.layoutDirection)
self.label_2 = QtWidgets.QLabel(embeddedDialog)
self.label_2.setObjectName("label_2")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_2)
self.fontComboBox = QtWidgets.QFontComboBox(embeddedDialog)
self.fontComboBox.setObjectName("fontComboBox")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.fontComboBox)
self.label_3 = QtWidgets.QLabel(embeddedDialog)
self.label_3.setObjectName("label_3")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_3)
self.style = QtWidgets.QComboBox(embeddedDialog)
self.style.setObjectName("style")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.style)
self.label_4 = QtWidgets.QLabel(embeddedDialog)
self.label_4.setObjectName("label_4")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_4)
self.spacing = QtWidgets.QSlider(embeddedDialog)
self.spacing.setOrientation(QtCore.Qt.Horizontal)
self.spacing.setObjectName("spacing")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.spacing)
self.label.setBuddy(self.layoutDirection)
self.label_2.setBuddy(self.fontComboBox)
self.label_3.setBuddy(self.style)
self.label_4.setBuddy(self.spacing)
self.retranslateUi(embeddedDialog)
QtCore.QMetaObject.connectSlotsByName(embeddedDialog)
def arrange_properties_panel(self):
self.qs = QSplitter(self)
self.frame = QFrame(parent=self)
layout = QVBoxLayout()
layout.addWidget(self.projectgui.projectproperties)
layout.insertStretch(1)
self.frame.setLayout(layout)
self.qs.addWidget(self.frame)
for x in self.projectgui.projectproperties.findChildren(QSlider):
x.setMinimumWidth(100)
self.qs.addWidget(self.mdi)
self.setCentralWidget(self.qs)
def __init__(self):
super(OptionsDialog, self).__init__()
self.ui = Ui_optionsDialog()
self.ui.setupUi(self)
lineEdit_filemaskregex = self.findChild(QLineEdit, "lineEdit_filemaskregex")
filemask_regex = cfg.settings.value('Options/FilemaskRegEx', defaultfilemask)
if not filemask_regex == "":
lineEdit_filemaskregex.setText(filemask_regex)
else:
lineEdit_filemaskregex.setText(defaultfilemask)
lineEdit_mediainfo_path = self.findChild(QLineEdit, "lineEdit_mediainfo_path")
lineEdit_mediainfo_path.setText(findMediaInfoBin())
lineEdit_mp3guessenc_path = self.findChild(QLineEdit, "lineEdit_mp3guessenc_path")
lineEdit_mp3guessenc_path.setText(findGuessEncBin())
lineEdit_sox_path = self.findChild(QLineEdit, "lineEdit_sox_path")
lineEdit_sox_path.setText(findSoxBin())
lineEdit_ffprobe_path = self.findChild(QLineEdit, "lineEdit_ffprobe_path")
lineEdit_ffprobe_path.setText(findffprobeBin())
lineEdit_aucdtect_path = self.findChild(QLineEdit, "lineEdit_aucdtect_path")
lineEdit_aucdtect_path.setText(findauCDtectBin())
checkBox_recursive = self.findChild(QCheckBox, "checkBox_recursive")
checkBox_recursive.setChecked(cfg.settings.value('Options/RecurseDirectories', True, type=bool))
checkBox_followsymlinks = self.findChild(QCheckBox, "checkBox_followsymlinks")
checkBox_followsymlinks.setChecked(cfg.settings.value('Options/FollowSymlinks', False, type=bool))
checkBox_cache = self.findChild(QCheckBox, "checkBox_cache")
checkBox_cache.setChecked(cfg.settings.value('Options/UseCache', True, type=bool))
checkBox_cacheraw = self.findChild(QCheckBox, "checkBox_cacheraw")
checkBox_cacheraw.setChecked(cfg.settings.value('Options/CacheRawOutput', False, type=bool))
spinBox_processes = self.findChild(QSpinBox, "spinBox_processes")
spinBox_processes.setValue(cfg.settings.value('Options/Processes', 0, type=int))
spinBox_spectrogram_palette = self.findChild(QSpinBox, "spinBox_spectrogram_palette")
spinBox_spectrogram_palette.setValue(cfg.settings.value('Options/SpectrogramPalette', 1, type=int))
checkBox_debug = self.findChild(QCheckBox, "checkBox_debug")
checkBox_debug.setChecked(cfg.settings.value("Options/Debug", False, type=bool))
checkBox_savewindowstate = self.findChild(QCheckBox, "checkBox_savewindowstate")
checkBox_savewindowstate.setChecked(cfg.settings.value("Options/SaveWindowState", True, type=bool))
checkBox_clearfilelist = self.findChild(QCheckBox, "checkBox_clearfilelist")
checkBox_clearfilelist.setChecked(cfg.settings.value('Options/ClearFilelist', True, type=bool))
checkBox_spectrogram = self.findChild(QCheckBox, "checkBox_spectrogram")
checkBox_spectrogram.setChecked(cfg.settings.value('Options/EnableSpectrogram', True, type=bool))
checkBox_bitrate_graph = self.findChild(QCheckBox, "checkBox_bitrate_graph")
checkBox_bitrate_graph.setChecked(cfg.settings.value('Options/EnableBitGraph', True, type=bool))
checkBox_aucdtect_scan = self.findChild(QCheckBox, "checkBox_aucdtect_scan")
checkBox_aucdtect_scan.setChecked(cfg.settings.value('Options/auCDtect_scan', False, type=bool))
horizontalSlider_aucdtect_mode = self.findChild(QSlider, "horizontalSlider_aucdtect_mode")
horizontalSlider_aucdtect_mode.setValue(cfg.settings.value('Options/auCDtect_mode', 8, type=int))
pushButton_mediainfo_path = self.findChild(QPushButton, "pushButton_mediainfo_path")
pushButton_mediainfo_path.clicked.connect(self.choosePathButton)
pushButton_mp3guessenc_path = self.findChild(QPushButton, "pushButton_mp3guessenc_path")
pushButton_mp3guessenc_path.clicked.connect(self.choosePathButton)
pushButton_sox_path = self.findChild(QPushButton, "pushButton_sox_path")
pushButton_sox_path.clicked.connect(self.choosePathButton)
pushButton_ffprobe_path = self.findChild(QPushButton, "pushButton_ffprobe_path")
pushButton_ffprobe_path.clicked.connect(self.choosePathButton)
pushButton_aucdtect_path = self.findChild(QPushButton, "pushButton_aucdtect_path")
pushButton_aucdtect_path.clicked.connect(self.choosePathButton)
buttonBox = self.findChild(QDialogButtonBox, "buttonBox")
buttonBox.button(QDialogButtonBox.Save).clicked.connect(self.saveSettings)
buttonBox.button(QDialogButtonBox.Discard).clicked.connect(self.close)
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(945, 652)
Dialog.setSizeGripEnabled(True)
self.verticalLayoutWidget = QtWidgets.QWidget(Dialog)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(50, 30, 411, 591))
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
self.xhorizontalSlider = QtWidgets.QSlider(self.verticalLayoutWidget)
self.xhorizontalSlider.setMaximum(360)
self.xhorizontalSlider.setOrientation(QtCore.Qt.Horizontal)
self.xhorizontalSlider.setObjectName("xhorizontalSlider")
self.horizontalLayout.addWidget(self.xhorizontalSlider)
self.verticalLayout_2.addLayout(self.horizontalLayout)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.label_3 = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label_3.setObjectName("label_3")
self.horizontalLayout_4.addWidget(self.label_3)
self.yhorizontalSlider = QtWidgets.QSlider(self.verticalLayoutWidget)
self.yhorizontalSlider.setMaximum(360)
self.yhorizontalSlider.setOrientation(QtCore.Qt.Horizontal)
self.yhorizontalSlider.setObjectName("yhorizontalSlider")
self.horizontalLayout_4.addWidget(self.yhorizontalSlider)
self.verticalLayout_2.addLayout(self.horizontalLayout_4)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.label_2 = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label_2.setObjectName("label_2")
self.horizontalLayout_3.addWidget(self.label_2)
self.zhorizontalSlider = QtWidgets.QSlider(self.verticalLayoutWidget)
self.zhorizontalSlider.setMaximum(360)
self.zhorizontalSlider.setOrientation(QtCore.Qt.Horizontal)
self.zhorizontalSlider.setObjectName("zhorizontalSlider")
self.horizontalLayout_3.addWidget(self.zhorizontalSlider)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
self.verticalLayout.addLayout(self.verticalLayout_2)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def drawUI(self):
self.alpha_rect = QLabel(self)
self.alpha_rect.setPixmap(QPixmap("black_alpha.png").scaled(320, 480, Qt.KeepAspectRatio, Qt.SmoothTransformation))
self.current_song = SongWidget(self)
self.current_song.drawUI()
self.current_song.move(40, 40)
self.line1 = QLabel(self)
self.line1.setPixmap(QPixmap('line.png').scaled(300, 1))
self.line1.move(10, 120)
self.time_line = QSlider(Qt.Horizontal, self)
self.time_line.setGeometry(40, 135, 240, 4)
self.time_line.setMaximum(157)
self.time_line.setMinimum(0)
self.time_line.setValue(0)
self.time_line.setStyleSheet("""QSlider::groove:horizontal
{background-color: rgba(128, 128, 128, 0.5); border: 1px solid rgba(128, 128, 128, 0.5); border-radius: 2px; height:4px;}
QSlider::handle:horizontal
{border: 1px solid #fff;width: 4px;height: 4px;border-radius: 2px; background-color: #fff;}
QSlider::sub-page:horizontal
{background-color: #fff;}
""")
self.time_line.sliderReleased.connect(self.changeTime)
self.rewind = RewindBtn(self)
self.rewind.move(50, 175)
self.play = StateBtn(self)
self.play.move(135, 165)
self.fastforward = ForwardBtn(self)
self.fastforward.move(220, 175)
self.line2 = QLabel(self)
self.line2.setPixmap(QPixmap('line.png').scaled(300, 1))
self.line2.move(10, 240)
self.r_song.append(SongWidget(self))
self.r_song[0].drawUI()
self.r_song[0].move(40, 270)
self.r_song.append(SongWidget(self))
self.r_song[1].drawUI()
self.r_song[1].move(40, 330)
self.r_song.append(SongWidget(self))
self.r_song[2].drawUI()#, song_loc="/Users/vidursatija/Music/iTunes/iTunes Media/Music/Halsey/hopeless fountain kingdom (Deluxe)/01 The Prologue.mp3")
self.r_song[2].move(40, 390)
self.timer = QTimer(self)
self.timer.timeout.connect(self.updateLabels)
self.timer.start(1000)
def setupUi(self, ImageSettingsUi):
ImageSettingsUi.setObjectName("ImageSettingsUi")
ImageSettingsUi.resize(332, 270)
self.gridLayout = QtWidgets.QGridLayout(ImageSettingsUi)
self.gridLayout.setObjectName("gridLayout")
self.groupBox_2 = QtWidgets.QGroupBox(ImageSettingsUi)
self.groupBox_2.setObjectName("groupBox_2")
self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_2)
self.gridLayout_2.setObjectName("gridLayout_2")
self.label_8 = QtWidgets.QLabel(self.groupBox_2)
self.label_8.setObjectName("label_8")
self.gridLayout_2.addWidget(self.label_8, 0, 0, 1, 2)
self.imageResolutionBox = QtWidgets.QComboBox(self.groupBox_2)
self.imageResolutionBox.setObjectName("imageResolutionBox")
self.gridLayout_2.addWidget(self.imageResolutionBox, 1, 0, 1, 2)
self.label_6 = QtWidgets.QLabel(self.groupBox_2)
self.label_6.setObjectName("label_6")
self.gridLayout_2.addWidget(self.label_6, 2, 0, 1, 2)
self.imageCodecBox = QtWidgets.QComboBox(self.groupBox_2)
self.imageCodecBox.setObjectName("imageCodecBox")
self.gridLayout_2.addWidget(self.imageCodecBox, 3, 0, 1, 2)
self.label_7 = QtWidgets.QLabel(self.groupBox_2)
self.label_7.setObjectName("label_7")
self.gridLayout_2.addWidget(self.label_7, 4, 0, 1, 1)
self.imageQualitySlider = QtWidgets.QSlider(self.groupBox_2)
self.imageQualitySlider.setMaximum(4)
self.imageQualitySlider.setOrientation(QtCore.Qt.Horizontal)
self.imageQualitySlider.setObjectName("imageQualitySlider")
self.gridLayout_2.addWidget(self.imageQualitySlider, 4, 1, 1, 1)
self.gridLayout.addWidget(self.groupBox_2, 0, 0, 1, 1)
spacerItem = QtWidgets.QSpacerItem(20, 14, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem, 1, 0, 1, 1)
self.buttonBox = QtWidgets.QDialogButtonBox(ImageSettingsUi)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1)
self.retranslateUi(ImageSettingsUi)
self.buttonBox.accepted.connect(ImageSettingsUi.accept)
self.buttonBox.rejected.connect(ImageSettingsUi.reject)
QtCore.QMetaObject.connectSlotsByName(ImageSettingsUi)
def setupUi(self, ImageSettingsUi):
ImageSettingsUi.setObjectName("ImageSettingsUi")
ImageSettingsUi.resize(332, 270)
self.gridLayout = QtWidgets.QGridLayout(ImageSettingsUi)
self.gridLayout.setObjectName("gridLayout")
self.groupBox_2 = QtWidgets.QGroupBox(ImageSettingsUi)
self.groupBox_2.setObjectName("groupBox_2")
self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_2)
self.gridLayout_2.setObjectName("gridLayout_2")
self.label_8 = QtWidgets.QLabel(self.groupBox_2)
self.label_8.setObjectName("label_8")
self.gridLayout_2.addWidget(self.label_8, 0, 0, 1, 2)
self.imageResolutionBox = QtWidgets.QComboBox(self.groupBox_2)
self.imageResolutionBox.setObjectName("imageResolutionBox")
self.gridLayout_2.addWidget(self.imageResolutionBox, 1, 0, 1, 2)
self.label_6 = QtWidgets.QLabel(self.groupBox_2)
self.label_6.setObjectName("label_6")
self.gridLayout_2.addWidget(self.label_6, 2, 0, 1, 2)
self.imageCodecBox = QtWidgets.QComboBox(self.groupBox_2)
self.imageCodecBox.setObjectName("imageCodecBox")
self.gridLayout_2.addWidget(self.imageCodecBox, 3, 0, 1, 2)
self.label_7 = QtWidgets.QLabel(self.groupBox_2)
self.label_7.setObjectName("label_7")
self.gridLayout_2.addWidget(self.label_7, 4, 0, 1, 1)
self.imageQualitySlider = QtWidgets.QSlider(self.groupBox_2)
self.imageQualitySlider.setMaximum(4)
self.imageQualitySlider.setOrientation(QtCore.Qt.Horizontal)
self.imageQualitySlider.setObjectName("imageQualitySlider")
self.gridLayout_2.addWidget(self.imageQualitySlider, 4, 1, 1, 1)
self.gridLayout.addWidget(self.groupBox_2, 0, 0, 1, 1)
spacerItem = QtWidgets.QSpacerItem(20, 14, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem, 1, 0, 1, 1)
self.buttonBox = QtWidgets.QDialogButtonBox(ImageSettingsUi)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1)
self.retranslateUi(ImageSettingsUi)
self.buttonBox.accepted.connect(ImageSettingsUi.accept)
self.buttonBox.rejected.connect(ImageSettingsUi.reject)
QtCore.QMetaObject.connectSlotsByName(ImageSettingsUi)
def _setup(self, filename):
self._viewport = Viewport(self, filename)
self._viewport.geometry_changed.connect(self._recenter)
self._viewport.playback_stopped.connect(self._playback_stopped)
self._isPlaying = True
self._hideTimer = None
yield from self._viewport.start_playing(filename)
toolbar = QtWidgets.QToolBar(self)
toolbar.setStyleSheet('QToolBar { background-color : rgba(255,255,255,100) ; color:white; border-color: transparent;} QToolButton{background-color : transparent;}')
rewind = toolbar.addAction(QtGui.QIcon('../icons/rewind.svg'), 'Rewind')
rewind.triggered.connect(self._rewind)
self._playPause = toolbar.addAction(QtGui.QIcon('../icons/pause.svg'), 'Play/pause')
self._playPause.triggered.connect(self._toggle_play_state)
stop = toolbar.addAction(QtGui.QIcon('../icons/stop.svg'), 'Stop')
stop.triggered.connect(self._stop_playback)
forward = toolbar.addAction(QtGui.QIcon('../icons/forward.svg'), 'Forward')
forward.triggered.connect(self._forward)
for cls in [SubtitleSelectionAction, AudioSelectionAction]:
action = cls(self._viewport.playbin, self)
toolbar.addAction(action)
btn = toolbar.widgetForAction(action)
btn.setPopupMode(btn.InstantPopup)
action.populate()
self._seeker = SeekSlider(self._viewport.playbin, self)
volume = QtWidgets.QSlider(QtCore.Qt.Horizontal)
volume.setMinimum(0)
volume.setMaximum(100)
volume.setValue(int(100 * self._viewport.playbin.volume))
volume.valueChanged.connect(self.changeVolume)
volume.setFixedWidth(100)
vlayout = QtWidgets.QVBoxLayout()
vlayout.setContentsMargins(3, 3, 3, 3)
vlayout.setSpacing(2)
hlayout = QtWidgets.QHBoxLayout()
hlayout.setContentsMargins(0, 0, 0, 0)
hlayout.addWidget(self._seeker.elapsedWidget())
hlayout.addWidget(toolbar, stretch=1)
hlayout.addWidget(self._seeker.remainingWidget())
vlayout.addLayout(hlayout)
hlayout = QtWidgets.QHBoxLayout()
vol = QtWidgets.QLabel('')
vol.setPixmap(QtGui.QIcon('../icons/volume.svg').pixmap(24, 24))
hlayout.addWidget(vol)
hlayout.addWidget(volume)
hlayout.addWidget(self._seeker, stretch=1)
vlayout.addLayout(hlayout)
self.setLayout(vlayout)
self._recenter()
self.show()
self.startHiding()
def setupUi(self, ImageSettingsUi):
ImageSettingsUi.setObjectName("ImageSettingsUi")
ImageSettingsUi.resize(332, 270)
self.gridLayout = QtWidgets.QGridLayout(ImageSettingsUi)
self.gridLayout.setObjectName("gridLayout")
self.groupBox_2 = QtWidgets.QGroupBox(ImageSettingsUi)
self.groupBox_2.setObjectName("groupBox_2")
self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_2)
self.gridLayout_2.setObjectName("gridLayout_2")
self.label_8 = QtWidgets.QLabel(self.groupBox_2)
self.label_8.setObjectName("label_8")
self.gridLayout_2.addWidget(self.label_8, 0, 0, 1, 2)
self.imageResolutionBox = QtWidgets.QComboBox(self.groupBox_2)
self.imageResolutionBox.setObjectName("imageResolutionBox")
self.gridLayout_2.addWidget(self.imageResolutionBox, 1, 0, 1, 2)
self.label_6 = QtWidgets.QLabel(self.groupBox_2)
self.label_6.setObjectName("label_6")
self.gridLayout_2.addWidget(self.label_6, 2, 0, 1, 2)
self.imageCodecBox = QtWidgets.QComboBox(self.groupBox_2)
self.imageCodecBox.setObjectName("imageCodecBox")
self.gridLayout_2.addWidget(self.imageCodecBox, 3, 0, 1, 2)
self.label_7 = QtWidgets.QLabel(self.groupBox_2)
self.label_7.setObjectName("label_7")
self.gridLayout_2.addWidget(self.label_7, 4, 0, 1, 1)
self.imageQualitySlider = QtWidgets.QSlider(self.groupBox_2)
self.imageQualitySlider.setMaximum(4)
self.imageQualitySlider.setOrientation(QtCore.Qt.Horizontal)
self.imageQualitySlider.setObjectName("imageQualitySlider")
self.gridLayout_2.addWidget(self.imageQualitySlider, 4, 1, 1, 1)
self.gridLayout.addWidget(self.groupBox_2, 0, 0, 1, 1)
spacerItem = QtWidgets.QSpacerItem(20, 14, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem, 1, 0, 1, 1)
self.buttonBox = QtWidgets.QDialogButtonBox(ImageSettingsUi)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1)
self.retranslateUi(ImageSettingsUi)
self.buttonBox.accepted.connect(ImageSettingsUi.accept)
self.buttonBox.rejected.connect(ImageSettingsUi.reject)
QtCore.QMetaObject.connectSlotsByName(ImageSettingsUi)