def layouts(self): #########################Creating Layouts################# self.mainLayout = QVBoxLayout() self.topMainLayout = QVBoxLayout() self.topGroupBox = QGroupBox("Müzik Çalar") self.topGroupBox.setStyleSheet(style.groupboxStyle()) self.topLayout = QHBoxLayout() self.middleLayout = QHBoxLayout() self.bottomLayout = QVBoxLayout() ###################Adding Widgets######################### ##################Top layout widgets###################### self.topLayout.addWidget(self.progressBar) self.topLayout.addWidget(self.songTimerLabel) self.topLayout.addWidget(self.songLenthLabel) ##################Middle layout Widget################# self.middleLayout.addStretch() self.middleLayout.addWidget(self.addButton) self.middleLayout.addWidget(self.shuffleButton) self.middleLayout.addWidget(self.playButton) self.middleLayout.addWidget(self.previousButton) self.middleLayout.addWidget(self.nextButton) self.middleLayout.addWidget(self.volumeSlider) self.middleLayout.addWidget(self.muteButton) self.middleLayout.addWidget(self.addButton) self.middleLayout.addStretch() ###################Bottom layout widget############# self.bottomLayout.addWidget(self.playList) self.topMainLayout.addLayout(self.topLayout) self.topMainLayout.addLayout(self.middleLayout) self.topGroupBox.setLayout(self.topMainLayout) self.mainLayout.addWidget(self.topGroupBox, 25) self.mainLayout.addLayout(self.bottomLayout, 75) self.setLayout(self.mainLayout)
def style_ui_widgets(self): font = QFont('Arial', 20, QFont.Bold) self.left_group_layout.setStyleSheet(style.groupboxStyle()) self.scan_btn.setStyleSheet("background-color: #d8ffcf;") self.scan_btn.setIcon(QIcon('cctv.png')) self.scan_btn.setIconSize(QtCore.QSize(90, 70)) self.hits_btn.setStyleSheet("background-color: #b9a3c7 ;") self.next_btn.setStyleSheet("background-color: #cbc6f7") self.next_btn.setIcon(QIcon('next.png')) self.next_btn.setIconSize(QtCore.QSize(90, 70)) self.back_btn.setStyleSheet("background-color: #b3ffff;") self.back_btn.setIcon(QIcon('back.png')) self.back_btn.setIconSize(QtCore.QSize(90, 70)) self.totalscan_btn.setStyleSheet("background-color:#ffd9cc;") self.time_label.setFont(font) self.project.setFont(QFont('Arial', 10, QFont.Bold)) self.time_label.setStyleSheet("border-radius:15px;") self.vehicle_table.setStyleSheet(style.groupboxStyle()) self.hits_tb.setStyleSheet(style.groupboxStyle()) self.vehicle_table.setStyleSheet( "background-color: #f2f2f2; border-radius:20px; border:5px solid gray;" ) self.hits_tb.setStyleSheet( "background-color: #f2f2f2; border-radius:20px; border:5px solid gray;" ) self.time_label.setStyleSheet( "border:5px solid gray; border-radius:95px;background-color: #cbc6f7" ) self.date_label.setStyleSheet( "border:5px solid gray; border-radius:95px;background-color: #cbc6f7" ) self.project.setStyleSheet( "border:5px solid gray; border-radius:95px;background-color: #cbc6f7" ) self.search_btn.setStyleSheet( "border:0px #D3D3D3; border-radius:0px;background-color: #D3D3D3") self.search_btn.setStyleSheet('QPushButton {color: #f6f6f6}') self.date_label.setFont(font) self.scan_btn.setFont(QFont('Arial', 20, QFont.Bold)) self.next_btn.setFont(QFont('Arial', 20, QFont.Bold)) self.search_btn.setFont(QFont('Arial', 40, QFont.Courier)) self.hits_btn.setFont(QFont('Arial', 40, QFont.Bold)) self.totalscan_btn.setFont(QFont('Arial', 40, QFont.Bold)) self.back_btn.setFont(QFont('Arial', 20, QFont.Bold)) self.scan_btn.setText('Scan') self.next_btn.setText('Next') self.search_btn.setText('Find') self.search_btn.setEnabled(False) self.hits_btn.setText('Hits') self.back_btn.setText('Back') self.project.setText( 'Automated Vehicle Identification and Recognition System') # self.qr_label.setFont(font) # self.date_label.resize(80, 80)d # self.scan_img_label.resize(300, 300) # self.scan_btn.resize(120, 120) self.next_btn.resize(120, 120) self.scan_img_label.setStyleSheet( "border:5px solid gray; border-radius:15px;") self.date_label.setText(self.date.toString(Qt.ISODate)) # self.date_label.setStyleSheet("Backgroundcolor: (255, 255, 255)") self.date_label.setGeometry(220, 150, 100, 100) self.time_label.setGeometry(200, 150, 100, 100)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.setEnabled(True) MainWindow.setGeometry(450, 50, 480, 700) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.mainlayout = QtWidgets.QVBoxLayout(self.centralwidget) self.mainlayout.setObjectName("mainlayout") self.topgroupBox = QtWidgets.QGroupBox(self.centralwidget) font = QtGui.QFont() font.setFamily("Comic Sans MS") font.setPointSize(12) self.topgroupBox.setFont(font) self.topgroupBox.setStyleSheet("background-color:#fcc324\n" "") self.topgroupBox.setObjectName("topgroupBox") self.verticalLayout = QtWidgets.QVBoxLayout(self.topgroupBox) self.verticalLayout.setObjectName("verticalLayout") self.topLayout = QtWidgets.QHBoxLayout() self.topLayout.setObjectName("topLayout") self.progressBar = QtWidgets.QProgressBar(self.topgroupBox) self.progressBar.setProperty("value", 0) self.progressBar.setTextVisible(False) self.progressBar.setStyleSheet(style.progressbarStyle()) self.progressBar.setObjectName("progressBar") self.topLayout.addWidget(self.progressBar) self.verticalLayout.addLayout(self.topLayout) self.middleLayout = QtWidgets.QHBoxLayout() self.middleLayout.setContentsMargins(0, -1, -1, -1) self.middleLayout.setObjectName("middleLayout") self.middleLayout.addStretch() self.addButton = QtWidgets.QToolButton(self.topgroupBox) self.addButton.setStyleSheet("border:0\n" "\n" "") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("assests/add.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.addButton.setIcon(icon) self.addButton.setIconSize(QtCore.QSize(48, 48)) self.addButton.setObjectName("addButton") self.middleLayout.addWidget(self.addButton) self.shuffleButton = QtWidgets.QToolButton(self.topgroupBox) self.shuffleButton.setStyleSheet("border:0") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap("assests/shuffle.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.shuffleButton.setIcon(icon1) self.shuffleButton.setIconSize(QtCore.QSize(48, 48)) self.shuffleButton.setObjectName("shuffleButton") self.middleLayout.addWidget(self.shuffleButton) self.playButton = QtWidgets.QToolButton(self.topgroupBox) self.playButton.setStyleSheet("border:0") icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap("assests/play.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.playButton.setIcon(icon2) self.playButton.setIconSize(QtCore.QSize(64, 64)) self.playButton.setObjectName("playButton") self.middleLayout.addWidget(self.playButton) self.previousButton = QtWidgets.QToolButton(self.topgroupBox) self.previousButton.setStyleSheet("border:0\n" "") icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap("assests/previous.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.previousButton.setIcon(icon3) self.previousButton.setIconSize(QtCore.QSize(48, 48)) self.previousButton.setObjectName("previousButton") self.middleLayout.addWidget(self.previousButton) self.nextButton = QtWidgets.QToolButton(self.topgroupBox) self.nextButton.setStyleSheet("border:0") icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap("assests/next.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.nextButton.setIcon(icon4) self.nextButton.setIconSize(QtCore.QSize(48, 48)) self.nextButton.setObjectName("nextButton") self.middleLayout.addWidget(self.nextButton) self.volumeSlider = QtWidgets.QSlider(self.topgroupBox) self.volumeSlider.setOrientation(QtCore.Qt.Horizontal) self.volumeSlider.setObjectName("volumeSlider") self.middleLayout.addWidget(self.volumeSlider) self.muteButton = QtWidgets.QToolButton(self.topgroupBox) self.muteButton.setStyleSheet("border:0") icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap("assests/mute.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.muteButton.setIcon(icon5) self.muteButton.setIconSize(QtCore.QSize(24, 24)) self.muteButton.setObjectName("muteButton") self.middleLayout.addStretch() self.middleLayout.addWidget(self.muteButton) self.verticalLayout.addLayout(self.middleLayout) self.mainlayout.addWidget(self.topgroupBox, 25) self.bottomLayout = QtWidgets.QVBoxLayout() self.bottomLayout.setSizeConstraint( QtWidgets.QLayout.SetDefaultConstraint) self.bottomLayout.setObjectName("bottomLayout") self.playlist = QtWidgets.QListWidget(self.centralwidget) self.playlist.setObjectName("playlist") self.playlist.doubleClicked.connect(self.playsong_1) self.bottomLayout.addWidget(self.playlist) self.mainlayout.addLayout(self.bottomLayout, 75) MainWindow.setCentralWidget(self.centralwidget) self.songTimerLabel = QtWidgets.QLabel("0:00") self.songLengthLabel = QtWidgets.QLabel("/ 0:00") self.topLayout.addWidget(self.songTimerLabel) self.topLayout.addWidget(self.songLengthLabel) self.addButton.clicked.connect(self.addSound) self.shuffleButton.clicked.connect(self.shuffleplaylist) self.playButton.clicked.connect(self.playsong) self.volumeSlider.setMinimum(0) self.volumeSlider.setMaximum(100) self.volumeSlider.setValue(70) mixer.music.set_volume(0.7) self.volumeSlider.valueChanged.connect(self.setvolume) self.muteButton.clicked.connect(self.mutesong) self.previousButton.clicked.connect(self.previoussong) self.nextButton.clicked.connect(self.nextsong) self.topgroupBox.setStyleSheet(style.groupboxStyle()) self.playlist.setStyleSheet(style.playliststyle()) self.timer = QTimer() self.timer.setInterval(1000) self.timer.timeout.connect(self.updateprogressbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)