forked from Russell-A/database-course-design
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
76 lines (66 loc) · 2.33 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QDialog
from PyQt5.QtSql import QSqlDatabase, QSqlQuery
import PyQt5.QtGui
# 在这里加上所有的文件
from search import *
import register
import login
import search
import register_win
import register_fail
class MyWindow(QMainWindow, search.Ui_MainWindow):
def __init__(self, parent=None):
super(MyWindow, self).__init__(parent)
self.setupUi(self)
if __name__ == '__main__':
app = QApplication(sys.argv)
#链接数据库
db = QSqlDatabase.addDatabase("QODBC")
db.setDatabaseName("Driver={Sql Server};Server=127.0.0.1;Database=air")
ok = db.open()
# print(ok)
#Query = QSqlQuery("select * from 机场")
#while Query.next():
# print(Query.value(0),Query.value(1),)
# #注册与登录窗口
# # 实例化主窗口
# main = QMainWindow()
# main_ui = search.Ui_MainWindow()
# main_ui.setupUi(main)
# # 实例化注册子窗口
# child_register, child_register_ui = register.Ui_Dialog.instantiation(register)
# #实例化登录子窗口
# child_login, child_login_ui = login.Ui_Dialog.instantiation(login)
# # 按钮绑定事件
# child_register_ui.button_connect(child_register, main_ui.register_2)
# child_login_ui.button_connect(child_login, main_ui.login)
# # 实例化二级子窗口
# # 注册成功
# register_win_dialog, register_win_dialog_ui = register_win.Ui_Dialog.instantiation(register_win)
# # 注册失败
# register_fail_dialog, register_fail_dialog_ui = register_win.Ui_Dialog.instantiation(register_fail)
# # 判断注册是否成功
# """
# 判断是否存在重复命名
# """
# a = 0
# # 注册成功
# if a:
# register_win_dialog_ui.button_connect(register_win_dialog, child_register_ui.register_2)
# # 注册失败
# else:
# register_fail_dialog_ui.button_connect(register_fail_dialog, child_register_ui.register_2)
#
#
# main.show()
# 实例化窗口和子窗口
# login_window = Login_Window()
# register_window = Register_Window()
myWin = MyWindow()
# 按钮的绑定
# myWin.login.clicked.connect(login_window.show)
# myWin.register_2.clicked.connect(register_window.show)
myWin.setWindowIcon(QtGui.QIcon("flight.ico"))
myWin.show()
sys.exit(app.exec_())