Optimize theme style
This commit is contained in:
parent
f015d766ba
commit
b243efc063
70
MangoSift.py
70
MangoSift.py
|
@ -21,7 +21,7 @@ import usb.backend.libusb0
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QMessageBox, QMenu, QAction, QWidget, QVBoxLayout, QTableWidget, QTableWidgetItem, QLabel, QFrame
|
from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QMessageBox, QMenu, QAction, QWidget, QVBoxLayout, QTableWidget, QTableWidgetItem, QLabel, QFrame
|
||||||
from PyQt5.QtCore import Qt, QCoreApplication, QPropertyAnimation, pyqtSignal, QEasingCurve, QPoint
|
from PyQt5.QtCore import Qt, QCoreApplication, QPropertyAnimation, pyqtSignal, QEasingCurve, QPoint
|
||||||
from PyQt5.QtGui import QPixmap, QFont, QIcon
|
from PyQt5.QtGui import QPixmap, QFont, QIcon, QPalette, QColor
|
||||||
|
|
||||||
|
|
||||||
def _fd(f):
|
def _fd(f):
|
||||||
|
@ -232,6 +232,55 @@ def get_date_timestamp():
|
||||||
class FloatingWindow(QWidget):
|
class FloatingWindow(QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
dark_palette = QPalette()
|
||||||
|
dark_palette.setColor(QPalette.Window, QColor(62, 62, 62))
|
||||||
|
self.setPalette(dark_palette)
|
||||||
|
self.setStyleSheet('')
|
||||||
|
self.setStyleSheet("""
|
||||||
|
QMainWindow {
|
||||||
|
border: 1px solid #626262;
|
||||||
|
}
|
||||||
|
QDialog {
|
||||||
|
border: 1px solid #626262;
|
||||||
|
}
|
||||||
|
QLabel {
|
||||||
|
color: #FCFCFC;
|
||||||
|
}
|
||||||
|
QLineEdit {
|
||||||
|
background: #2A2A2A;
|
||||||
|
border: 2px solid #444;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 5px;
|
||||||
|
color: white;
|
||||||
|
selection-color: rgba(255, 255, 255, 0.95);
|
||||||
|
selection-background-color: rgba(245, 245, 245, 0.15);
|
||||||
|
}
|
||||||
|
QTableWidget {
|
||||||
|
background: #3f3f3f;
|
||||||
|
border: 2px solid #6c6c6c;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 5px;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
QHeaderView::section {
|
||||||
|
background-color: #444;
|
||||||
|
color: white;
|
||||||
|
padding: 4px;
|
||||||
|
border: 1px solid #555;
|
||||||
|
}
|
||||||
|
QTableWidget::item {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
QPushButton {
|
||||||
|
background: #444;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
QPushButton:hover {
|
||||||
|
background: #555;
|
||||||
|
}
|
||||||
|
""")
|
||||||
self.animation = None
|
self.animation = None
|
||||||
self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint | Qt.Tool)
|
self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint | Qt.Tool)
|
||||||
self.setAttribute(Qt.WA_TranslucentBackground, False)
|
self.setAttribute(Qt.WA_TranslucentBackground, False)
|
||||||
|
@ -247,7 +296,7 @@ class FloatingWindow(QWidget):
|
||||||
self.table.verticalHeader().setVisible(False)
|
self.table.verticalHeader().setVisible(False)
|
||||||
self.table.setShowGrid(True)
|
self.table.setShowGrid(True)
|
||||||
self.table.horizontalHeader().setStretchLastSection(True)
|
self.table.horizontalHeader().setStretchLastSection(True)
|
||||||
self.table.setFixedHeight(90)
|
self.table.setFixedHeight(125)
|
||||||
|
|
||||||
font = QFont('Consolas', 9)
|
font = QFont('Consolas', 9)
|
||||||
self.table.setFont(font)
|
self.table.setFont(font)
|
||||||
|
@ -255,18 +304,19 @@ class FloatingWindow(QWidget):
|
||||||
self.table.setColumnWidth(0, 64)
|
self.table.setColumnWidth(0, 64)
|
||||||
self.table.setColumnWidth(1, 280)
|
self.table.setColumnWidth(1, 280)
|
||||||
self.layout.addWidget(self.table)
|
self.layout.addWidget(self.table)
|
||||||
|
|
||||||
self.image_frame = QFrame()
|
self.image_frame = QFrame()
|
||||||
self.image_frame.setFrameShape(QFrame.Box)
|
self.image_frame.setFrameShape(QFrame.Box)
|
||||||
self.image_frame.setLineWidth(1)
|
self.image_frame.setLineWidth(1)
|
||||||
self.image_frame.setStyleSheet('background-color: white; border: 1px solid gray;')
|
self.image_frame.setStyleSheet('border: 1px solid gray;')
|
||||||
self.image_frame.setFixedSize(380, 190)
|
self.image_frame.setFixedSize(380, 190)
|
||||||
self.image_label = QLabel()
|
self.image_label = QLabel()
|
||||||
|
self.image_label.setAlignment(Qt.AlignCenter)
|
||||||
self.image_image = QVBoxLayout()
|
self.image_image = QVBoxLayout()
|
||||||
|
self.image_image.addStretch()
|
||||||
self.image_image.addWidget(self.image_label)
|
self.image_image.addWidget(self.image_label)
|
||||||
|
self.image_image.addStretch()
|
||||||
self.image_frame.setLayout(self.image_image)
|
self.image_frame.setLayout(self.image_image)
|
||||||
self.layout.addWidget(self.image_frame, 0, Qt.AlignCenter)
|
self.layout.addWidget(self.image_frame, 0, Qt.AlignCenter)
|
||||||
|
|
||||||
self.alert_label = QLabel()
|
self.alert_label = QLabel()
|
||||||
self.alert_label.setAlignment(Qt.AlignLeft)
|
self.alert_label.setAlignment(Qt.AlignLeft)
|
||||||
self.alert_label.setStyleSheet('padding: 0px 2px 0px 2px; color: red; font-family: \"Microsoft YaHei\";')
|
self.alert_label.setStyleSheet('padding: 0px 2px 0px 2px; color: red; font-family: \"Microsoft YaHei\";')
|
||||||
|
@ -337,7 +387,7 @@ class FloatingWindow(QWidget):
|
||||||
self.move(s_pos)
|
self.move(s_pos)
|
||||||
self.show()
|
self.show()
|
||||||
self.animation = QPropertyAnimation(self, b'pos')
|
self.animation = QPropertyAnimation(self, b'pos')
|
||||||
self.animation.setDuration(250)
|
self.animation.setDuration(450)
|
||||||
self.animation.setStartValue(s_pos)
|
self.animation.setStartValue(s_pos)
|
||||||
self.animation.setEndValue(e_pos)
|
self.animation.setEndValue(e_pos)
|
||||||
self.animation.setEasingCurve(QEasingCurve.OutQuad)
|
self.animation.setEasingCurve(QEasingCurve.OutQuad)
|
||||||
|
@ -348,7 +398,7 @@ class FloatingWindow(QWidget):
|
||||||
c_pos = self.pos()
|
c_pos = self.pos()
|
||||||
e_pos = QPoint(c_pos.x(), QApplication.desktop().screenGeometry().height())
|
e_pos = QPoint(c_pos.x(), QApplication.desktop().screenGeometry().height())
|
||||||
self.animation = QPropertyAnimation(self, b'pos')
|
self.animation = QPropertyAnimation(self, b'pos')
|
||||||
self.animation.setDuration(380)
|
self.animation.setDuration(520)
|
||||||
self.animation.setStartValue(c_pos)
|
self.animation.setStartValue(c_pos)
|
||||||
self.animation.setEndValue(e_pos)
|
self.animation.setEndValue(e_pos)
|
||||||
self.animation.setEasingCurve(QEasingCurve.InQuad)
|
self.animation.setEasingCurve(QEasingCurve.InQuad)
|
||||||
|
@ -517,7 +567,7 @@ class MainWindow(QSystemTrayIcon):
|
||||||
print('%s%s' % ('', e))
|
print('%s%s' % ('', e))
|
||||||
self.floating_window and self.floating_window.set_alert('%s' % (e,))
|
self.floating_window and self.floating_window.set_alert('%s' % (e,))
|
||||||
if (data is not None) == 1:
|
if (data is not None) == 1:
|
||||||
table_data = [['BARCODE', data['MAIN_BARCODE']], ['DID', data['DID']], ['MODEL', data['MODEL']], ['COLOR', data['COLOR']]]
|
table_data = [['BARCODE', data['MAIN_BARCODE']], ['DID', data['DID']], ['MODEL', data['MODEL']], ['COLOR', data['COLOR']], ['FIRMWARE', data['FW_VER']]]
|
||||||
try:
|
try:
|
||||||
if table_data:
|
if table_data:
|
||||||
self.floating_window and self.floating_window.set_table_data(table_data)
|
self.floating_window and self.floating_window.set_table_data(table_data)
|
||||||
|
@ -540,7 +590,7 @@ class MainWindow(QSystemTrayIcon):
|
||||||
def run_task(self):
|
def run_task(self):
|
||||||
try:
|
try:
|
||||||
while self.running:
|
while self.running:
|
||||||
time.sleep(0.75)
|
time.sleep(0.55)
|
||||||
self.update_device()
|
self.update_device()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('Monitor has exited.')
|
print('Monitor has exited.')
|
||||||
|
@ -552,7 +602,7 @@ class MainRunner:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
signal.signal(signal.SIGINT, self._handle_interrupt)
|
signal.signal(signal.SIGINT, self._handle_interrupt)
|
||||||
self.app_name = 'MangoSift'
|
self.app_name = 'MangoSift'
|
||||||
self.app_version = '1.0.0.4'
|
self.app_version = '1.0.0.5'
|
||||||
self.app_publisher = 'zhaoyafan'
|
self.app_publisher = 'zhaoyafan'
|
||||||
self.app_publisher_url = 'https://www.fanscloud.net/'
|
self.app_publisher_url = 'https://www.fanscloud.net/'
|
||||||
self.application = None
|
self.application = None
|
||||||
|
|
BIN
UNKNOWN.PNG
BIN
UNKNOWN.PNG
Binary file not shown.
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 54 KiB |
Loading…
Reference in New Issue