create my toolbox -- first commit

This commit is contained in:
2025-09-26 08:39:05 +08:00
parent 34c74bf3d0
commit bb3ae1e65a
273 changed files with 903 additions and 1052 deletions

View File

@@ -1,14 +0,0 @@
## README
###
### 收支记录
### 图片处理
### 颜色拾取
### 密码管理

View File

@@ -1,10 +0,0 @@
{
"username": "admin",
"login_password": "MkzWVYJoL5o2wDJOsExlS+qCElrJj+P6Rxiy89XwP7I=",
"unlock_password": "MkzWVYJoL5o2wDJOsExlS+qCElrJj+P6Rxiy89XwP7I=",
"code_dict": [4, 11, 4, 31, 22, 12, 19, 23, 7, 16, 7, 23, 1, 8, 7, 18, 27, 32, 28, 25, 7, 32, 9, 15, 2, 32, 0, 12, 26, 15, 14, 17],
"minimum_password_length": 8,
"maximum_db_number": 10,
"api_ali": "",
"api_wechat": ""
}

View File

@@ -1,230 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>App</class>
<widget class="QMainWindow" name="App">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>769</width>
<height>356</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>Consolas</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Toolbox</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,5">
<item>
<widget class="QListWidget" name="lw_navigation">
<item>
<property name="text">
<string>个人</string>
</property>
</item>
<item>
<property name="text">
<string>实用</string>
</property>
</item>
<item>
<property name="text">
<string>效率</string>
</property>
</item>
<item>
<property name="text">
<string>开发</string>
</property>
</item>
<item>
<property name="text">
<string>设计</string>
</property>
</item>
<item>
<property name="text">
<string>工作</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="sw_pages">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>110</x>
<y>70</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>1</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_2">
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>100</x>
<y>130</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>2</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_3">
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>130</x>
<y>70</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>3</string>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<property name="movable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="ac_homepage"/>
<addaction name="ac_settings"/>
<addaction name="ac_logs"/>
<addaction name="ac_about"/>
<addaction name="ac_caging"/>
<addaction name="ac_quit"/>
</widget>
<action name="ac_homepage">
<property name="text">
<string>主页</string>
</property>
<property name="toolTip">
<string>Ctrl+Alt+H</string>
</property>
<property name="shortcut">
<string>Ctrl+Alt+H</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="ac_settings">
<property name="text">
<string>设置</string>
</property>
<property name="toolTip">
<string>Ctrl+Alt+S</string>
</property>
<property name="shortcut">
<string>Ctrl+Alt+S</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="ac_logs">
<property name="text">
<string>日志</string>
</property>
<property name="toolTip">
<string>Ctrl+Alt+L</string>
</property>
<property name="shortcut">
<string>Ctrl+Alt+L</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="ac_about">
<property name="text">
<string>关于</string>
</property>
<property name="toolTip">
<string>Ctrl+Alt+A</string>
</property>
<property name="shortcut">
<string>Ctrl+Alt+A</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="ac_quit">
<property name="text">
<string>退出</string>
</property>
<property name="toolTip">
<string>Ctrl+Alt+Q</string>
</property>
<property name="shortcut">
<string>Ctrl+Alt+Q</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="ac_caging">
<property name="text">
<string>锁定</string>
</property>
<property name="toolTip">
<string>Ctrl+Alt+C</string>
</property>
<property name="shortcut">
<string>Ctrl+Alt+C</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -1,218 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>login</class>
<widget class="QWidget" name="login">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>150</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>450</width>
<height>150</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>450</width>
<height>150</height>
</size>
</property>
<property name="windowTitle">
<string>登录</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="lb_logo">
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>105</width>
<height>105</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="indent">
<number>-1</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lb_none">
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="labelAlignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
<property name="formAlignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
<property name="leftMargin">
<number>30</number>
</property>
<property name="topMargin">
<number>15</number>
</property>
<property name="rightMargin">
<number>30</number>
</property>
<property name="bottomMargin">
<number>15</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lb_username">
<property name="font">
<font>
<family>Consolas</family>
<pointsize>12</pointsize>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Username</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_username">
<property name="font">
<font>
<family>Consolas</family>
<pointsize>12</pointsize>
</font>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lb_password">
<property name="font">
<font>
<family>Consolas</family>
<pointsize>12</pointsize>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="le_password">
<property name="font">
<font>
<family>Consolas</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="echoMode">
<enum>QLineEdit::EchoMode::Password</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>40</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>40</number>
</property>
<property name="bottomMargin">
<number>20</number>
</property>
<item>
<widget class="QPushButton" name="pb_login">
<property name="font">
<font>
<family>Consolas</family>
<pointsize>12</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>登录</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_cancel">
<property name="font">
<font>
<family>Consolas</family>
<pointsize>12</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>取消</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -1,7 +0,0 @@
from pathlib import Path
from threading import Lock
base_path = Path(__file__).resolve().parent.parent.parent
lock = Lock()
account = None

View File

@@ -1,186 +0,0 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'app.ui'
##
## Created by: Qt User Interface Compiler version 6.9.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient,
QCursor, QFont, QFontDatabase, QGradient,
QIcon, QImage, QKeySequence, QLinearGradient,
QPainter, QPalette, QPixmap, QRadialGradient,
QTransform)
from PySide6.QtWidgets import (QApplication, QHBoxLayout, QLabel, QListWidget,
QListWidgetItem, QMainWindow, QSizePolicy, QStackedWidget,
QStatusBar, QToolBar, QVBoxLayout, QWidget)
class Ui_App(object):
def setupUi(self, App):
if not App.objectName():
App.setObjectName(u"App")
App.resize(769, 356)
App.setMinimumSize(QSize(0, 0))
font = QFont()
font.setFamilies([u"Consolas"])
font.setPointSize(12)
App.setFont(font)
self.ac_homepage = QAction(App)
self.ac_homepage.setObjectName(u"ac_homepage")
self.ac_homepage.setMenuRole(QAction.MenuRole.NoRole)
self.ac_settings = QAction(App)
self.ac_settings.setObjectName(u"ac_settings")
self.ac_settings.setMenuRole(QAction.MenuRole.NoRole)
self.ac_logs = QAction(App)
self.ac_logs.setObjectName(u"ac_logs")
self.ac_logs.setMenuRole(QAction.MenuRole.NoRole)
self.ac_about = QAction(App)
self.ac_about.setObjectName(u"ac_about")
self.ac_about.setMenuRole(QAction.MenuRole.NoRole)
self.ac_quit = QAction(App)
self.ac_quit.setObjectName(u"ac_quit")
self.ac_quit.setMenuRole(QAction.MenuRole.NoRole)
self.ac_caging = QAction(App)
self.ac_caging.setObjectName(u"ac_caging")
self.ac_caging.setMenuRole(QAction.MenuRole.NoRole)
self.centralwidget = QWidget(App)
self.centralwidget.setObjectName(u"centralwidget")
self.verticalLayout = QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(u"verticalLayout")
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.lw_navigation = QListWidget(self.centralwidget)
QListWidgetItem(self.lw_navigation)
QListWidgetItem(self.lw_navigation)
QListWidgetItem(self.lw_navigation)
QListWidgetItem(self.lw_navigation)
QListWidgetItem(self.lw_navigation)
QListWidgetItem(self.lw_navigation)
self.lw_navigation.setObjectName(u"lw_navigation")
self.horizontalLayout.addWidget(self.lw_navigation)
self.sw_pages = QStackedWidget(self.centralwidget)
self.sw_pages.setObjectName(u"sw_pages")
self.page = QWidget()
self.page.setObjectName(u"page")
self.label_3 = QLabel(self.page)
self.label_3.setObjectName(u"label_3")
self.label_3.setGeometry(QRect(110, 70, 54, 16))
self.sw_pages.addWidget(self.page)
self.page_2 = QWidget()
self.page_2.setObjectName(u"page_2")
self.label_2 = QLabel(self.page_2)
self.label_2.setObjectName(u"label_2")
self.label_2.setGeometry(QRect(100, 130, 54, 16))
self.sw_pages.addWidget(self.page_2)
self.page_3 = QWidget()
self.page_3.setObjectName(u"page_3")
self.label = QLabel(self.page_3)
self.label.setObjectName(u"label")
self.label.setGeometry(QRect(130, 70, 54, 16))
self.sw_pages.addWidget(self.page_3)
self.horizontalLayout.addWidget(self.sw_pages)
self.horizontalLayout.setStretch(0, 1)
self.horizontalLayout.setStretch(1, 5)
self.verticalLayout.addLayout(self.horizontalLayout)
App.setCentralWidget(self.centralwidget)
self.statusbar = QStatusBar(App)
self.statusbar.setObjectName(u"statusbar")
App.setStatusBar(self.statusbar)
self.toolBar = QToolBar(App)
self.toolBar.setObjectName(u"toolBar")
self.toolBar.setMovable(False)
App.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.toolBar)
self.toolBar.addAction(self.ac_homepage)
self.toolBar.addAction(self.ac_settings)
self.toolBar.addAction(self.ac_logs)
self.toolBar.addAction(self.ac_about)
self.toolBar.addAction(self.ac_caging)
self.toolBar.addAction(self.ac_quit)
self.retranslateUi(App)
self.sw_pages.setCurrentIndex(0)
QMetaObject.connectSlotsByName(App)
# setupUi
def retranslateUi(self, App):
App.setWindowTitle(QCoreApplication.translate("App", u"Toolbox", None))
self.ac_homepage.setText(QCoreApplication.translate("App", u"\u4e3b\u9875", None))
#if QT_CONFIG(tooltip)
self.ac_homepage.setToolTip(QCoreApplication.translate("App", u"Ctrl+Alt+H", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(shortcut)
self.ac_homepage.setShortcut(QCoreApplication.translate("App", u"Ctrl+Alt+H", None))
#endif // QT_CONFIG(shortcut)
self.ac_settings.setText(QCoreApplication.translate("App", u"\u8bbe\u7f6e", None))
#if QT_CONFIG(tooltip)
self.ac_settings.setToolTip(QCoreApplication.translate("App", u"Ctrl+Alt+S", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(shortcut)
self.ac_settings.setShortcut(QCoreApplication.translate("App", u"Ctrl+Alt+S", None))
#endif // QT_CONFIG(shortcut)
self.ac_logs.setText(QCoreApplication.translate("App", u"\u65e5\u5fd7", None))
#if QT_CONFIG(tooltip)
self.ac_logs.setToolTip(QCoreApplication.translate("App", u"Ctrl+Alt+L", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(shortcut)
self.ac_logs.setShortcut(QCoreApplication.translate("App", u"Ctrl+Alt+L", None))
#endif // QT_CONFIG(shortcut)
self.ac_about.setText(QCoreApplication.translate("App", u"\u5173\u4e8e", None))
#if QT_CONFIG(tooltip)
self.ac_about.setToolTip(QCoreApplication.translate("App", u"Ctrl+Alt+A", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(shortcut)
self.ac_about.setShortcut(QCoreApplication.translate("App", u"Ctrl+Alt+A", None))
#endif // QT_CONFIG(shortcut)
self.ac_quit.setText(QCoreApplication.translate("App", u"\u9000\u51fa", None))
#if QT_CONFIG(tooltip)
self.ac_quit.setToolTip(QCoreApplication.translate("App", u"Ctrl+Alt+Q", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(shortcut)
self.ac_quit.setShortcut(QCoreApplication.translate("App", u"Ctrl+Alt+Q", None))
#endif // QT_CONFIG(shortcut)
self.ac_caging.setText(QCoreApplication.translate("App", u"\u9501\u5b9a", None))
#if QT_CONFIG(tooltip)
self.ac_caging.setToolTip(QCoreApplication.translate("App", u"Ctrl+Alt+C", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(shortcut)
self.ac_caging.setShortcut(QCoreApplication.translate("App", u"Ctrl+Alt+C", None))
#endif // QT_CONFIG(shortcut)
__sortingEnabled = self.lw_navigation.isSortingEnabled()
self.lw_navigation.setSortingEnabled(False)
___qlistwidgetitem = self.lw_navigation.item(0)
___qlistwidgetitem.setText(QCoreApplication.translate("App", u"\u4e2a\u4eba", None));
___qlistwidgetitem1 = self.lw_navigation.item(1)
___qlistwidgetitem1.setText(QCoreApplication.translate("App", u"\u5b9e\u7528", None));
___qlistwidgetitem2 = self.lw_navigation.item(2)
___qlistwidgetitem2.setText(QCoreApplication.translate("App", u"\u6548\u7387", None));
___qlistwidgetitem3 = self.lw_navigation.item(3)
___qlistwidgetitem3.setText(QCoreApplication.translate("App", u"\u5f00\u53d1", None));
___qlistwidgetitem4 = self.lw_navigation.item(4)
___qlistwidgetitem4.setText(QCoreApplication.translate("App", u"\u8bbe\u8ba1", None));
___qlistwidgetitem5 = self.lw_navigation.item(5)
___qlistwidgetitem5.setText(QCoreApplication.translate("App", u"\u5de5\u4f5c", None));
self.lw_navigation.setSortingEnabled(__sortingEnabled)
self.label_3.setText(QCoreApplication.translate("App", u"1", None))
self.label_2.setText(QCoreApplication.translate("App", u"2", None))
self.label.setText(QCoreApplication.translate("App", u"3", None))
self.toolBar.setWindowTitle(QCoreApplication.translate("App", u"toolBar", None))
# retranslateUi

View File

@@ -1,147 +0,0 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'login.ui'
##
## Created by: Qt User Interface Compiler version 6.9.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QFormLayout, QHBoxLayout, QLabel,
QLineEdit, QPushButton, QSizePolicy, QVBoxLayout,
QWidget)
class Ui_login(object):
def setupUi(self, login):
if not login.objectName():
login.setObjectName(u"login")
login.resize(450, 150)
sizePolicy = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(login.sizePolicy().hasHeightForWidth())
login.setSizePolicy(sizePolicy)
login.setMinimumSize(QSize(450, 150))
login.setMaximumSize(QSize(450, 150))
self.verticalLayout_3 = QVBoxLayout(login)
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
self.horizontalLayout_2 = QHBoxLayout()
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.verticalLayout_2 = QVBoxLayout()
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
self.lb_logo = QLabel(login)
self.lb_logo.setObjectName(u"lb_logo")
self.lb_logo.setMinimumSize(QSize(100, 100))
self.lb_logo.setMaximumSize(QSize(105, 105))
self.lb_logo.setScaledContents(True)
self.lb_logo.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.lb_logo.setMargin(0)
self.lb_logo.setIndent(-1)
self.verticalLayout_2.addWidget(self.lb_logo)
self.lb_none = QLabel(login)
self.lb_none.setObjectName(u"lb_none")
self.lb_none.setMinimumSize(QSize(0, 40))
self.verticalLayout_2.addWidget(self.lb_none)
self.horizontalLayout_2.addLayout(self.verticalLayout_2)
self.verticalLayout = QVBoxLayout()
self.verticalLayout.setObjectName(u"verticalLayout")
self.formLayout = QFormLayout()
self.formLayout.setObjectName(u"formLayout")
self.formLayout.setLabelAlignment(Qt.AlignmentFlag.AlignCenter)
self.formLayout.setFormAlignment(Qt.AlignmentFlag.AlignCenter)
self.formLayout.setContentsMargins(30, 15, 30, 15)
self.lb_username = QLabel(login)
self.lb_username.setObjectName(u"lb_username")
font = QFont()
font.setFamilies([u"Consolas"])
font.setPointSize(12)
font.setItalic(True)
self.lb_username.setFont(font)
self.formLayout.setWidget(0, QFormLayout.ItemRole.LabelRole, self.lb_username)
self.le_username = QLineEdit(login)
self.le_username.setObjectName(u"le_username")
font1 = QFont()
font1.setFamilies([u"Consolas"])
font1.setPointSize(12)
self.le_username.setFont(font1)
self.formLayout.setWidget(0, QFormLayout.ItemRole.FieldRole, self.le_username)
self.lb_password = QLabel(login)
self.lb_password.setObjectName(u"lb_password")
self.lb_password.setFont(font)
self.formLayout.setWidget(1, QFormLayout.ItemRole.LabelRole, self.lb_password)
self.le_password = QLineEdit(login)
self.le_password.setObjectName(u"le_password")
self.le_password.setFont(font1)
self.le_password.setEchoMode(QLineEdit.EchoMode.Password)
self.formLayout.setWidget(1, QFormLayout.ItemRole.FieldRole, self.le_password)
self.verticalLayout.addLayout(self.formLayout)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.horizontalLayout.setContentsMargins(40, 0, 40, 20)
self.pb_login = QPushButton(login)
self.pb_login.setObjectName(u"pb_login")
font2 = QFont()
font2.setFamilies([u"Consolas"])
font2.setPointSize(12)
font2.setBold(True)
self.pb_login.setFont(font2)
self.pb_login.setAutoDefault(True)
self.horizontalLayout.addWidget(self.pb_login)
self.pb_cancel = QPushButton(login)
self.pb_cancel.setObjectName(u"pb_cancel")
self.pb_cancel.setFont(font2)
self.pb_cancel.setAutoDefault(True)
self.horizontalLayout.addWidget(self.pb_cancel)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_2.addLayout(self.verticalLayout)
self.verticalLayout_3.addLayout(self.horizontalLayout_2)
self.retranslateUi(login)
QMetaObject.connectSlotsByName(login)
# setupUi
def retranslateUi(self, login):
login.setWindowTitle(QCoreApplication.translate("login", u"\u767b\u5f55", None))
self.lb_logo.setText("")
self.lb_none.setText("")
self.lb_username.setText(QCoreApplication.translate("login", u"Username", None))
self.lb_password.setText(QCoreApplication.translate("login", u"Password", None))
self.pb_login.setText(QCoreApplication.translate("login", u"\u767b\u5f55", None))
self.pb_cancel.setText(QCoreApplication.translate("login", u"\u53d6\u6d88", None))
# retranslateUi

View File

@@ -1,223 +0,0 @@
import json
import random
import sys
from typing import Callable, Any
from PySide6.QtWidgets import QApplication, QWidget, QMessageBox, QMainWindow, QHBoxLayout, QVBoxLayout, QLineEdit, QLabel
from PySide6.QtGui import QIcon, QPixmap, QShortcut, QResizeEvent, QFont, QKeySequence
from PySide6.QtCore import Qt,QSize
from codes.ui.login import Ui_login
from codes.ui.app import Ui_App
from codes.common.worker import Worker
from codes.common import clibs
from codes.common.secure_encrypt import PassCipher
from codes.common import db_operation
class LoginWindow(QWidget, Ui_login):
def __init__(self):
super().__init__()
self.setupUi(self)
self.pre_dos()
def pre_dos(self):
self.setWindowIcon(QIcon(f"{clibs.base_path}/assets/media/icon.ico"))
self.lb_logo.setPixmap(QPixmap(f"{clibs.base_path}/assets/media/avatar.png"))
self.lb_logo.setScaledContents(True)
# bindings
QShortcut("Esc", self).activated.connect(self.close)
self.pb_login.clicked.connect(self.login)
self.pb_cancel.clicked.connect(self.close)
self.le_password.returnPressed.connect(self.login)
def login(self):
def login_failed():
QMessageBox.warning(self, "告警", "\n用户名或密码不正确,请重新输入!")
self.le_username.setText("")
self.le_password.setText("")
def validate_login():
nonlocal username, password
with open(f"{clibs.base_path}/assets/conf/config.json", mode="rt", encoding="utf-8") as f_conf:
clibs.account = json.load(f_conf)
if username != clibs.account["username"] or len(password) < clibs.account["minimum_password_length"]:
login_failed()
return False
salt = PassCipher.gen_salt(password)
cipher = PassCipher(salt)
# password_encrypt = cipher.encrypt(password)
# print(f"password_encrypt = {password_encrypt}")
# exit()
try:
decrypt_password = cipher.decrypt(clibs.account["login_password"])
except ValueError:
login_failed()
return False
if password != decrypt_password:
login_failed()
return False
self.mainWindow = MainWindow()
self.mainWindow.show()
self.deleteLater()
return True
username = self.le_username.text()
password = self.le_password.text()
validate_login()
class MainWindow(QMainWindow, Ui_App):
def __init__(self):
super().__init__()
self.conn = None
self.cursor = None
self.thread = None
self.setupUi(self)
self.pre_dos()
self.lock_overlay = None
def pre_dos(self):
self.setWindowIcon(QIcon(f"{clibs.base_path}/assets/media/icon.ico"))
db_operation.db_backup()
self.conn, self.cursor = db_operation.db_conn()
# bindings
self.ac_quit.triggered.connect(self.close)
self.ac_caging.triggered.connect(self.lock_window)
self.ac_logs.triggered.connect(lambda : print("test ac log"))
def launch(self, func, on_anything: Callable[..., Any] = print, *args, **kwargs):
self.thread = Worker(func, *args, **kwargs)
self.thread.started.connect(lambda: on_anything({"started": True}))
self.thread.result.connect(on_anything)
self.thread.error.connect(on_anything)
self.thread.finished.connect(lambda: on_anything({"finished": True}))
self.thread.start()
def lock_window(self):
def unlock():
def check_failed():
QMessageBox.warning(self, "错误", "\n密码错误,请重新输入!")
le_password.clear()
le_password.setFocus()
password = le_password.text()
if len(password) < clibs.account["minimum_password_length"]:
check_failed()
return False
salt = PassCipher.gen_salt(password)
cipher = PassCipher(salt)
try:
decrypt_password = cipher.decrypt(clibs.account["unlock_password"])
except ValueError:
check_failed()
return False
if password != decrypt_password:
check_failed()
return False
self.lock_overlay.deleteLater()
self.lock_overlay = None
self.set_shortcuts(True)
return True
def gen_lock_screen():
# generate lock screen
v_layout = QVBoxLayout(self.lock_overlay) # v layout
v_layout.setObjectName(u"v_layout")
h_layout = QHBoxLayout() # h layout
h_layout.setObjectName(u"h_layout")
h_layout.setContentsMargins(-1, -1, 10, 50)
lb_e_1 = QLabel(self.lock_overlay)
lb_e_1.setObjectName(u"lb_e_1")
h_layout.addWidget(lb_e_1)
lb_password = QLabel(self.lock_overlay)
lb_password.setObjectName(u"lb_password")
lb_password.setMinimumSize(QSize(100, 0))
lb_password.setMaximumSize(QSize(100, 16777215))
font = QFont()
font.setFamilies([u"Consolas"])
font.setPointSize(14)
font.setBold(True)
font.setItalic(True)
lb_password.setFont(font)
lb_password.setAlignment(Qt.AlignmentFlag.AlignCenter)
lb_password.setText("Password")
h_layout.addWidget(lb_password)
le_password = QLineEdit(self.lock_overlay)
le_password.setObjectName(u"le_password")
le_password.setMinimumSize(QSize(200, 0))
le_password.setFont(font)
le_password.setEchoMode(QLineEdit.EchoMode.Password)
h_layout.addWidget(le_password)
lb_e_2 = QLabel(self.lock_overlay)
lb_e_2.setObjectName(u"lb_e_2")
h_layout.addWidget(lb_e_2)
h_layout.setStretch(0, 5)
h_layout.setStretch(1, 2)
h_layout.setStretch(2, 3)
h_layout.setStretch(3, 5)
v_layout.addLayout(h_layout)
return le_password
self.set_shortcuts(False)
if not self.lock_overlay:
self.lock_overlay = QWidget(self)
self.lock_overlay.setObjectName("w_overlay")
cx = random.random()
cy = random.random()
stop1 = random.random()
stop2 = random.random()
angle = random.randint(0, 360)
self.lock_overlay.setStyleSheet(f"""background: qconicalgradient(cx:{cx}, cy:{cy}, angle:{angle}, stop:0 #f6f8fa, stop:{stop1} #eef1f5, stop:{stop2} #dce1e8);""")
# self.lock_overlay.setStyleSheet("""background: qconicalgradient(cx:0.5, cy:0.5, angle:45, stop:0 #f6f8fa, stop:0.5 #eef1f5, stop:1 #dce1e8);""")
le_password = gen_lock_screen()
le_password.returnPressed.connect(unlock)
self.lock_overlay.setGeometry(self.rect())
self.lock_overlay.show()
le_password.setFocus()
def set_shortcuts(self, stat: bool = True):
if stat:
self.ac_homepage.setShortcut(QKeySequence("Ctrl+Alt+H"))
self.ac_settings.setShortcut(QKeySequence("Ctrl+Alt+S"))
self.ac_logs.setShortcut(QKeySequence("Ctrl+Alt+L"))
self.ac_about.setShortcut(QKeySequence("Ctrl+Alt+A"))
self.ac_caging.setShortcut(QKeySequence("Ctrl+Alt+C"))
self.ac_quit.setShortcut(QKeySequence("Ctrl+Alt+Q"))
else:
self.ac_homepage.setShortcut(QKeySequence())
self.ac_settings.setShortcut(QKeySequence())
self.ac_logs.setShortcut(QKeySequence())
self.ac_about.setShortcut(QKeySequence())
self.ac_caging.setShortcut(QKeySequence())
self.ac_quit.setShortcut(QKeySequence())
def resizeEvent(self, event: QResizeEvent):
super().resizeEvent(event)
if self.lock_overlay:
self.lock_overlay.setGeometry(self.rect())
def closeEvent(self, event):
reply = QMessageBox.question(self, "退出", "\n程序可能在运行,确定要退出吗?")
if reply == QMessageBox.StandardButton.Yes:
db_operation.db_close(self.conn, self.cursor)
event.accept()
else:
event.ignore()
if __name__ == '__main__':
app = QApplication(sys.argv)
login = LoginWindow()
login.show()
sys.exit(app.exec())

View File

@@ -13,4 +13,5 @@ dependencies = [
"pyinstaller>=6.15.0",
"pymodbus>=3.11.1",
"pyside6>=6.9.2",
"zhdate>=0.1",
]

View File

@@ -1,5 +1,5 @@
{
"ip_addr": "192.168.2.160",
"ip_addr": "192.168.0.160",
"ssh_port": "22",
"socket_port": 5050,
"xService_port": 6666,

View File

@@ -0,0 +1,7 @@
{
"minimum_password_length": 8,
"maximum_db_number": 10,
"database_path": "",
"api_ali_pay": "",
"api_wechat_pay": ""
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Some files were not shown because too many files have changed in this diff Show More