def setupCheckArea(self): checkArea = QWidget() checkAreaLayout = QHBoxLayout() self.switchLeft = QPushButton() self.switchLeft.setIcon( QIcon(SvgHelper.getQPixmapFromBytes(left, QSize(20, 20)))) self.switchLeft.setIconSize(QSize(20, 20)) self.switchLeft.resize(20, 20) self.switchLeft.setStyleSheet("QPushButton{border-style: none;}") self.switchLeft.setCursor(QCursor(Qt.PointingHandCursor)) self.switchRight = QPushButton() self.switchRight.setIcon( QIcon(SvgHelper.getQPixmapFromBytes(right, QSize(20, 20)))) self.switchRight.setIconSize(QSize(20, 20)) self.switchRight.resize(20, 20) self.switchRight.setStyleSheet("QPushButton{border-style: none;}") self.switchRight.setCursor(QCursor(Qt.PointingHandCursor)) self.checkStacked = QStackedWidget() checkAreaLayout.addStretch(1) checkAreaLayout.addWidget(self.switchLeft, 1, alignment=Qt.AlignLeft) checkAreaLayout.addWidget(self.checkStacked, 10) checkAreaLayout.addWidget(self.switchRight, 1, alignment=Qt.AlignRight) checkAreaLayout.addStretch(1) checkArea.setLayout(checkAreaLayout) self.mainLayout.addWidget(checkArea, 3, alignment=Qt.AlignVCenter)
def setupWindowNav(self): windowNav = QWidget() windowNavLayout = QHBoxLayout() self.windowNavClose = QPushButton() self.windowNavClose.setIcon( QIcon(SvgHelper.getQPixmapFromBytes(close, QSize(12, 12)))) self.windowNavClose.setIconSize(QSize(12, 12)) self.windowNavClose.resize(12, 12) self.windowNavClose.setStyleSheet( "QPushButton{background-color: transparent; border-style:none; padding: 3px 3px 3px 3px;} QPushButton:hover{background-color: #eeeeee; border-style:none; border-radius:5px; padding: 3px 3px 3px 3px;} QPushButton:pressed{background-color: #999999; border-style:none; border-radius:5px; padding: 3px 3px 3px 3px;}" ) self.windowNavClose.setCursor(QCursor(Qt.PointingHandCursor)) self.windowNavMaximize = QPushButton() self.windowNavMaximize.setIcon( QIcon(SvgHelper.getQPixmapFromBytes(maximize, QSize(12, 12)))) self.windowNavMaximize.setIconSize(QSize(12, 12)) self.windowNavMaximize.resize(12, 12) self.windowNavMaximize.setStyleSheet( "QPushButton{background-color: transparent; border-style:none; padding: 3px 3px 3px 3px;} QPushButton:hover{background-color: #eeeeee; border-style:none; border-radius:5px; padding: 3px 3px 3px 3px;} QPushButton:pressed{background-color: #999999; border-style:none; border-radius:5px; padding: 3px 3px 3px 3px;}" ) self.windowNavMaximize.setCursor(QCursor(Qt.PointingHandCursor)) self.windowNavMinimize = QPushButton() self.windowNavMinimize.setIcon( QIcon(SvgHelper.getQPixmapFromBytes(minimize, QSize(12, 12)))) self.windowNavMinimize.setIconSize(QSize(12, 12)) self.windowNavMinimize.resize(12, 12) self.windowNavMinimize.setStyleSheet( "QPushButton{background-color: transparent; border-style:none; padding: 3px 3px 3px 3px;} QPushButton:hover{background-color: #eeeeee; border-style:none; border-radius:5px; padding: 3px 3px 3px 3px;} QPushButton:pressed{background-color: #999999; border-style:none; border-radius:5px; padding: 3px 3px 3px 3px;}" ) self.windowNavMinimize.setCursor(QCursor(Qt.PointingHandCursor)) self.adminView = QPushButton() self.adminView.setIcon( QIcon(SvgHelper.getQPixmapFromBytes(adminView, QSize(12, 12)))) self.adminView.setIconSize(QSize(12, 12)) self.adminView.resize(12, 12) self.adminView.setStyleSheet( "QPushButton{background-color: transparent; border-style:none; padding: 3px 3px 3px 3px;} QPushButton:hover{background-color: #eeeeee; border-style:none; border-radius:5px; padding: 3px 3px 3px 3px;} QPushButton:pressed{background-color: #999999; border-style:none; border-radius:5px; padding: 3px 3px 3px 3px;}" ) self.adminView.setCursor(QCursor(Qt.PointingHandCursor)) windowNavLayout.addStretch() windowNavLayout.addWidget(self.adminView) windowNavLayout.addWidget(self.windowNavMinimize) windowNavLayout.addWidget(self.windowNavMaximize) windowNavLayout.addWidget(self.windowNavClose) windowNav.setLayout(windowNavLayout) self.mainLayout.addWidget(windowNav, alignment=Qt.AlignTop)
def setupDialogNav(self): dialogNav = QWidget() dialogNavLayout = QHBoxLayout() self.dialogNavTitle = QLabel() self.dialogNavTitle.setFont(QFont("Noto Sans TC Regular", 10)) self.dialogNavTitle.setAlignment(Qt.AlignLeft) self.dialogNavClose = QPushButton() self.dialogNavClose.setIcon( QIcon(SvgHelper.getQPixmapFromBytes(close, QSize(12, 12)))) self.dialogNavClose.setIconSize(QSize(12, 12)) self.dialogNavClose.resize(12, 12) self.dialogNavClose.setStyleSheet( "QPushButton{background-color: transparent; border-style:none; padding: 3px 3px 3px 3px;} QPushButton:hover{background-color: #eeeeee; border-style:none; border-radius:5px; padding: 3px 3px 3px 3px;} QPushButton:pressed{background-color: #999999; border-style:none; border-radius:5px; padding: 3px 3px 3px 3px;}" ) self.dialogNavClose.setCursor(QCursor(Qt.PointingHandCursor)) dialogNavLayout.addWidget(self.dialogNavTitle) dialogNavLayout.addStretch(1) dialogNavLayout.addWidget(self.dialogNavClose) dialogNav.setLayout(dialogNavLayout) self.mainLayout.addWidget(dialogNav, alignment=Qt.AlignTop)
def setupUi(self, Splash): Splash.setObjectName("Splash") Splash.resize(600, 400) Splash.setFixedSize(600, 400) Splash.setAutoFillBackground(True) Splash.setStyleSheet("QWidget{background-color: #F7931E;}") Splash.setWindowFlags(Qt.FramelessWindowHint) self.retranslateUi(Splash) QMetaObject.connectSlotsByName(Splash) self.mainLayout = QVBoxLayout(Splash) self.logo = QLabel() self.logo.setPixmap(SvgHelper.getQPixmapFromBytes(logoWhite, QSize(185.04,108.26))) self.logo.setScaledContents(True) self.logo.setFixedSize(185.04, 108.26) self.logo.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.logo.setAlignment(Qt.AlignCenter) self.title = QLabel() self.title.setText("淡江資訊處工讀考勤系統") self.title.setAlignment(Qt.AlignCenter) self.title.setFont(QFont("微軟正黑體", 14)) self.title.setStyleSheet("QLabel{color: white;}") self.title.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.status = QLabel() self.status.setText("啟動中 請稍後") self.status.setAlignment(Qt.AlignCenter) self.status.setFont(QFont("微軟正黑體", 12)) self.status.setStyleSheet("QLabel{color:white;}") self.mainLayout.addStretch(3) self.mainLayout.addWidget(self.logo, 4, Qt.AlignCenter) self.mainLayout.addStretch(3) self.mainLayout.addWidget(self.title, 1, Qt.AlignCenter) self.mainLayout.addWidget(self.status, 1, Qt.AlignCenter) self.mainLayout.addStretch(3)
def retranslateUi(self, EditShiftCellDialog): _translate = QCoreApplication.translate EditShiftCellDialog.setWindowTitle( _translate("EditShiftCellDialog", "班別編修")) EditShiftCellDialog.setWindowIcon( QIcon(SvgHelper.getQPixmapFromBytes(logoIcon, QSize(512, 512))))
def retranslateUi(self, ImportArrangementDialog): _translate = QCoreApplication.translate ImportArrangementDialog.setWindowTitle( _translate("ImportArrangementDialog", "班表匯入")) ImportArrangementDialog.setWindowIcon( QIcon(SvgHelper.getQPixmapFromBytes(logoIcon, QSize(512, 512))))
def retranslateUi(self, MessageDialog): _translate = QCoreApplication.translate MessageDialog.setWindowTitle(_translate("MessageDialog", "")) MessageDialog.setWindowIcon( QIcon(SvgHelper.getQPixmapFromBytes(logoIcon, QSize(512, 512))))
from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * from win32event import CreateMutex from winerror import ERROR_ALREADY_EXISTS from win32api import GetLastError from window.Splash import Splash from utils.SvgHelper import SvgHelper from icon.svg import logoIcon import sys import globals globals.mutex = CreateMutex(None, False, "TKUInfoCenterClient") if GetLastError() == ERROR_ALREADY_EXISTS: sys.exit(0) app = QApplication(sys.argv) app.setWindowIcon( QIcon(SvgHelper.getQPixmapFromBytes(logoIcon, QSize(512, 512)))) globals.window = Splash() globals.window.show() sys.exit(app.exec_())
def retranslateUi(self, IntervalDialog): _translate = QCoreApplication.translate IntervalDialog.setWindowTitle(_translate("IntervalDialog", "指定區間匯出")) IntervalDialog.setWindowIcon( QIcon(SvgHelper.getQPixmapFromBytes(logoIcon, QSize(512, 512))))
def retranslateUi(self, EditTodayScheduleDialog): _translate = QCoreApplication.translate EditTodayScheduleDialog.setWindowTitle(_translate("EditTodayScheduleDialog", "臨時調班")) EditTodayScheduleDialog.setWindowIcon(QIcon(SvgHelper.getQPixmapFromBytes(logoIcon, QSize(512, 512))))
def retranslateUi(self, MainWindow): _translate = QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "淡江資訊處 工讀考勤系統")) MainWindow.setWindowIcon( QIcon(SvgHelper.getQPixmapFromBytes(logoIcon, QSize(512, 512))))
def retranslateUi(self, CheckAuthDialog): _translate = QCoreApplication.translate CheckAuthDialog.setWindowTitle(_translate("CheckAuthDialog", "管理員驗證")) CheckAuthDialog.setWindowIcon( QIcon(SvgHelper.getQPixmapFromBytes(logoIcon, QSize(512, 512))))
def retranslateUi(self, Splash): _translate = QCoreApplication.translate Splash.setWindowTitle(_translate("Splash", "淡江資訊處 工讀考勤系統")) Splash.setWindowIcon(QIcon(SvgHelper.getQPixmapFromBytes(logoIcon, QSize(512,512))))
def retranslateUi(self, AboutDialog): _translate = QCoreApplication.translate AboutDialog.setWindowTitle(_translate("AboutDialog", "關於系統")) AboutDialog.setWindowIcon( QIcon(SvgHelper.getQPixmapFromBytes(logoIcon, QSize(512, 512))))