83 lines
1.8 KiB
Python
83 lines
1.8 KiB
Python
# -*- coding:utf-8 -*-
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from PySide6.QtUiTools import loadUiType
|
|
from PySide6 import QtCore
|
|
|
|
|
|
# 定义公共路径
|
|
path = Path(__file__)
|
|
ui_file_patch = path.parent.parent / "ui" / "ui_main.ui"
|
|
# 从文件中加载UI定义
|
|
formType, baseType = loadUiType(str(ui_file_patch))
|
|
|
|
|
|
class Window(formType, baseType):
|
|
|
|
def __init__(self):
|
|
super(Window, self).__init__()
|
|
self.setupUi(self)
|
|
|
|
# 输出设置
|
|
self.Log_Output.document().setMaximumBlockCount(100)
|
|
self.Log_Output.ensureCursorVisible()
|
|
|
|
|
|
@QtCore.Slot() #声明槽函数
|
|
def start(self):
|
|
self.Log_Output.append('点击了开始按钮')
|
|
# 输入框参数校验
|
|
num = self.tabWidget.currentIndex()
|
|
if num == 0:
|
|
self.check_file_input()
|
|
else:
|
|
self.conntest()
|
|
# 开始运行
|
|
if num == 0:
|
|
self.start_run_file()
|
|
else:
|
|
self.start_run_db()
|
|
|
|
|
|
@QtCore.Slot()
|
|
def stop(self):
|
|
self.Log_Output.append('点击了停止按钮')
|
|
num = self.tabWidget.currentIndex()
|
|
if num == 0:
|
|
self.stop_run_file()
|
|
else:
|
|
self.stop_run_db()
|
|
|
|
@QtCore.Slot()
|
|
def conntest(self):
|
|
self.Log_Output.append('点击了测试连接按钮')
|
|
self.check_db_input()
|
|
# TODO(MH):校验连接信息
|
|
self.Log_Output.append('数据库连接成功')
|
|
|
|
|
|
def check_file_input(self):
|
|
self.Log_Output.append('文件参数校验通过')
|
|
|
|
|
|
def check_db_input(self):
|
|
self.Log_Output.append('数据库参数校验通过,开始连接数据库测试。。。')
|
|
|
|
|
|
def start_run_file(self):
|
|
pass
|
|
|
|
|
|
def start_run_db(self):
|
|
pass
|
|
|
|
|
|
def stop_run_file(self):
|
|
pass
|
|
|
|
|
|
def stop_run_db(self):
|
|
pass
|
|
|