本帖最后由 Allenxu520 于 2023-11-28 16:01 编辑
使用QTdesigner设计的UI界面,Python编写的后端,包含数据库连接+各个子界面+简单的坐标转换工具箱......
发上来装个B,有需要的可帮写其他程序(支持打包为exe程序),请我喝杯咖啡就行[Python] 纯文本查看 复制代码 # coding:utf-8
import sys
from PyQt5.QtCore import Qt, QUrl
from PyQt5.QtGui import QIcon, QDesktopServices
from PyQt5.QtWidgets import QApplication, QFrame, QHBoxLayout
from qfluentwidgets import (NavigationItemPosition, MessageBox, MSFluentWindow,
SubtitleLabel, setFont)
from qfluentwidgets import FluentIcon as FIF
from view.GPS import GPS
from view.MySQLSetting import Setting
from view.onepage import Onepage
from view.device import Device
from view.tikuup import Other
from view.TTdevice import TTDevice
from view.app_other import App_other
from view.user import User
import utils.gl as gl
class Window(MSFluentWindow):
def __init__(self):
super().__init__()
gl._init()
# 创建子界面
self.homeInterface = Onepage(self)
self.app_user = User(self)
self.libraryInterface = Setting(self)
self.appInterface1 = GPS(self)
self.appInterface2 = Device(self)
self.appInterface3 = TTDevice(self)
self.appInterface4 = Other(self)
# self.app_device = Device_toMySQL(self)
self.libraryInterface1 = App_other(self)
self.initNavigation() # 初始化导航栏
self.initWindow() # 初始化窗口设置
def initNavigation(self):
# 添加子界面,展示在主界面上
self.addSubInterface(self.homeInterface, FIF.HOME, '主页', FIF.HOME_FILL)
self.addSubInterface(self.app_user, FIF.FEEDBACK, '人员关联')
self.addSubInterface(self.appInterface1, FIF.SEND, '坐标转换')
self.addSubInterface(self.appInterface2, FIF.LABEL, '台账新增')
self.addSubInterface(self.appInterface4, FIF.CLOUD_DOWNLOAD, '题库导入')
self.addSubInterface(self.libraryInterface1, FIF.APPLICATION, '应用')
self.addSubInterface(self.libraryInterface, FIF.BOOK_SHELF, '库', FIF.LIBRARY_FILL, NavigationItemPosition.BOTTOM)
self.navigationInterface.addItem(
routeKey='Help',
icon=FIF.HELP,
text='帮助',
onClick=self.showMessageBox,
selectable=False,
position=NavigationItemPosition.BOTTOM,
)
self.navigationInterface.setCurrentItem(self.homeInterface.objectName())
def initWindow(self):
self.resize(1020, 760)
self.setWindowIcon(QIcon(':/qfluentwidgets/images/logo.png'))
self.setWindowTitle('Newdata MySQL Tool')
desktop = QApplication.desktop().availableGeometry()
w, h = desktop.width(), desktop.height()
self.move(w//2 - self.width()//2, h//2 - self.height()//2) |