def widgets(self): ########################progress bar############# self.progressBar = QProgressBar() self.progressBar.setTextVisible(False) self.progressBar.setStyleSheet(style.progressBarStyle()) ########################Labels################### self.songTimerLabel = QLabel("0:00") self.songLenthLabel = QLabel("/ 0:00") #######################Buttons################### self.addButton = QToolButton() self.addButton.setIcon(QIcon("icons/add.png")) self.addButton.setIconSize(QSize(48, 48)) self.addButton.setToolTip("Add a Song") self.addButton.clicked.connect(self.addSound) self.shuffleButton = QToolButton() self.shuffleButton.setIcon(QIcon("icons/shuffle.png")) self.shuffleButton.setIconSize(QSize(48, 48)) self.shuffleButton.setToolTip("Shuffle The list") self.shuffleButton.clicked.connect(self.shufflePlayList) self.previousButton = QToolButton() self.previousButton.setIcon(QIcon("icons/previous.png")) self.previousButton.setIconSize(QSize(48, 48)) self.previousButton.setToolTip("Play Previous") self.previousButton.clicked.connect(self.playPrevious) self.playButton = QToolButton() self.playButton.setIcon(QIcon("icons/play.png")) self.playButton.setIconSize(QSize(64, 64)) self.playButton.setToolTip("Play") self.playButton.clicked.connect(self.playSounds) self.nextButton = QToolButton() self.nextButton.setIcon(QIcon("icons/next.png")) self.nextButton.setIconSize(QSize(48, 48)) self.nextButton.setToolTip("Play Next") self.nextButton.clicked.connect(self.playNext) self.muteButton = QToolButton() self.muteButton.setIcon(QIcon("icons/mute.png")) self.muteButton.setIconSize(QSize(24, 24)) self.muteButton.setToolTip("Mute") self.muteButton.clicked.connect(self.muteSound) #####################Volume Slider################# self.volumeSlider = QSlider(Qt.Horizontal) self.volumeSlider.setToolTip("Volume") self.volumeSlider.setValue(70) self.volumeSlider.setMinimum(0) self.volumeSlider.setMaximum(100) mixer.music.set_volume(0.7) self.volumeSlider.valueChanged.connect(self.setVolume) ###################Play List#################### self.playList = QListWidget() self.playList.doubleClicked.connect(self.playSounds) self.playList.setStyleSheet(style.playListStyle()) #####################Timer###################### self.timer = QTimer() self.timer.setInterval(1000) self.timer.timeout.connect(self.updateProgressBar)
def widgets(self): # ProgressBar self.progressBar = QProgressBar() self.progressBar.setTextVisible( False) # To remove % symbol on the progressbar self.progressBar.setStyleSheet(style.progressBarStyle()) # Song Length Labels self.songTimerLabel = QLabel('0:00') self.songTimerLabel.setStyleSheet(style.LabelStyle()) self.songLengthLabel = QLabel('/ 0:00') self.songLengthLabel.setStyleSheet(style.LabelStyle()) # Buttons self.addButton = QToolButton() self.addButton.setIcon(QIcon('icons\\add.png')) self.addButton.setIconSize(QSize(48, 48)) # x and y Values self.addButton.setToolTip('Add a song') self.addButton.clicked.connect(self.addSongs) self.addButton.setStyleSheet(style.playStyle()) self.shuffleButton = QToolButton() self.shuffleButton.setIcon(QIcon('icons\\shuffle.png')) self.shuffleButton.setIconSize(QSize(48, 48)) # x and y Values self.shuffleButton.setToolTip('Shuffle songs') self.shuffleButton.clicked.connect(self.shufflePlayList) self.shuffleButton.setStyleSheet(style.playStyle()) self.previousButton = QToolButton() self.previousButton.setIcon(QIcon('icons\\previous.png')) self.previousButton.setIconSize(QSize(48, 48)) # x and y Values self.previousButton.setToolTip('Previous song') self.previousButton.clicked.connect(self.playPrevious) self.previousButton.setStyleSheet(style.playStyle()) self.playButton = QToolButton() self.playButton.setIcon(QIcon('icons\\play.png')) self.playButton.setIconSize(QSize(64, 64)) # x and y Values self.playButton.setToolTip('Play') self.playButton.clicked.connect(self.playSong) self.playButton.setStyleSheet(style.playStyle()) self.nextButton = QToolButton() self.nextButton.setIcon(QIcon('icons\\next.png')) self.nextButton.setIconSize(QSize(48, 48)) # x and y Values self.nextButton.setToolTip('Next song') self.nextButton.clicked.connect(self.playNext) self.nextButton.setStyleSheet(style.playStyle()) self.muteButton = QToolButton() self.muteButton.setIcon(QIcon('icons\\mute.png')) self.muteButton.setIconSize(QSize(48, 48)) # x and y Values self.muteButton.setToolTip('Mute') self.muteButton.clicked.connect(self.muteSong) self.muteButton.setStyleSheet(style.playStyle()) # Volume Slider self.volumeSlider = QSlider(Qt.Horizontal) self.volumeSlider.setToolTip('Volume') self.volumeSlider.setValue(70) self.volumeSlider.setMinimum(0) self.volumeSlider.setMaximum(100) mixer.music.set_volume(0.7) self.volumeSlider.valueChanged.connect(self.setVolume) self.volumeSlider.setStyleSheet(style.sliderStyle()) # Play List self.playList = QListWidget() self.playList.doubleClicked.connect(self.playSong) self.playList.setStyleSheet(style.playListStyle()) # Timer for Progress BAr self.timer = QTimer() self.timer.setInterval(1000) self.timer.timeout.connect(self.updateProgressBar)