After Width: | Height: | Size: 174 KiB |
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/software.iml" filepath="$PROJECT_DIR$/.idea/software.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -0,0 +1,48 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
|
def get_weather_data(token, location):
|
||||||
|
# 构建 API URL
|
||||||
|
url = f"https://api.caiyunapp.com/v2.6/{token}/{location}/weather?dailysteps=3&hourlysteps=48"
|
||||||
|
|
||||||
|
try:
|
||||||
|
# 发送 GET 请求
|
||||||
|
response = requests.get(url)
|
||||||
|
# 检查请求是否成功
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
# 解析 JSON 数据
|
||||||
|
weather_data = response.json()
|
||||||
|
|
||||||
|
return weather_data
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
print(f"Error fetching data: {e}")
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def extract_precipitation_probability(weather_data):
|
||||||
|
# 检查天气数据是否有效
|
||||||
|
if weather_data and 'result' in weather_data and 'hourly' in weather_data['result']:
|
||||||
|
# 提取降水概率数据
|
||||||
|
precipitation_data = weather_data['result']['hourly'].get('precipitation', [])
|
||||||
|
|
||||||
|
# 返回第一个降水概率
|
||||||
|
if precipitation_data:
|
||||||
|
return precipitation_data[0].get("probability") # 返回第一个概率
|
||||||
|
else:
|
||||||
|
return None # 如果没有数据,则返回 None
|
||||||
|
else:
|
||||||
|
return None # 如果 weather_data 不符合条件,则返回 None
|
||||||
|
|
||||||
|
|
||||||
|
def interpret_precipitation_probability(probability):
|
||||||
|
if probability is not None:
|
||||||
|
probability = float(probability) # 确保是浮点数
|
||||||
|
if probability >= 50:
|
||||||
|
return "根据降水概率,预计会下雨,请携带雨具。"
|
||||||
|
elif probability > 0:
|
||||||
|
return "降水概率较低,但可能会有小雨,请留意天气。"
|
||||||
|
else:
|
||||||
|
return "预计不会下雨。"
|
||||||
|
else:
|
||||||
|
return "无法获取降水概率。"
|
||||||
|
|
@ -0,0 +1,159 @@
|
|||||||
|
import requests
|
||||||
|
import psycopg2
|
||||||
|
|
||||||
|
import config
|
||||||
|
from interface import * # 导入界面组件
|
||||||
|
|
||||||
|
class Active_arrangement:
|
||||||
|
def __init__(self, ui):
|
||||||
|
self.ui = ui
|
||||||
|
# 连接日历组件的 clicked 信号到处理函数
|
||||||
|
self.ui.calendarWidget.clicked.connect(self.handle_date_click)
|
||||||
|
# 获取天气信息
|
||||||
|
token = "9b946754f72e513dd4d7950b67ed8ae3" # 替换为你的 API token
|
||||||
|
city_id = "120110" # 替换为你要查询的地理位置
|
||||||
|
weather_data = self.get_weather_data(token, city_id)
|
||||||
|
|
||||||
|
# 提取天气信息
|
||||||
|
weather_message = self.extract_weather_info(weather_data)
|
||||||
|
weather_message, _ = weather_message # 只提取第一个元素
|
||||||
|
|
||||||
|
# 将天气信息插入到 weatherlabel
|
||||||
|
self.ui.weatherlabel.setText(f"天气: {weather_message}")
|
||||||
|
|
||||||
|
def handle_date_click(self, date):
|
||||||
|
# 获取选中日期,并格式化为 "yyyy-MM-dd"
|
||||||
|
selected_date = self.ui.calendarWidget.selectedDate().toString("yyyy-MM-dd")
|
||||||
|
|
||||||
|
# 获取该日期的已注册活动信息
|
||||||
|
activities = self.get_registered_activities(selected_date)
|
||||||
|
self.populate_activity_table(activities)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def get_weather_data(self, token, city_id):
|
||||||
|
url = f"https://restapi.amap.com/v3/weather/weatherInfo?city={city_id}&key={token}"
|
||||||
|
response = requests.get(url)
|
||||||
|
return response.json()
|
||||||
|
|
||||||
|
def extract_weather_info(self, weather_data):
|
||||||
|
if weather_data['status'] == '1':
|
||||||
|
# 提取实况天气信息
|
||||||
|
live_info = weather_data['lives'][0] # 取第一个元素
|
||||||
|
weather_message = (
|
||||||
|
f"省份:{live_info['province']}\n"
|
||||||
|
f"城市:{live_info['city']}\n"
|
||||||
|
f"天气现象:{live_info['weather']}\n"
|
||||||
|
f"实时气温:{live_info['temperature']}°C\n"
|
||||||
|
f"风向:{live_info['winddirection']}\n"
|
||||||
|
f"风力:{live_info['windpower']}级\n"
|
||||||
|
f"湿度:{live_info['humidity']}%\n"
|
||||||
|
f"数据发布时间:{live_info['reporttime']}\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
# 提取预报天气信息
|
||||||
|
forecast_message = ""
|
||||||
|
if 'forecast' in weather_data:
|
||||||
|
forecast_info = weather_data['forecast']
|
||||||
|
forecast_message = "预报天气信息:\n"
|
||||||
|
for cast in forecast_info['casts']:
|
||||||
|
forecast_message += (
|
||||||
|
f"日期:{cast['date']}\n"
|
||||||
|
f"星期:{cast['week']}\n"
|
||||||
|
f"白天天气:{cast['dayweather']}\n"
|
||||||
|
f"晚上天气:{cast['nightweather']}\n"
|
||||||
|
f"白天温度:{cast['daytemp']}°C\n"
|
||||||
|
f"晚上温度:{cast['nighttemp']}°C\n"
|
||||||
|
f"白天风向:{cast['daywind']}\n"
|
||||||
|
f"晚上风向:{cast['nightwind']}\n"
|
||||||
|
f"白天风力:{cast['daypower']}级\n"
|
||||||
|
f"晚上风力:{cast['nightpower']}级\n\n"
|
||||||
|
)
|
||||||
|
weather_message += forecast_message
|
||||||
|
|
||||||
|
# 计算是否适合出门
|
||||||
|
suitable_for_outdoor = self.is_suitable_for_outdoor(live_info)
|
||||||
|
|
||||||
|
return weather_message, suitable_for_outdoor
|
||||||
|
|
||||||
|
return "无法获取天气信息", False # 确保返回一个有效的元组
|
||||||
|
|
||||||
|
def is_suitable_for_outdoor(self, weather_info):
|
||||||
|
temperature = int(weather_info['temperature'])
|
||||||
|
humidity = int(weather_info['humidity'])
|
||||||
|
wind_power_str = weather_info['windpower'].strip() # 去掉前后空格
|
||||||
|
wind_power = int(''.join(filter(str.isdigit, wind_power_str))) # 提取数字部分并转换为整数
|
||||||
|
|
||||||
|
# 基于温度、湿度和风力的更复杂规则判断是否适合出门
|
||||||
|
if temperature < 10:
|
||||||
|
self.show_message("温馨提示", "温度过低,不适合出门。")
|
||||||
|
return False
|
||||||
|
elif temperature > 30:
|
||||||
|
self.show_message("温馨提示", "温度过高,不适合出门。")
|
||||||
|
return False
|
||||||
|
elif humidity >= 80:
|
||||||
|
self.show_message("温馨提示", "湿度过高,可能会下雨,建议取消活动。")
|
||||||
|
return False
|
||||||
|
elif wind_power > 5: # 假设风力超过5级不适合出门
|
||||||
|
self.show_message("温馨提示", "风力过大,不适合出门。")
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def handle_weather_adjustment(self, suitable_for_outdoor):
|
||||||
|
if not suitable_for_outdoor:
|
||||||
|
# 如果不适合出门,可以自动取消户外活动或者调整活动
|
||||||
|
self.show_message("活动调整", "当前天气不适合进行户外活动,建议调整或取消。")
|
||||||
|
# 可以进一步添加取消或重新安排的逻辑
|
||||||
|
|
||||||
|
def show_message(self, title, message):
|
||||||
|
msg_box = QtWidgets.QMessageBox()
|
||||||
|
msg_box.setWindowTitle(title)
|
||||||
|
msg_box.setText(message)
|
||||||
|
msg_box.exec_()
|
||||||
|
|
||||||
|
def populate_activity_table(self, activities):
|
||||||
|
"""
|
||||||
|
将活动信息填充到 arrangetableWidget
|
||||||
|
"""
|
||||||
|
self.ui.arrangetableWidget.setRowCount(0) # 清空现有内容
|
||||||
|
for row, activity in enumerate(activities):
|
||||||
|
self.ui.arrangetableWidget.insertRow(row)
|
||||||
|
# 插入活动信息,例如活动名称和时间
|
||||||
|
self.ui.arrangetableWidget.setItem(row, 0, QtWidgets.QTableWidgetItem(activity["activity_name"]))
|
||||||
|
# 隐藏行号
|
||||||
|
self.ui.arrangetableWidget.verticalHeader().setVisible(False)
|
||||||
|
|
||||||
|
def get_registered_activities(self, date):
|
||||||
|
"""
|
||||||
|
获取指定日期的已注册活动信息
|
||||||
|
"""
|
||||||
|
with psycopg2.connect(database="DataMY", user="postgres", password="822520", host="127.0.0.1",
|
||||||
|
port="5432") as conn:
|
||||||
|
with conn.cursor() as cur:
|
||||||
|
# 使用 %s 占位符防止 SQL 注入
|
||||||
|
cur.execute("""
|
||||||
|
SELECT a.activityname, a.activitydatetime
|
||||||
|
FROM activities a
|
||||||
|
INNER JOIN registrations r ON a.activityid = r.activity_id
|
||||||
|
INNER JOIN users u ON r.user_id = u.userid
|
||||||
|
WHERE DATE(a.activitydatetime) = %s AND u.userid = %s
|
||||||
|
""", (date, config.user_now)) # 传入的是 "2024-11-20" 和特定用户的 userid
|
||||||
|
result = cur.fetchall()
|
||||||
|
|
||||||
|
# 将查询结果转换为字典列表格式
|
||||||
|
activities = [{"activity_name": row[0], "activity_time": row[1]} for row in result]
|
||||||
|
return activities if activities else [{"activity_name": "无活动信息", "activity_time": ""}]
|
||||||
|
|
||||||
|
def check_activity_conflict(self, new_activity_time, new_activity_name):
|
||||||
|
"""
|
||||||
|
检查新活动是否与已有活动时间冲突
|
||||||
|
"""
|
||||||
|
activities = self.get_registered_activities(new_activity_time)
|
||||||
|
for activity in activities:
|
||||||
|
if self.is_time_conflict(new_activity_time, activity['activity_time']):
|
||||||
|
self.show_message("活动冲突",
|
||||||
|
f"新活动 {new_activity_name} 与现有活动 {activity['activity_name']} 时间冲突。")
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
# config.py
|
||||||
|
user_now = ''
|
||||||
|
account_list = []
|
||||||
|
password_list = []
|
||||||
|
activityid = 0
|
@ -0,0 +1,296 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'login.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.15.11
|
||||||
|
#
|
||||||
|
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||||
|
# run again. Do not edit this file unless you know what you are doing.
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_LoginWindow(object):
|
||||||
|
def setupUi(self, LoginWindow):
|
||||||
|
LoginWindow.setObjectName("LoginWindow")
|
||||||
|
LoginWindow.resize(806, 700)
|
||||||
|
self.centralwidget = QtWidgets.QWidget(LoginWindow)
|
||||||
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
|
self.frame = QtWidgets.QFrame(self.centralwidget)
|
||||||
|
self.frame.setGeometry(QtCore.QRect(50, 100, 331, 411))
|
||||||
|
self.frame.setStyleSheet("#frame{\n"
|
||||||
|
"border-image: url(:/picture/picture/孤独寂寞冷.png);\n"
|
||||||
|
"border-ridius:20px;}")
|
||||||
|
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame.setObjectName("frame")
|
||||||
|
self.label = QtWidgets.QLabel(self.frame)
|
||||||
|
self.label.setGeometry(QtCore.QRect(20, 0, 251, 61))
|
||||||
|
self.label.setMinimumSize(QtCore.QSize(251, 61))
|
||||||
|
self.label.setStyleSheet("color: rgb(0, 0, 0);\n"
|
||||||
|
"font: 20pt \"方正舒体\";")
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.frame_2 = QtWidgets.QFrame(self.centralwidget)
|
||||||
|
self.frame_2.setGeometry(QtCore.QRect(370, 100, 341, 411))
|
||||||
|
self.frame_2.setStyleSheet("background-color: rgb(255, 255, 255);")
|
||||||
|
self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame_2.setObjectName("frame_2")
|
||||||
|
self.pushButton = QtWidgets.QPushButton(self.frame_2)
|
||||||
|
self.pushButton.setGeometry(QtCore.QRect(270, 10, 81, 31))
|
||||||
|
self.pushButton.setStyleSheet("QPushButton{\n"
|
||||||
|
" border:none;\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:hover{\n"
|
||||||
|
" padding-bottom:5px;\n"
|
||||||
|
"}")
|
||||||
|
self.pushButton.setText("")
|
||||||
|
icon = QtGui.QIcon()
|
||||||
|
icon.addPixmap(QtGui.QPixmap(":/icon/picture/close.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.pushButton.setIcon(icon)
|
||||||
|
self.pushButton.setIconSize(QtCore.QSize(30, 30))
|
||||||
|
self.pushButton.setObjectName("pushButton")
|
||||||
|
self.frame_3 = QtWidgets.QFrame(self.frame_2)
|
||||||
|
self.frame_3.setGeometry(QtCore.QRect(0, 40, 301, 350))
|
||||||
|
self.frame_3.setMinimumSize(QtCore.QSize(301, 350))
|
||||||
|
self.frame_3.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.frame_3.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame_3.setObjectName("frame_3")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.frame_3)
|
||||||
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.frame_4 = QtWidgets.QFrame(self.frame_3)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(6)
|
||||||
|
sizePolicy.setHeightForWidth(self.frame_4.sizePolicy().hasHeightForWidth())
|
||||||
|
self.frame_4.setSizePolicy(sizePolicy)
|
||||||
|
self.frame_4.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.frame_4.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame_4.setObjectName("frame_4")
|
||||||
|
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.frame_4)
|
||||||
|
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||||
|
self.frame_6 = QtWidgets.QFrame(self.frame_4)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(5)
|
||||||
|
sizePolicy.setHeightForWidth(self.frame_6.sizePolicy().hasHeightForWidth())
|
||||||
|
self.frame_6.setSizePolicy(sizePolicy)
|
||||||
|
self.frame_6.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.frame_6.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame_6.setObjectName("frame_6")
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.frame_6)
|
||||||
|
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
self.stackedWidget_2 = QtWidgets.QStackedWidget(self.frame_6)
|
||||||
|
self.stackedWidget_2.setStyleSheet("QLineEdit{\n"
|
||||||
|
" \n"
|
||||||
|
" background-color: rgba(255, 255, 255,0);\n"
|
||||||
|
" border:none;\n"
|
||||||
|
"border-bottom:1px solid black;\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton{\n"
|
||||||
|
" \n"
|
||||||
|
" background-color: rgb(0, 0, 0);\n"
|
||||||
|
" color: rgb(255, 255, 255);\n"
|
||||||
|
" border-radius:7px;\n"
|
||||||
|
" font: 20pt \"方正舒体\";\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:pressed{\n"
|
||||||
|
" padding-top:5px;\n"
|
||||||
|
" padding-left:5px;\n"
|
||||||
|
"}")
|
||||||
|
self.stackedWidget_2.setObjectName("stackedWidget_2")
|
||||||
|
self.login = QtWidgets.QWidget()
|
||||||
|
self.login.setObjectName("login")
|
||||||
|
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.login)
|
||||||
|
self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||||
|
self.LineEdit_L_account = QtWidgets.QLineEdit(self.login)
|
||||||
|
self.LineEdit_L_account.setMinimumSize(QtCore.QSize(0, 35))
|
||||||
|
self.LineEdit_L_account.setObjectName("LineEdit_L_account")
|
||||||
|
self.verticalLayout_4.addWidget(self.LineEdit_L_account)
|
||||||
|
self.LineEdit_L_password = QtWidgets.QLineEdit(self.login)
|
||||||
|
self.LineEdit_L_password.setMinimumSize(QtCore.QSize(0, 35))
|
||||||
|
self.LineEdit_L_password.setEchoMode(QtWidgets.QLineEdit.Password)
|
||||||
|
self.LineEdit_L_password.setObjectName("LineEdit_L_password")
|
||||||
|
self.verticalLayout_4.addWidget(self.LineEdit_L_password)
|
||||||
|
self.PushButtom_L_sure = QtWidgets.QPushButton(self.login)
|
||||||
|
self.PushButtom_L_sure.setMinimumSize(QtCore.QSize(0, 40))
|
||||||
|
self.PushButtom_L_sure.setObjectName("PushButtom_L_sure")
|
||||||
|
self.verticalLayout_4.addWidget(self.PushButtom_L_sure)
|
||||||
|
self.stackedWidget_2.addWidget(self.login)
|
||||||
|
self.register_2 = QtWidgets.QWidget()
|
||||||
|
self.register_2.setObjectName("register_2")
|
||||||
|
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.register_2)
|
||||||
|
self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_5.setObjectName("verticalLayout_5")
|
||||||
|
self.LineEdit_R_account = QtWidgets.QLineEdit(self.register_2)
|
||||||
|
self.LineEdit_R_account.setMinimumSize(QtCore.QSize(0, 30))
|
||||||
|
self.LineEdit_R_account.setObjectName("LineEdit_R_account")
|
||||||
|
self.verticalLayout_5.addWidget(self.LineEdit_R_account)
|
||||||
|
self.LineEdit_R_password = QtWidgets.QLineEdit(self.register_2)
|
||||||
|
self.LineEdit_R_password.setMinimumSize(QtCore.QSize(0, 30))
|
||||||
|
self.LineEdit_R_password.setObjectName("LineEdit_R_password")
|
||||||
|
self.verticalLayout_5.addWidget(self.LineEdit_R_password)
|
||||||
|
self.LineEdit_R_password1 = QtWidgets.QLineEdit(self.register_2)
|
||||||
|
self.LineEdit_R_password1.setMinimumSize(QtCore.QSize(0, 30))
|
||||||
|
self.LineEdit_R_password1.setObjectName("LineEdit_R_password1")
|
||||||
|
self.verticalLayout_5.addWidget(self.LineEdit_R_password1)
|
||||||
|
self.QPushButtom_R_sure = QtWidgets.QPushButton(self.register_2)
|
||||||
|
self.QPushButtom_R_sure.setMinimumSize(QtCore.QSize(0, 40))
|
||||||
|
self.QPushButtom_R_sure.setObjectName("QPushButtom_R_sure")
|
||||||
|
self.verticalLayout_5.addWidget(self.QPushButtom_R_sure)
|
||||||
|
self.stackedWidget_2.addWidget(self.register_2)
|
||||||
|
self.horizontalLayout_2.addWidget(self.stackedWidget_2)
|
||||||
|
self.verticalLayout_3.addWidget(self.frame_6)
|
||||||
|
self.frame_7 = QtWidgets.QFrame(self.frame_4)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(1)
|
||||||
|
sizePolicy.setHeightForWidth(self.frame_7.sizePolicy().hasHeightForWidth())
|
||||||
|
self.frame_7.setSizePolicy(sizePolicy)
|
||||||
|
self.frame_7.setStyleSheet("QPushButton{\n"
|
||||||
|
" border:none;\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:pressed{\n"
|
||||||
|
" padding-top:5px;\n"
|
||||||
|
" padding-left:5px;\n"
|
||||||
|
"}")
|
||||||
|
self.frame_7.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.frame_7.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame_7.setObjectName("frame_7")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame_7)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.pushButton_Login = QtWidgets.QPushButton(self.frame_7)
|
||||||
|
self.pushButton_Login.setText("")
|
||||||
|
icon1 = QtGui.QIcon()
|
||||||
|
icon1.addPixmap(QtGui.QPixmap(":/icon/picture/登录.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.pushButton_Login.setIcon(icon1)
|
||||||
|
self.pushButton_Login.setIconSize(QtCore.QSize(30, 30))
|
||||||
|
self.pushButton_Login.setObjectName("pushButton_Login")
|
||||||
|
self.horizontalLayout.addWidget(self.pushButton_Login)
|
||||||
|
self.pushButton_Register = QtWidgets.QPushButton(self.frame_7)
|
||||||
|
self.pushButton_Register.setText("")
|
||||||
|
icon2 = QtGui.QIcon()
|
||||||
|
icon2.addPixmap(QtGui.QPixmap(":/icon/picture/登录注册.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
self.pushButton_Register.setIcon(icon2)
|
||||||
|
self.pushButton_Register.setIconSize(QtCore.QSize(30, 30))
|
||||||
|
self.pushButton_Register.setObjectName("pushButton_Register")
|
||||||
|
self.horizontalLayout.addWidget(self.pushButton_Register)
|
||||||
|
self.verticalLayout_3.addWidget(self.frame_7)
|
||||||
|
self.verticalLayout.addWidget(self.frame_4)
|
||||||
|
self.frame_5 = QtWidgets.QFrame(self.frame_3)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(1)
|
||||||
|
sizePolicy.setHeightForWidth(self.frame_5.sizePolicy().hasHeightForWidth())
|
||||||
|
self.frame_5.setSizePolicy(sizePolicy)
|
||||||
|
self.frame_5.setStyleSheet("color: rgb(255, 0, 0);\n"
|
||||||
|
"font: 12pt \"幼圆\";")
|
||||||
|
self.frame_5.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.frame_5.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame_5.setObjectName("frame_5")
|
||||||
|
self.verticalLayout_10 = QtWidgets.QVBoxLayout(self.frame_5)
|
||||||
|
self.verticalLayout_10.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_10.setSpacing(0)
|
||||||
|
self.verticalLayout_10.setObjectName("verticalLayout_10")
|
||||||
|
self.stackedWidget = QtWidgets.QStackedWidget(self.frame_5)
|
||||||
|
self.stackedWidget.setObjectName("stackedWidget")
|
||||||
|
self.page = QtWidgets.QWidget()
|
||||||
|
self.page.setObjectName("page")
|
||||||
|
self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.page)
|
||||||
|
self.verticalLayout_6.setObjectName("verticalLayout_6")
|
||||||
|
self.stackedWidget.addWidget(self.page)
|
||||||
|
self.page_3 = QtWidgets.QWidget()
|
||||||
|
self.page_3.setObjectName("page_3")
|
||||||
|
self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.page_3)
|
||||||
|
self.verticalLayout_7.setObjectName("verticalLayout_7")
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.page_3)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.verticalLayout_7.addWidget(self.label_3)
|
||||||
|
self.stackedWidget.addWidget(self.page_3)
|
||||||
|
self.page_4 = QtWidgets.QWidget()
|
||||||
|
self.page_4.setObjectName("page_4")
|
||||||
|
self.verticalLayout_8 = QtWidgets.QVBoxLayout(self.page_4)
|
||||||
|
self.verticalLayout_8.setObjectName("verticalLayout_8")
|
||||||
|
self.label_4 = QtWidgets.QLabel(self.page_4)
|
||||||
|
self.label_4.setStyleSheet("color: rgb(0, 0, 0);")
|
||||||
|
self.label_4.setObjectName("label_4")
|
||||||
|
self.verticalLayout_8.addWidget(self.label_4)
|
||||||
|
self.stackedWidget.addWidget(self.page_4)
|
||||||
|
self.page_2 = QtWidgets.QWidget()
|
||||||
|
self.page_2.setObjectName("page_2")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.page_2)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.page_2)
|
||||||
|
self.label_2.setStyleSheet("font: 12pt \"幼圆\"\n"
|
||||||
|
"")
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.verticalLayout_2.addWidget(self.label_2)
|
||||||
|
self.stackedWidget.addWidget(self.page_2)
|
||||||
|
self.page_5 = QtWidgets.QWidget()
|
||||||
|
self.page_5.setObjectName("page_5")
|
||||||
|
self.verticalLayout_9 = QtWidgets.QVBoxLayout(self.page_5)
|
||||||
|
self.verticalLayout_9.setObjectName("verticalLayout_9")
|
||||||
|
self.label_5 = QtWidgets.QLabel(self.page_5)
|
||||||
|
self.label_5.setStyleSheet("color: rgb(0, 0, 0);")
|
||||||
|
self.label_5.setObjectName("label_5")
|
||||||
|
self.verticalLayout_9.addWidget(self.label_5)
|
||||||
|
self.stackedWidget.addWidget(self.page_5)
|
||||||
|
self.page_6 = QtWidgets.QWidget()
|
||||||
|
self.page_6.setObjectName("page_6")
|
||||||
|
self.label_6 = QtWidgets.QLabel(self.page_6)
|
||||||
|
self.label_6.setGeometry(QtCore.QRect(40, 10, 191, 31))
|
||||||
|
self.label_6.setObjectName("label_6")
|
||||||
|
self.stackedWidget.addWidget(self.page_6)
|
||||||
|
self.page_7 = QtWidgets.QWidget()
|
||||||
|
self.page_7.setObjectName("page_7")
|
||||||
|
self.verticalLayout_11 = QtWidgets.QVBoxLayout(self.page_7)
|
||||||
|
self.verticalLayout_11.setObjectName("verticalLayout_11")
|
||||||
|
self.label_7 = QtWidgets.QLabel(self.page_7)
|
||||||
|
self.label_7.setObjectName("label_7")
|
||||||
|
self.verticalLayout_11.addWidget(self.label_7, 0, QtCore.Qt.AlignHCenter)
|
||||||
|
self.stackedWidget.addWidget(self.page_7)
|
||||||
|
self.page_8 = QtWidgets.QWidget()
|
||||||
|
self.page_8.setObjectName("page_8")
|
||||||
|
self.verticalLayout_12 = QtWidgets.QVBoxLayout(self.page_8)
|
||||||
|
self.verticalLayout_12.setObjectName("verticalLayout_12")
|
||||||
|
self.label_8 = QtWidgets.QLabel(self.page_8)
|
||||||
|
self.label_8.setObjectName("label_8")
|
||||||
|
self.verticalLayout_12.addWidget(self.label_8)
|
||||||
|
self.stackedWidget.addWidget(self.page_8)
|
||||||
|
self.verticalLayout_10.addWidget(self.stackedWidget, 0, QtCore.Qt.AlignHCenter)
|
||||||
|
self.verticalLayout.addWidget(self.frame_5, 0, QtCore.Qt.AlignHCenter)
|
||||||
|
LoginWindow.setCentralWidget(self.centralwidget)
|
||||||
|
self.toolBar = QtWidgets.QToolBar(LoginWindow)
|
||||||
|
self.toolBar.setObjectName("toolBar")
|
||||||
|
LoginWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
|
||||||
|
|
||||||
|
self.retranslateUi(LoginWindow)
|
||||||
|
self.stackedWidget.setCurrentIndex(0)
|
||||||
|
self.pushButton.clicked.connect(LoginWindow.close) # type: ignore
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(LoginWindow)
|
||||||
|
|
||||||
|
def retranslateUi(self, LoginWindow):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
LoginWindow.setWindowTitle(_translate("LoginWindow", "MainWindow"))
|
||||||
|
self.label.setText(_translate("LoginWindow", "活动管理系统"))
|
||||||
|
self.LineEdit_L_account.setPlaceholderText(_translate("LoginWindow", "账号:"))
|
||||||
|
self.LineEdit_L_password.setPlaceholderText(_translate("LoginWindow", "密码:"))
|
||||||
|
self.PushButtom_L_sure.setText(_translate("LoginWindow", "确认"))
|
||||||
|
self.LineEdit_R_account.setPlaceholderText(_translate("LoginWindow", "账号:"))
|
||||||
|
self.LineEdit_R_password.setPlaceholderText(_translate("LoginWindow", "密码:"))
|
||||||
|
self.LineEdit_R_password1.setPlaceholderText(_translate("LoginWindow", "确认密码:"))
|
||||||
|
self.QPushButtom_R_sure.setText(_translate("LoginWindow", "注册"))
|
||||||
|
self.label_3.setText(_translate("LoginWindow", " 密码不一致!"))
|
||||||
|
self.label_4.setText(_translate("LoginWindow", " 账号注册成功!"))
|
||||||
|
self.label_2.setText(_translate("LoginWindow", " 账号或密码不能为空"))
|
||||||
|
self.label_5.setText(_translate("LoginWindow", " 登录成功 "))
|
||||||
|
self.label_6.setText(_translate("LoginWindow", " 账号已存在"))
|
||||||
|
self.label_7.setText(_translate("LoginWindow", "账号已存在"))
|
||||||
|
self.label_8.setText(_translate("LoginWindow", " 账号或密码错误"))
|
||||||
|
self.toolBar.setWindowTitle(_translate("LoginWindow", "toolBar"))
|
||||||
|
import resource_rc
|
@ -0,0 +1,589 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>LoginWindow</class>
|
||||||
|
<widget class="QMainWindow" name="LoginWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>806</width>
|
||||||
|
<height>700</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<widget class="QFrame" name="frame">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>50</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>331</width>
|
||||||
|
<height>411</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">#frame{
|
||||||
|
border-image: url(:/picture/picture/孤独寂寞冷.png);
|
||||||
|
border-ridius:20px;}</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>251</width>
|
||||||
|
<height>61</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>251</width>
|
||||||
|
<height>61</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(0, 0, 0);
|
||||||
|
font: 20pt "方正舒体";</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>活动管理系统</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QFrame" name="frame_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>370</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>341</width>
|
||||||
|
<height>411</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>270</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>81</width>
|
||||||
|
<height>31</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QPushButton{
|
||||||
|
border:none;
|
||||||
|
}
|
||||||
|
QPushButton:hover{
|
||||||
|
padding-bottom:5px;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resource.qrc">
|
||||||
|
<normaloff>:/icon/picture/close.png</normaloff>:/icon/picture/close.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QFrame" name="frame_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>40</y>
|
||||||
|
<width>301</width>
|
||||||
|
<height>350</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>301</width>
|
||||||
|
<height>350</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame_4">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>6</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame_6">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>5</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QStackedWidget" name="stackedWidget_2">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QLineEdit{
|
||||||
|
|
||||||
|
background-color: rgba(255, 255, 255,0);
|
||||||
|
border:none;
|
||||||
|
border-bottom:1px solid black;
|
||||||
|
}
|
||||||
|
QPushButton{
|
||||||
|
|
||||||
|
background-color: rgb(0, 0, 0);
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
border-radius:7px;
|
||||||
|
font: 20pt "方正舒体";
|
||||||
|
}
|
||||||
|
QPushButton:pressed{
|
||||||
|
padding-top:5px;
|
||||||
|
padding-left:5px;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="login">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="LineEdit_L_account">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>35</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>账号:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="LineEdit_L_password">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>35</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>密码:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="PushButtom_L_sure">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>确认</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="register_2">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="LineEdit_R_account">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>账号:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="LineEdit_R_password">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>密码:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="LineEdit_R_password1">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>确认密码:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="QPushButtom_R_sure">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>注册</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame_7">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>1</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QPushButton{
|
||||||
|
border:none;
|
||||||
|
}
|
||||||
|
QPushButton:pressed{
|
||||||
|
padding-top:5px;
|
||||||
|
padding-left:5px;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_Login">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resource.qrc">
|
||||||
|
<normaloff>:/icon/picture/登录.png</normaloff>:/icon/picture/登录.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_Register">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resource.qrc">
|
||||||
|
<normaloff>:/icon/picture/登录注册.png</normaloff>:/icon/picture/登录注册.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QFrame" name="frame_5">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>1</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(255, 0, 0);
|
||||||
|
font: 12pt "幼圆";</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="page">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_3">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string> 密码不一致!</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_4">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(0, 0, 0);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string> 账号注册成功!</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_2">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">font: 12pt "幼圆"
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string> 账号或密码不能为空</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_5">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(0, 0, 0);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string> 登录成功 </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_6">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>40</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>191</width>
|
||||||
|
<height>31</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string> 账号已存在</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_7">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>账号已存在</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_8">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string> 账号或密码错误</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QToolBar" name="toolBar">
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>toolBar</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="resource.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>pushButton</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>LoginWindow</receiver>
|
||||||
|
<slot>close()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>701</x>
|
||||||
|
<y>135</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>729</x>
|
||||||
|
<y>54</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
@ -0,0 +1,19 @@
|
|||||||
|
class Settings():
|
||||||
|
# 应用程序设置
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
ENABLE_CUSTOM_TITLE_BAR = True # 启用自定义标题栏
|
||||||
|
MENU_WIDTH = 240 # 菜单宽度(单位:像素)
|
||||||
|
LEFT_BOX_WIDTH = 240 # 左侧框的宽度(单位:像素)
|
||||||
|
RIGHT_BOX_WIDTH = 240 # 右侧框的宽度(单位:像素)
|
||||||
|
TIME_ANIMATION = 500 # 动画时间(单位:毫秒)
|
||||||
|
|
||||||
|
# 左右框按钮的背景颜色
|
||||||
|
BTN_LEFT_BOX_COLOR = "background-color: rgb(44, 49, 58);" # 左侧框按钮的背景颜色
|
||||||
|
BTN_RIGHT_BOX_COLOR = "background-color: #ff79c6;" # 右侧框按钮的背景颜色
|
||||||
|
|
||||||
|
# 菜单选中状态的样式表
|
||||||
|
MENU_SELECTED_STYLESHEET = """
|
||||||
|
border-left: 22px solid qlineargradient(spread:pad, x1:0.034, y1:0, x2:0.216, y2:0,
|
||||||
|
stop:0.499 rgba(255, 121, 198, 255), stop:0.5 rgba(85, 170, 255, 0)); # 左侧边框样式
|
||||||
|
background-color: rgb(40, 44, 52); # 菜单选中时的背景颜色
|
||||||
|
"""
|
@ -0,0 +1,297 @@
|
|||||||
|
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
#
|
||||||
|
# BY: WANDERSON M.PIMENTA
|
||||||
|
# PROJECT MADE WITH: Qt Designer and PySide6
|
||||||
|
# V: 1.0.0
|
||||||
|
#
|
||||||
|
# This project can be used freely for all uses, as long as they maintain the
|
||||||
|
# respective credits only in the Python scripts, any information in the visual
|
||||||
|
# interface (GUI) can be modified without any implication.
|
||||||
|
#
|
||||||
|
# There are limitations on Qt licenses if you want to use your products
|
||||||
|
# commercially, I recommend reading them on the official website:
|
||||||
|
# https://doc.qt.io/qtforpython/licenses.html
|
||||||
|
#
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
import psycopg2
|
||||||
|
|
||||||
|
import activemanager
|
||||||
|
from login import *
|
||||||
|
from PyQt5.QtWidgets import QApplication, QMainWindow
|
||||||
|
from PyQt5.QtWidgets import QApplication, QMainWindow, QFrame, QHBoxLayout, QWidget
|
||||||
|
from PyQt5.QtCore import QRect, QSize
|
||||||
|
from PyQt5.QtGui import QCursor
|
||||||
|
from PyQt5.Qt import Qt
|
||||||
|
from PyQt5 import QtCore
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
class Widgets:
|
||||||
|
# Placeholder for the Widgets class, implement your widget creation logic here.
|
||||||
|
def top(self, parent):
|
||||||
|
self.top = QWidget(parent)
|
||||||
|
self.top.setObjectName("top")
|
||||||
|
self.top.setStyleSheet("background: lightgray") # Change as needed
|
||||||
|
self.top.setGeometry(0, 0, parent.width(), 10)
|
||||||
|
|
||||||
|
self.top_left = QWidget(parent)
|
||||||
|
self.top_left.setObjectName("top_left")
|
||||||
|
self.top_left.setStyleSheet("background: gray") # Change as needed
|
||||||
|
self.top_left.setGeometry(0, 0, 10, 10)
|
||||||
|
|
||||||
|
self.top_right = QWidget(parent)
|
||||||
|
self.top_right.setObjectName("top_right")
|
||||||
|
self.top_right.setStyleSheet("background: gray") # Change as needed
|
||||||
|
self.top_right.setGeometry(parent.width() - 10, 0, 10, 10)
|
||||||
|
|
||||||
|
def bottom(self, parent):
|
||||||
|
self.bottom = QWidget(parent)
|
||||||
|
self.bottom.setObjectName("bottom")
|
||||||
|
self.bottom.setStyleSheet("background: lightgray") # Change as needed
|
||||||
|
self.bottom.setGeometry(0, parent.height() - 10, parent.width(), 10)
|
||||||
|
|
||||||
|
self.bottom_left = QWidget(parent)
|
||||||
|
self.bottom_left.setObjectName("bottom_left")
|
||||||
|
self.bottom_left.setStyleSheet("background: gray") # Change as needed
|
||||||
|
self.bottom_left.setGeometry(0, parent.height() - 10, 10, 10)
|
||||||
|
|
||||||
|
self.bottom_right = QWidget(parent)
|
||||||
|
self.bottom_right.setObjectName("bottom_right")
|
||||||
|
self.bottom_right.setStyleSheet("background: gray") # Change as needed
|
||||||
|
self.bottom_right.setGeometry(parent.width() - 10, parent.height() - 10, 10, 10)
|
||||||
|
|
||||||
|
def left(self, parent):
|
||||||
|
self.leftgrip = QWidget(parent)
|
||||||
|
self.leftgrip.setObjectName("left")
|
||||||
|
self.leftgrip.setStyleSheet("background: lightgray") # Change as needed
|
||||||
|
self.leftgrip.setGeometry(0, 10, 10, parent.height() - 20)
|
||||||
|
|
||||||
|
def right(self, parent):
|
||||||
|
self.rightgrip = QWidget(parent)
|
||||||
|
self.rightgrip.setObjectName("right")
|
||||||
|
self.rightgrip.setStyleSheet("background: lightgray") # Change as needed
|
||||||
|
self.rightgrip.setGeometry(parent.width() - 10, 10, 10, parent.height() - 20)
|
||||||
|
|
||||||
|
class CustomGrip(QWidget):
|
||||||
|
def __init__(self, parent, position, disable_color=False):
|
||||||
|
super().__init__(parent) # Use super to call QWidget's constructor
|
||||||
|
self.parent = parent
|
||||||
|
self.wi = Widgets()
|
||||||
|
|
||||||
|
# Show top grip
|
||||||
|
if position == QtCore.Qt.TopEdge:
|
||||||
|
self.wi.top(self)
|
||||||
|
self.setGeometry(0, 0, self.parent.width(), 10)
|
||||||
|
self.setMaximumHeight(10)
|
||||||
|
|
||||||
|
# Resize top
|
||||||
|
self.wi.top.mouseMoveEvent = self.create_resize_handler("top")
|
||||||
|
|
||||||
|
# Enable color
|
||||||
|
if disable_color:
|
||||||
|
self.set_style_transparent(["top_left", "top_right", "top"])
|
||||||
|
|
||||||
|
# Show bottom grip
|
||||||
|
elif position == QtCore.Qt.BottomEdge:
|
||||||
|
self.wi.bottom(self)
|
||||||
|
self.setGeometry(0, self.parent.height() - 10, self.parent.width(), 10)
|
||||||
|
self.setMaximumHeight(10)
|
||||||
|
|
||||||
|
# Resize bottom
|
||||||
|
self.wi.bottom.mouseMoveEvent = self.create_resize_handler("bottom")
|
||||||
|
|
||||||
|
# Enable color
|
||||||
|
if disable_color:
|
||||||
|
self.set_style_transparent(["bottom_left", "bottom_right", "bottom"])
|
||||||
|
|
||||||
|
# Show left grip
|
||||||
|
elif position == QtCore.Qt.LeftEdge:
|
||||||
|
self.wi.left(self)
|
||||||
|
self.setGeometry(0, 10, 10, self.parent.height())
|
||||||
|
self.setMaximumWidth(10)
|
||||||
|
|
||||||
|
# Resize left
|
||||||
|
self.wi.leftgrip.mouseMoveEvent = self.create_resize_handler("left")
|
||||||
|
|
||||||
|
# Enable color
|
||||||
|
if disable_color:
|
||||||
|
self.set_style_transparent(["left"])
|
||||||
|
|
||||||
|
# Show right grip
|
||||||
|
elif position == QtCore.Qt.RightEdge:
|
||||||
|
self.wi.right(self)
|
||||||
|
self.setGeometry(self.parent.width() - 10, 10, 10, self.parent.height())
|
||||||
|
self.setMaximumWidth(10)
|
||||||
|
|
||||||
|
# Resize right
|
||||||
|
self.wi.rightgrip.mouseMoveEvent = self.create_resize_handler("right")
|
||||||
|
|
||||||
|
# Enable color
|
||||||
|
if disable_color:
|
||||||
|
self.set_style_transparent(["right"])
|
||||||
|
|
||||||
|
def set_style_transparent(self, widgets):
|
||||||
|
for widget in widgets:
|
||||||
|
getattr(self.wi, widget).setStyleSheet("background: transparent")
|
||||||
|
|
||||||
|
def create_resize_handler(self, edge):
|
||||||
|
def resize(event):
|
||||||
|
delta = event.pos()
|
||||||
|
if edge == "top":
|
||||||
|
height = max(self.parent.minimumHeight(), self.parent.height() - delta.y())
|
||||||
|
geo = self.parent.geometry()
|
||||||
|
geo.setTop(geo.bottom() - height)
|
||||||
|
self.parent.setGeometry(geo)
|
||||||
|
event.accept()
|
||||||
|
|
||||||
|
elif edge == "bottom":
|
||||||
|
height = max(self.parent.minimumHeight(), self.parent.height() + delta.y())
|
||||||
|
self.parent.resize(self.parent.width(), height)
|
||||||
|
event.accept()
|
||||||
|
|
||||||
|
elif edge == "left":
|
||||||
|
width = max(self.parent.minimumWidth(), self.parent.width() - delta.x())
|
||||||
|
geo = self.parent.geometry()
|
||||||
|
geo.setLeft(geo.right() - width)
|
||||||
|
self.parent.setGeometry(geo)
|
||||||
|
event.accept()
|
||||||
|
|
||||||
|
elif edge == "right":
|
||||||
|
width = max(self.parent.minimumWidth(), self.parent.width() + delta.x())
|
||||||
|
self.parent.resize(width, self.parent.height())
|
||||||
|
event.accept()
|
||||||
|
|
||||||
|
return resize
|
||||||
|
|
||||||
|
|
||||||
|
class Widgets(object):
|
||||||
|
def top(self, Form):
|
||||||
|
if not Form.objectName():
|
||||||
|
Form.setObjectName(u"Form")
|
||||||
|
|
||||||
|
# Create the container frame
|
||||||
|
self.container_top = QFrame(Form)
|
||||||
|
self.container_top.setObjectName(u"container_top")
|
||||||
|
self.container_top.setGeometry(QRect(0, 0, 500, 10))
|
||||||
|
self.container_top.setMinimumSize(QSize(0, 10))
|
||||||
|
self.container_top.setMaximumSize(QSize(16777215, 10))
|
||||||
|
self.container_top.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.container_top.setFrameShadow(QFrame.Raised)
|
||||||
|
|
||||||
|
# Create the horizontal layout for the top container
|
||||||
|
self.top_layout = QHBoxLayout(self.container_top)
|
||||||
|
self.top_layout.setSpacing(0)
|
||||||
|
self.top_layout.setObjectName(u"top_layout")
|
||||||
|
self.top_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
|
||||||
|
# Create the left grip
|
||||||
|
self.top_left = QFrame(self.container_top)
|
||||||
|
self.top_left.setObjectName(u"top_left")
|
||||||
|
self.top_left.setMinimumSize(QSize(10, 10))
|
||||||
|
self.top_left.setMaximumSize(QSize(10, 10))
|
||||||
|
self.top_left.setCursor(QCursor(Qt.SizeFDiagCursor))
|
||||||
|
self.top_left.setStyleSheet(u"background-color: rgb(33, 37, 43);")
|
||||||
|
self.top_left.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.top_left.setFrameShadow(QFrame.Raised)
|
||||||
|
self.top_layout.addWidget(self.top_left)
|
||||||
|
|
||||||
|
# Create the main top bar
|
||||||
|
self.top = QFrame(self.container_top)
|
||||||
|
self.top.setObjectName(u"top")
|
||||||
|
self.top.setCursor(QCursor(Qt.SizeVerCursor))
|
||||||
|
self.top.setStyleSheet(u"background-color: rgb(85, 255, 255);")
|
||||||
|
self.top.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.top.setFrameShadow(QFrame.Raised)
|
||||||
|
self.top_layout.addWidget(self.top)
|
||||||
|
|
||||||
|
# Create the right grip
|
||||||
|
self.top_right = QFrame(self.container_top)
|
||||||
|
self.top_right.setObjectName(u"top_right")
|
||||||
|
self.top_right.setMinimumSize(QSize(10, 10))
|
||||||
|
self.top_right.setMaximumSize(QSize(10, 10))
|
||||||
|
self.top_right.setCursor(QCursor(Qt.SizeBDiagCursor))
|
||||||
|
self.top_right.setStyleSheet(u"background-color: rgb(33, 37, 43);")
|
||||||
|
self.top_right.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.top_right.setFrameShadow(QFrame.Raised)
|
||||||
|
self.top_layout.addWidget(self.top_right)
|
||||||
|
|
||||||
|
def bottom(self, Form):
|
||||||
|
if not Form.objectName():
|
||||||
|
Form.setObjectName(u"Form")
|
||||||
|
|
||||||
|
# Create the bottom container
|
||||||
|
self.container_bottom = QFrame(Form)
|
||||||
|
self.container_bottom.setObjectName(u"container_bottom")
|
||||||
|
self.container_bottom.setGeometry(QRect(0, Form.height() - 10, 500, 10))
|
||||||
|
self.container_bottom.setMinimumSize(QSize(0, 10))
|
||||||
|
self.container_bottom.setMaximumSize(QSize(16777215, 10))
|
||||||
|
self.container_bottom.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.container_bottom.setFrameShadow(QFrame.Raised)
|
||||||
|
|
||||||
|
# Create the horizontal layout for the bottom container
|
||||||
|
self.bottom_layout = QHBoxLayout(self.container_bottom)
|
||||||
|
self.bottom_layout.setSpacing(0)
|
||||||
|
self.bottom_layout.setObjectName(u"bottom_layout")
|
||||||
|
self.bottom_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
|
||||||
|
# Create the left grip
|
||||||
|
self.bottom_left = QFrame(self.container_bottom)
|
||||||
|
self.bottom_left.setObjectName(u"bottom_left")
|
||||||
|
self.bottom_left.setMinimumSize(QSize(10, 10))
|
||||||
|
self.bottom_left.setMaximumSize(QSize(10, 10))
|
||||||
|
self.bottom_left.setCursor(QCursor(Qt.SizeBDiagCursor))
|
||||||
|
self.bottom_left.setStyleSheet(u"background-color: rgb(33, 37, 43);")
|
||||||
|
self.bottom_left.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.bottom_left.setFrameShadow(QFrame.Raised)
|
||||||
|
self.bottom_layout.addWidget(self.bottom_left)
|
||||||
|
|
||||||
|
# Create the main bottom bar
|
||||||
|
self.bottom = QFrame(self.container_bottom)
|
||||||
|
self.bottom.setObjectName(u"bottom")
|
||||||
|
self.bottom.setCursor(QCursor(Qt.SizeVerCursor))
|
||||||
|
self.bottom.setStyleSheet(u"background-color: rgb(85, 170, 0);")
|
||||||
|
self.bottom.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.bottom.setFrameShadow(QFrame.Raised)
|
||||||
|
self.bottom_layout.addWidget(self.bottom)
|
||||||
|
|
||||||
|
# Create the right grip
|
||||||
|
self.bottom_right = QFrame(self.container_bottom)
|
||||||
|
self.bottom_right.setObjectName(u"bottom_right")
|
||||||
|
self.bottom_right.setMinimumSize(QSize(10, 10))
|
||||||
|
self.bottom_right.setMaximumSize(QSize(10, 10))
|
||||||
|
self.bottom_right.setCursor(QCursor(Qt.SizeFDiagCursor))
|
||||||
|
self.bottom_right.setStyleSheet(u"background-color: rgb(33, 37, 43);")
|
||||||
|
self.bottom_right.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.bottom_right.setFrameShadow(QFrame.Raised)
|
||||||
|
self.bottom_layout.addWidget(self.bottom_right)
|
||||||
|
|
||||||
|
def left(self, Form):
|
||||||
|
if not Form.objectName():
|
||||||
|
Form.setObjectName(u"Form")
|
||||||
|
|
||||||
|
# Create the left grip
|
||||||
|
self.leftgrip = QFrame(Form)
|
||||||
|
self.leftgrip.setObjectName(u"left")
|
||||||
|
self.leftgrip.setGeometry(QRect(0, 10, 10, 480))
|
||||||
|
self.leftgrip.setMinimumSize(QSize(10, 0))
|
||||||
|
self.leftgrip.setCursor(QCursor(Qt.SizeHorCursor))
|
||||||
|
self.leftgrip.setStyleSheet(u"background-color: rgb(255, 121, 198);")
|
||||||
|
self.leftgrip.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.leftgrip.setFrameShadow(QFrame.Raised)
|
||||||
|
|
||||||
|
def right(self, Form):
|
||||||
|
if not Form.objectName():
|
||||||
|
Form.setObjectName(u"Form")
|
||||||
|
|
||||||
|
# Resize the form and create the right grip
|
||||||
|
Form.resize(500, 500)
|
||||||
|
self.rightgrip = QFrame(Form)
|
||||||
|
self.rightgrip.setObjectName(u"right")
|
||||||
|
self.rightgrip.setGeometry(QRect(Form.width() - 10, 0, 10, 500))
|
||||||
|
self.rightgrip.setMinimumSize(QSize(10, 0))
|
||||||
|
self.rightgrip.setCursor(QCursor(Qt.SizeHorCursor))
|
||||||
|
self.rightgrip.setStyleSheet(u"background-color: rgb(255, 0, 127);")
|
||||||
|
self.rightgrip.setFrameShape(QFrame.NoFrame)
|
||||||
|
self.rightgrip.setFrameShadow(QFrame.Raised)
|
@ -0,0 +1,65 @@
|
|||||||
|
import sys
|
||||||
|
import psycopg2
|
||||||
|
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QFrame, QLabel, QPushButton, QWidget
|
||||||
|
|
||||||
|
class MainWindow(QMainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.setWindowTitle("积分商城")
|
||||||
|
self.setGeometry(100, 100, 800, 600)
|
||||||
|
|
||||||
|
self.central_widget = QWidget()
|
||||||
|
self.setCentralWidget(self.central_widget)
|
||||||
|
self.layout = QVBoxLayout(self.central_widget)
|
||||||
|
|
||||||
|
# 调用加载数据的方法
|
||||||
|
self.load_data()
|
||||||
|
|
||||||
|
def load_data(self):
|
||||||
|
conn = psycopg2.connect(database="DataMY", user="postgres", password="822520", host="127.0.0.1", port="5432")
|
||||||
|
try:
|
||||||
|
cur = conn.cursor()
|
||||||
|
# 指定需要的列
|
||||||
|
cur.execute("SELECT name, points,image_url FROM products")
|
||||||
|
rows = cur.fetchall()
|
||||||
|
print(f"Fetched {len(rows)} products.")
|
||||||
|
|
||||||
|
for row in rows:
|
||||||
|
product_id, name, price = row # 这里应与查询的列数一致
|
||||||
|
self.add_product_to_widget(name, price)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
finally:
|
||||||
|
cur.close()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
def add_product_to_widget(self, name, price):
|
||||||
|
# 创建商品框架
|
||||||
|
product_frame = QFrame(self)
|
||||||
|
product_frame.setFrameShape(QFrame.Box)
|
||||||
|
product_layout = QVBoxLayout(product_frame)
|
||||||
|
|
||||||
|
# 商品图片(这里用一个占位符代替)
|
||||||
|
product_image = QLabel("商品图片", self)
|
||||||
|
product_layout.addWidget(product_image)
|
||||||
|
|
||||||
|
# 商品名称
|
||||||
|
name_label = QLabel(name, self)
|
||||||
|
product_layout.addWidget(name_label)
|
||||||
|
|
||||||
|
# 商品价格
|
||||||
|
price_label = QLabel(f"价格: {price} 积分", self)
|
||||||
|
product_layout.addWidget(price_label)
|
||||||
|
|
||||||
|
# 兑换按钮
|
||||||
|
exchange_button = QPushButton("兑换", self)
|
||||||
|
product_layout.addWidget(exchange_button)
|
||||||
|
|
||||||
|
# 将商品框架添加到主布局
|
||||||
|
self.layout.addWidget(product_frame)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
window = MainWindow()
|
||||||
|
window.show()
|
||||||
|
sys.exit(app.exec_())
|
@ -0,0 +1,297 @@
|
|||||||
|
|
||||||
|
import activemanager
|
||||||
|
from login import *
|
||||||
|
from PyQt5.QtWidgets import QApplication, QMainWindow
|
||||||
|
from PyQt5 import QtCore
|
||||||
|
import sys
|
||||||
|
from interface import *
|
||||||
|
from PyQt5.QtCore import QSize
|
||||||
|
from PyQt5.QtCore import QPropertyAnimation, QEasingCurve # 使用 PyQt5
|
||||||
|
from modules.app_settings import Settings
|
||||||
|
from PyQt5.QtWidgets import QGraphicsDropShadowEffect
|
||||||
|
from modules.custom_grips import CustomGrip
|
||||||
|
|
||||||
|
|
||||||
|
from main import *
|
||||||
|
# GLOBALS
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
GLOBAL_STATE = False
|
||||||
|
GLOBAL_TITLE_BAR = True
|
||||||
|
|
||||||
|
|
||||||
|
class UIFunctions(MainWindow):
|
||||||
|
# 最大恢复
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
def maximize_restore(self):
|
||||||
|
global GLOBAL_STATE
|
||||||
|
status = GLOBAL_STATE
|
||||||
|
if status == False:
|
||||||
|
self.showMaximized()
|
||||||
|
GLOBAL_STATE = True
|
||||||
|
self.ui.appMargins.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.ui.pushButton_3.setToolTip("Restore")
|
||||||
|
self.ui.pushButton_3.setIcon("D:\Desktop\学习\software\software\picture\cil-window-restore.png")
|
||||||
|
self.ui.frame_size_grip.hide()
|
||||||
|
self.left_grip.hide()
|
||||||
|
self.right_grip.hide()
|
||||||
|
self.top_grip.hide()
|
||||||
|
self.bottom_grip.hide()
|
||||||
|
else:
|
||||||
|
GLOBAL_STATE = False
|
||||||
|
self.showNormal()
|
||||||
|
self.resize(self.width() + 1, self.height() + 1)
|
||||||
|
self.ui.appMargins.setContentsMargins(10, 10, 10, 10)
|
||||||
|
self.ui.maximizeRestoreAppBtn.setToolTip("Maximize")
|
||||||
|
self.ui.maximizeRestoreAppBtn.setIcon("D:\Desktop\学习\software\software\picture\全屏.png")
|
||||||
|
self.ui.frame_size_grip.show()
|
||||||
|
self.left_grip.show()
|
||||||
|
self.right_grip.show()
|
||||||
|
self.top_grip.show()
|
||||||
|
self.bottom_grip.show()
|
||||||
|
|
||||||
|
# RETURN STATUS
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
def returStatus(self):
|
||||||
|
return GLOBAL_STATE
|
||||||
|
|
||||||
|
# SET STATUS
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
def setStatus(self, status):
|
||||||
|
global GLOBAL_STATE
|
||||||
|
GLOBAL_STATE = status
|
||||||
|
|
||||||
|
# TOGGLE MENU
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
def toggleMenu(self, enable):
|
||||||
|
if enable:
|
||||||
|
# GET WIDTH
|
||||||
|
width = self.ui.left_mune.width()
|
||||||
|
maxExtend = Settings.MENU_WIDTH
|
||||||
|
standard = 60
|
||||||
|
|
||||||
|
# SET MAX WIDTH
|
||||||
|
if width == 60:
|
||||||
|
widthExtended = maxExtend
|
||||||
|
else:
|
||||||
|
widthExtended = standard
|
||||||
|
|
||||||
|
# 创建一个属性动画对象,用于控制左侧菜单的最小宽度
|
||||||
|
self.animation = QPropertyAnimation(self.ui.left_mune, b"minimumWidth")
|
||||||
|
|
||||||
|
# 设置动画的持续时间,单位为毫秒
|
||||||
|
self.animation.setDuration(Settings.TIME_ANIMATION) # 动画的总时间
|
||||||
|
|
||||||
|
# 设置动画的起始值,当前左侧菜单的宽度
|
||||||
|
self.animation.setStartValue(width) # 动画开始时的最小宽度
|
||||||
|
|
||||||
|
# 设置动画的结束值,左侧菜单扩展后的宽度
|
||||||
|
self.animation.setEndValue(widthExtended) # 动画结束时的最小宽度
|
||||||
|
|
||||||
|
# 设置动画的缓动曲线,这里使用的是 InOutQuart 曲线
|
||||||
|
self.animation.setEasingCurve(QEasingCurve.InOutQuart) # 动画效果,平滑过渡
|
||||||
|
|
||||||
|
# 启动动画
|
||||||
|
self.animation.start() # 开始执行动画
|
||||||
|
|
||||||
|
# TOGGLE LEFT BOX
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
def toggleLeftBox(self, enable):
|
||||||
|
# 获取当前宽度
|
||||||
|
width = self.ui.left_mune.width()
|
||||||
|
widthRightBox = self.ui.extraRightBox.width()
|
||||||
|
maxExtend = Settings.LEFT_BOX_WIDTH
|
||||||
|
color = Settings.BTN_LEFT_BOX_COLOR
|
||||||
|
|
||||||
|
# 计算新的宽度
|
||||||
|
widthExtended = maxExtend if enable and width == 0 else 0
|
||||||
|
|
||||||
|
# 获取当前按钮样式
|
||||||
|
style = self.ui.toggleLeftBox.styleSheet()
|
||||||
|
|
||||||
|
# 更新按钮样式
|
||||||
|
if widthExtended == maxExtend:
|
||||||
|
# 扩展左侧框时设置按钮颜色
|
||||||
|
self.ui.toggleLeftBox.setStyleSheet(style + color)
|
||||||
|
if widthRightBox != 0:
|
||||||
|
self.updateRightButtonStyle(remove_color=True)
|
||||||
|
else:
|
||||||
|
# 收起左侧框时重置按钮颜色
|
||||||
|
self.ui.toggleLeftBox.setStyleSheet(style.replace(color, ''))
|
||||||
|
|
||||||
|
# 启动动画
|
||||||
|
UIFunctions.start_box_animation(self, width, widthRightBox, widthExtended, "left")
|
||||||
|
|
||||||
|
def updateRightButtonStyle(self, remove_color=False):
|
||||||
|
"""更新右侧按钮的样式"""
|
||||||
|
style = self.ui.settingsTopBtn.styleSheet()
|
||||||
|
if remove_color:
|
||||||
|
self.ui.settingsTopBtn.setStyleSheet(style.replace(Settings.BTN_RIGHT_BOX_COLOR, ''))
|
||||||
|
else:
|
||||||
|
# 这里可以添加更多样式更新逻辑
|
||||||
|
pass
|
||||||
|
# TOGGLE RIGHT BOX
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
def toggleRightBox(self, enable):
|
||||||
|
if enable:
|
||||||
|
# GET WIDTH
|
||||||
|
width = self.ui.extraRightBox.width()
|
||||||
|
widthLeftBox = self.ui.extraLeftBox.width()
|
||||||
|
maxExtend = Settings.RIGHT_BOX_WIDTH
|
||||||
|
color = Settings.BTN_RIGHT_BOX_COLOR
|
||||||
|
standard = 0
|
||||||
|
|
||||||
|
# GET BTN STYLE
|
||||||
|
style = self.ui.settingsTopBtn.styleSheet()
|
||||||
|
|
||||||
|
# SET MAX WIDTH
|
||||||
|
if width == 0:
|
||||||
|
widthExtended = maxExtend
|
||||||
|
# SELECT BTN
|
||||||
|
self.ui.settingsTopBtn.setStyleSheet(style + color)
|
||||||
|
if widthLeftBox != 0:
|
||||||
|
style = self.ui.toggleLeftBox.styleSheet()
|
||||||
|
self.ui.toggleLeftBox.setStyleSheet(style.replace(Settings.BTN_LEFT_BOX_COLOR, ''))
|
||||||
|
else:
|
||||||
|
widthExtended = standard
|
||||||
|
# RESET BTN
|
||||||
|
self.ui.settingsTopBtn.setStyleSheet(style.replace(color, ''))
|
||||||
|
|
||||||
|
UIFunctions.start_box_animation(self, widthLeftBox, width, "right")
|
||||||
|
|
||||||
|
def start_box_animation(self, left_box_width, right_box_width, direction):
|
||||||
|
right_width = 0
|
||||||
|
left_width = 0
|
||||||
|
|
||||||
|
# Check values
|
||||||
|
if left_box_width == 0 and direction == "left":
|
||||||
|
left_width = 240
|
||||||
|
else:
|
||||||
|
left_width = 0
|
||||||
|
# Check values
|
||||||
|
if right_box_width == 0 and direction == "right":
|
||||||
|
right_width = 240
|
||||||
|
else:
|
||||||
|
right_width = 0
|
||||||
|
|
||||||
|
# ANIMATION LEFT BOX
|
||||||
|
self.left_box = QPropertyAnimation(self.ui.extraLeftBox, b"minimumWidth")
|
||||||
|
self.left_box.setDuration(Settings.TIME_ANIMATION)
|
||||||
|
self.left_box.setStartValue(left_box_width)
|
||||||
|
self.left_box.setEndValue(left_width)
|
||||||
|
self.left_box.setEasingCurve(QEasingCurve.InOutQuart)
|
||||||
|
|
||||||
|
# ANIMATION RIGHT BOX
|
||||||
|
self.right_box = QPropertyAnimation(self.ui.extraRightBox, b"minimumWidth")
|
||||||
|
self.right_box.setDuration(Settings.TIME_ANIMATION)
|
||||||
|
self.right_box.setStartValue(right_box_width)
|
||||||
|
self.right_box.setEndValue(right_width)
|
||||||
|
self.right_box.setEasingCurve(QEasingCurve.InOutQuart)
|
||||||
|
|
||||||
|
# GROUP ANIMATION
|
||||||
|
self.group = QParallelAnimationGroup()
|
||||||
|
self.group.addAnimation(self.left_box)
|
||||||
|
self.group.addAnimation(self.right_box)
|
||||||
|
self.group.start()
|
||||||
|
|
||||||
|
# SELECT/DESELECT MENU
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
# SELECT
|
||||||
|
def selectMenu(getStyle):
|
||||||
|
select = getStyle + Settings.MENU_SELECTED_STYLESHEET
|
||||||
|
return select
|
||||||
|
|
||||||
|
# DESELECT
|
||||||
|
def deselectMenu(getStyle):
|
||||||
|
deselect = getStyle.replace(Settings.MENU_SELECTED_STYLESHEET, "")
|
||||||
|
return deselect
|
||||||
|
|
||||||
|
# START SELECTION
|
||||||
|
def selectStandardMenu(self, widget):
|
||||||
|
for w in self.ui.topMenu.findChildren(QPushButton):
|
||||||
|
if w.objectName() == widget:
|
||||||
|
w.setStyleSheet(UIFunctions.selectMenu(w.styleSheet()))
|
||||||
|
|
||||||
|
# RESET SELECTION
|
||||||
|
def resetStyle(self, widget):
|
||||||
|
for w in self.ui.topMenu.findChildren(QPushButton):
|
||||||
|
if w.objectName() != widget:
|
||||||
|
w.setStyleSheet(UIFunctions.deselectMenu(w.styleSheet()))
|
||||||
|
|
||||||
|
# IMPORT THEMES FILES QSS/CSS
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
def theme(self, file, useCustomTheme):
|
||||||
|
if useCustomTheme:
|
||||||
|
str = open(file, 'r').read()
|
||||||
|
self.ui.styleSheet.setStyleSheet(str)
|
||||||
|
|
||||||
|
# START - GUI DEFINITIONS
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
def uiDefinitions(self):
|
||||||
|
# 双击最大化/还原窗口的事件处理
|
||||||
|
|
||||||
|
|
||||||
|
if Settings.ENABLE_CUSTOM_TITLE_BAR:
|
||||||
|
# 启用自定义标题栏
|
||||||
|
self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # 设置窗口为无边框
|
||||||
|
self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口背景透明
|
||||||
|
|
||||||
|
# 移动窗口 / 最大化 / 还原窗口
|
||||||
|
def moveWindow(event):
|
||||||
|
# 如果当前窗口是最大化状态,则还原为正常状态
|
||||||
|
if UIFunctions.returStatus(self):
|
||||||
|
UIFunctions.maximize_restore(self)
|
||||||
|
# 移动窗口
|
||||||
|
if event.buttons() == QtCore.Qt.LeftButton: # 判断是否按下左键
|
||||||
|
self.move(self.pos() + event.globalPos() - self.dragPos) # 移动窗口
|
||||||
|
self.dragPos = event.globalPos() # 更新拖动位置
|
||||||
|
event.accept() # 接受事件
|
||||||
|
|
||||||
|
# 设置鼠标移动事件处理器
|
||||||
|
self.ui.frame_4.mouseMoveEvent = moveWindow
|
||||||
|
|
||||||
|
# 自定义窗口边缘控件(用于调整大小)
|
||||||
|
self.left_grip = CustomGrip(self, QtCore.Qt.LeftEdge, True)
|
||||||
|
self.right_grip = CustomGrip(self, QtCore.Qt.RightEdge, True)
|
||||||
|
self.top_grip = CustomGrip(self, QtCore.Qt.TopEdge, True)
|
||||||
|
self.bottom_grip = CustomGrip(self, QtCore.Qt.BottomEdge, True)
|
||||||
|
|
||||||
|
else:
|
||||||
|
# 如果不启用自定义标题栏,则设置应用程序边距并隐藏控制按钮
|
||||||
|
self.ui.appMargins.setContentsMargins(0, 0, 0, 0) # 设置边距为0
|
||||||
|
self.ui.minimizeAppBtn.hide() # 隐藏最小化按钮
|
||||||
|
self.ui.maximizeRestoreAppBtn.hide() # 隐藏最大化/还原按钮
|
||||||
|
self.ui.closeAppBtn.hide() # 隐藏关闭按钮
|
||||||
|
self.ui.frame_size_grip.hide() # 隐藏大小调整控件
|
||||||
|
|
||||||
|
# 设置窗口阴影效果
|
||||||
|
#self.shadow = QtCore.QGraphicsDropShadowEffect(self) # 创建阴影效果
|
||||||
|
#self.shadow.setBlurRadius(17) # 设置模糊半径
|
||||||
|
#self.shadow.setXOffset(0) # 设置X轴偏移
|
||||||
|
#self.shadow.setYOffset(0) # 设置Y轴偏移
|
||||||
|
#self.shadow.setColor(QtCore.QColor(0, 0, 0, 150)) # 设置阴影颜色
|
||||||
|
#self.ui.bgApp.setGraphicsEffect(self.shadow) # 应用阴影效果
|
||||||
|
|
||||||
|
# 设置窗口调整大小的控件
|
||||||
|
#self.sizegrip = QtCore.QSizeGrip(self.ui.frame_size_grip) # 创建大小调整控件
|
||||||
|
#self.sizegrip.setStyleSheet("width: 20px; height: 20px; margin 0px; padding 0px;") # 设置样式
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 最大化/还原按钮的点击事件
|
||||||
|
self.ui.pushButton_3.clicked.connect(lambda: UIFunctions.maximize_restore(self)) # 点击时最大化/还原窗口
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def resize_grips(self):
|
||||||
|
# 调整边缘控件的大小
|
||||||
|
if Settings.ENABLE_CUSTOM_TITLE_BAR:
|
||||||
|
# 设置各边缘控件的位置和大小
|
||||||
|
self.left_grip.setGeometry(0, 10, 10, self.height()) # 左侧控件
|
||||||
|
self.right_grip.setGeometry(self.width() - 10, 10, 10, self.height()) # 右侧控件
|
||||||
|
self.top_grip.setGeometry(0, 0, self.width(), 10) # 顶部控件
|
||||||
|
self.bottom_grip.setGeometry(0, self.height() - 10, self.width(), 10) # 底部控件
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ///////////////////////////////////////////////////////////////
|
||||||
|
# END - GUI DEFINITIONS
|
After Width: | Height: | Size: 370 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 5.6 KiB |
@ -0,0 +1,17 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="icon">
|
||||||
|
<file>picture/搜索.png</file>
|
||||||
|
<file>picture/全屏.png</file>
|
||||||
|
<file>picture/exit.png</file>
|
||||||
|
<file>picture/登录注册.png</file>
|
||||||
|
<file>picture/登录.png</file>
|
||||||
|
<file>picture/close.png</file>
|
||||||
|
<file>picture/active.png</file>
|
||||||
|
<file>picture/mini.png</file>
|
||||||
|
</qresource>
|
||||||
|
<qresource prefix="picture">
|
||||||
|
<file>picture/孤独寂寞冷.png</file>
|
||||||
|
<file>picture/login.jpg</file>
|
||||||
|
<file>picture/R-C.jpg</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|