提交修改
This commit is contained in:
parent
227e155f50
commit
ed2dd9cce1
|
@ -1,9 +1,11 @@
|
||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
import sys
|
import sys
|
||||||
|
import fileDataCreating
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from PySide6.QtUiTools import loadUiType
|
from PySide6.QtUiTools import loadUiType
|
||||||
from PySide6 import QtCore
|
from PySide6.QtCore import Slot,Signal,QThread,QMutex,QWaitCondition,QMutexLocker
|
||||||
|
|
||||||
|
|
||||||
# 定义公共路径
|
# 定义公共路径
|
||||||
|
@ -12,19 +14,28 @@ ui_file_patch = path.parent.parent / "ui" / "ui_main.ui"
|
||||||
# 从文件中加载UI定义
|
# 从文件中加载UI定义
|
||||||
formType, baseType = loadUiType(str(ui_file_patch))
|
formType, baseType = loadUiType(str(ui_file_patch))
|
||||||
|
|
||||||
|
class MyThread(QThread):
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super().__init__(parent=parent)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
fileDataCreating.main()
|
||||||
|
|
||||||
|
|
||||||
class Window(formType, baseType):
|
class Window(formType, baseType):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Window, self).__init__()
|
super(Window, self).__init__()
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
self.setup_thread()
|
||||||
|
|
||||||
|
|
||||||
# 输出设置
|
# 输出设置
|
||||||
self.Log_Output.document().setMaximumBlockCount(100)
|
self.Log_Output.document().setMaximumBlockCount(100)
|
||||||
self.Log_Output.ensureCursorVisible()
|
self.Log_Output.ensureCursorVisible()
|
||||||
|
|
||||||
|
@Slot() #声明槽函数
|
||||||
@QtCore.Slot() #声明槽函数
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.Log_Output.append('点击了开始按钮')
|
self.Log_Output.append('点击了开始按钮')
|
||||||
# 输入框参数校验
|
# 输入框参数校验
|
||||||
|
@ -35,12 +46,12 @@ class Window(formType, baseType):
|
||||||
self.conntest()
|
self.conntest()
|
||||||
# 开始运行
|
# 开始运行
|
||||||
if num == 0:
|
if num == 0:
|
||||||
self.start_run_file()
|
self.start_thread()
|
||||||
else:
|
else:
|
||||||
self.start_run_db()
|
self.start_run_db()
|
||||||
|
|
||||||
|
|
||||||
@QtCore.Slot()
|
@Slot()
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.Log_Output.append('点击了停止按钮')
|
self.Log_Output.append('点击了停止按钮')
|
||||||
num = self.tabWidget.currentIndex()
|
num = self.tabWidget.currentIndex()
|
||||||
|
@ -49,14 +60,23 @@ class Window(formType, baseType):
|
||||||
else:
|
else:
|
||||||
self.stop_run_db()
|
self.stop_run_db()
|
||||||
|
|
||||||
@QtCore.Slot()
|
@Slot()
|
||||||
def conntest(self):
|
def conntest(self):
|
||||||
self.Log_Output.append('点击了测试连接按钮')
|
self.Log_Output.append('点击了测试连接按钮')
|
||||||
self.check_db_input()
|
self.check_db_input()
|
||||||
# TODO(MH):校验连接信息
|
# TODO(MH):校验连接信息
|
||||||
self.Log_Output.append('数据库连接成功')
|
self.Log_Output.append('数据库连接成功')
|
||||||
|
|
||||||
|
|
||||||
|
def setup_thread(self):
|
||||||
|
self.thread = MyThread()
|
||||||
|
self.thread_running = True
|
||||||
|
|
||||||
|
def start_thread(self):
|
||||||
|
if self.thread_running:
|
||||||
|
self.thread.start()
|
||||||
|
|
||||||
|
|
||||||
def check_file_input(self):
|
def check_file_input(self):
|
||||||
self.Log_Output.append('文件参数校验通过')
|
self.Log_Output.append('文件参数校验通过')
|
||||||
|
|
||||||
|
@ -66,7 +86,10 @@ class Window(formType, baseType):
|
||||||
|
|
||||||
|
|
||||||
def start_run_file(self):
|
def start_run_file(self):
|
||||||
pass
|
|
||||||
|
# 调用文件处理脚本
|
||||||
|
self.Log_Output.append('开始生成文件。。。')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def start_run_db(self):
|
def start_run_db(self):
|
||||||
|
@ -74,7 +97,9 @@ class Window(formType, baseType):
|
||||||
|
|
||||||
|
|
||||||
def stop_run_file(self):
|
def stop_run_file(self):
|
||||||
pass
|
# 终止线程的事件循环
|
||||||
|
self.thread.quit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def stop_run_db(self):
|
def stop_run_db(self):
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="file_tab">
|
<widget class="QWidget" name="file_tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|
Loading…
Reference in New Issue