qt面板试制
This commit is contained in:
parent
3538029b71
commit
2770c4fb34
|
|
@ -0,0 +1,51 @@
|
||||||
|
from PySide6.QtWidgets import QMainWindow, QApplication, QFileDialog, QWidget
|
||||||
|
from Ui_Qt面板 import *
|
||||||
|
from Ui_寻找空闲题号 import *
|
||||||
|
import os
|
||||||
|
from database_tools import *
|
||||||
|
|
||||||
|
|
||||||
|
class MyWindow(QMainWindow,Ui_MainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.setupUi(self)
|
||||||
|
self.bind()
|
||||||
|
|
||||||
|
def bind(self):
|
||||||
|
self.subwindow = kxthWindow()
|
||||||
|
self.action_kxth.triggered.connect(lambda: self.subwindow.show())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class kxthWindow(QWidget,Ui_Form):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.setupUi(self)
|
||||||
|
self.bind()
|
||||||
|
self.lineEdit_FilePath.setText(os.path.join(os.path.dirname(os.getcwd()),"题库0.3","Problems.json"))
|
||||||
|
self.ShowAvailable()
|
||||||
|
|
||||||
|
|
||||||
|
def bind(self):
|
||||||
|
self.pushButton_SelectFilepath.clicked.connect(self.getFilePathandShow)
|
||||||
|
|
||||||
|
def ShowAvailable(self):
|
||||||
|
self.jsonpath = self.lineEdit_FilePath.text()
|
||||||
|
pro_dict = load_dict(self.jsonpath)
|
||||||
|
self.label_Available.setText(spareIDs(pro_dict))
|
||||||
|
|
||||||
|
def getFilePathandShow(self):
|
||||||
|
pathlist = QFileDialog.getOpenFileName(self,"选择文件",".","json文件(*.json);;所有文件(*)")
|
||||||
|
self.lineEdit_FilePath.setText(pathlist[0])
|
||||||
|
self.ShowAvailable()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app = QApplication([])
|
||||||
|
windows = MyWindow()
|
||||||
|
windows.show()
|
||||||
|
app.exec()
|
||||||
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>426</width>
|
||||||
|
<height>366</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget"/>
|
||||||
|
<widget class="QMenuBar" name="menubar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>426</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menu">
|
||||||
|
<property name="title">
|
||||||
|
<string>录入</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="action_kxth"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>维护</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_3">
|
||||||
|
<property name="title">
|
||||||
|
<string>使用</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_4">
|
||||||
|
<property name="title">
|
||||||
|
<string>备课组</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuLaTeX">
|
||||||
|
<property name="title">
|
||||||
|
<string>LaTeX代码相关</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_5">
|
||||||
|
<property name="title">
|
||||||
|
<string>退出</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menu"/>
|
||||||
|
<addaction name="menu_2"/>
|
||||||
|
<addaction name="menu_3"/>
|
||||||
|
<addaction name="menu_4"/>
|
||||||
|
<addaction name="menuLaTeX"/>
|
||||||
|
<addaction name="menu_5"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
|
<action name="action_kxth">
|
||||||
|
<property name="text">
|
||||||
|
<string>寻找空闲题号</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
## Form generated from reading UI file 'Qt面板.ui'
|
||||||
|
##
|
||||||
|
## Created by: Qt User Interface Compiler version 6.6.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, QMainWindow, QMenu, QMenuBar,
|
||||||
|
QSizePolicy, QStatusBar, QWidget)
|
||||||
|
|
||||||
|
class Ui_MainWindow(object):
|
||||||
|
def setupUi(self, MainWindow):
|
||||||
|
if not MainWindow.objectName():
|
||||||
|
MainWindow.setObjectName(u"MainWindow")
|
||||||
|
MainWindow.resize(426, 366)
|
||||||
|
self.action_kxth = QAction(MainWindow)
|
||||||
|
self.action_kxth.setObjectName(u"action_kxth")
|
||||||
|
self.centralwidget = QWidget(MainWindow)
|
||||||
|
self.centralwidget.setObjectName(u"centralwidget")
|
||||||
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
|
self.menubar = QMenuBar(MainWindow)
|
||||||
|
self.menubar.setObjectName(u"menubar")
|
||||||
|
self.menubar.setGeometry(QRect(0, 0, 426, 22))
|
||||||
|
self.menu = QMenu(self.menubar)
|
||||||
|
self.menu.setObjectName(u"menu")
|
||||||
|
self.menu_2 = QMenu(self.menubar)
|
||||||
|
self.menu_2.setObjectName(u"menu_2")
|
||||||
|
self.menu_3 = QMenu(self.menubar)
|
||||||
|
self.menu_3.setObjectName(u"menu_3")
|
||||||
|
self.menu_4 = QMenu(self.menubar)
|
||||||
|
self.menu_4.setObjectName(u"menu_4")
|
||||||
|
self.menuLaTeX = QMenu(self.menubar)
|
||||||
|
self.menuLaTeX.setObjectName(u"menuLaTeX")
|
||||||
|
self.menu_5 = QMenu(self.menubar)
|
||||||
|
self.menu_5.setObjectName(u"menu_5")
|
||||||
|
MainWindow.setMenuBar(self.menubar)
|
||||||
|
self.statusbar = QStatusBar(MainWindow)
|
||||||
|
self.statusbar.setObjectName(u"statusbar")
|
||||||
|
MainWindow.setStatusBar(self.statusbar)
|
||||||
|
|
||||||
|
self.menubar.addAction(self.menu.menuAction())
|
||||||
|
self.menubar.addAction(self.menu_2.menuAction())
|
||||||
|
self.menubar.addAction(self.menu_3.menuAction())
|
||||||
|
self.menubar.addAction(self.menu_4.menuAction())
|
||||||
|
self.menubar.addAction(self.menuLaTeX.menuAction())
|
||||||
|
self.menubar.addAction(self.menu_5.menuAction())
|
||||||
|
self.menu.addAction(self.action_kxth)
|
||||||
|
|
||||||
|
self.retranslateUi(MainWindow)
|
||||||
|
|
||||||
|
QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
# setupUi
|
||||||
|
|
||||||
|
def retranslateUi(self, MainWindow):
|
||||||
|
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None))
|
||||||
|
self.action_kxth.setText(QCoreApplication.translate("MainWindow", u"\u5bfb\u627e\u7a7a\u95f2\u9898\u53f7", None))
|
||||||
|
self.menu.setTitle(QCoreApplication.translate("MainWindow", u"\u5f55\u5165", None))
|
||||||
|
self.menu_2.setTitle(QCoreApplication.translate("MainWindow", u"\u7ef4\u62a4", None))
|
||||||
|
self.menu_3.setTitle(QCoreApplication.translate("MainWindow", u"\u4f7f\u7528", None))
|
||||||
|
self.menu_4.setTitle(QCoreApplication.translate("MainWindow", u"\u5907\u8bfe\u7ec4", None))
|
||||||
|
self.menuLaTeX.setTitle(QCoreApplication.translate("MainWindow", u"LaTeX\u4ee3\u7801\u76f8\u5173", None))
|
||||||
|
self.menu_5.setTitle(QCoreApplication.translate("MainWindow", u"\u9000\u51fa", None))
|
||||||
|
# retranslateUi
|
||||||
|
|
||||||
Reference in New Issue