Przeglądaj źródła

完成了项目内容的动态显示,新建项目的功能,并模块化了一些代码,便于后期修改。(data_show.py是用于数据展示的Arrange_Data和Data_in_Cell方法,database_operations.py是操作数据库的方法,用于新建项目,file_system_watching.py 是用于文件系统监视的代码,用于实现项目下拉框的动态显示)

Mr.wzp 5 miesięcy temu
rodzic
commit
f7bfc5c199

+ 13
- 11
Back/GC/GC.py Wyświetl plik

61
 # 数据库插入函数,插入数据到GC_Input_Param中
61
 # 数据库插入函数,插入数据到GC_Input_Param中
62
 def insert_into_database(file_name, cell_values, ms_station, last_station_count, new_station_count, last_sum_hdiff,
62
 def insert_into_database(file_name, cell_values, ms_station, last_station_count, new_station_count, last_sum_hdiff,
63
                          new_sum_hdiff,
63
                          new_sum_hdiff,
64
-                         last_sum_rlen, new_sum_rlen, db_path,file_name_utf8):
64
+                         last_sum_rlen, new_sum_rlen, db_path, file_name_utf8):
65
     """
65
     """
66
     将文件名和结果名称插入或更新到数据库的GC_Input_Param表中。
66
     将文件名和结果名称插入或更新到数据库的GC_Input_Param表中。
67
     """
67
     """
94
                 (cell_values['D1'], cell_values['C1'], cell_values['I1'], ms_station, last_station_count,
94
                 (cell_values['D1'], cell_values['C1'], cell_values['I1'], ms_station, last_station_count,
95
                  new_station_count, last_sum_hdiff, new_sum_hdiff, last_sum_rlen, new_sum_rlen, file_name_utf8)
95
                  new_station_count, last_sum_hdiff, new_sum_hdiff, last_sum_rlen, new_sum_rlen, file_name_utf8)
96
             )
96
             )
97
-            QMessageBox.information(None,"提示",
98
-                                f"文件 '{file_name}' 已成功更新到本地数据库中,点击'OK'以关闭此对话框。对话框关闭后,请点击“计算”以重新计算数据")
97
+            QMessageBox.information(None, "提示",
98
+                                    f"文件 '{file_name}' 已成功更新到本地数据库中,点击'OK'以关闭此对话框。对话框关闭后,请点击“计算”以重新计算数据")
99
         else:
99
         else:
100
             # 插入新记录
100
             # 插入新记录
101
             cursor.execute(
101
             cursor.execute(
105
                                             Last_SumRLen, New_SumRLen) 
105
                                             Last_SumRLen, New_SumRLen) 
106
                 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
106
                 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
107
                 """,
107
                 """,
108
-                (file_name_utf8, cell_values['D1'], cell_values['C1'], cell_values['I1'], ms_station, last_station_count,
109
-                 new_station_count, last_sum_hdiff, new_sum_hdiff, last_sum_rlen, new_sum_rlen)
108
+                (
109
+                file_name_utf8, cell_values['D1'], cell_values['C1'], cell_values['I1'], ms_station, last_station_count,
110
+                new_station_count, last_sum_hdiff, new_sum_hdiff, last_sum_rlen, new_sum_rlen)
110
             )
111
             )
111
-            QMessageBox.information(None,"提示",
112
-                                f"文件 '{file_name}' 已成功添加到本地数据库中,点击'OK'以关闭此对话框。对话框关闭后,请点击“计算”以计算数据")
112
+            QMessageBox.information(None, "提示",
113
+                                    f"文件 '{file_name}' 已成功添加到本地数据库中,点击'OK'以关闭此对话框。对话框关闭后,请点击“计算”以计算数据")
113
 
114
 
114
         conn.commit()
115
         conn.commit()
115
     except sqlite3.Error as e:
116
     except sqlite3.Error as e:
145
 
146
 
146
 
147
 
147
 # 插入点数据到GC_Input_Point中
148
 # 插入点数据到GC_Input_Point中
148
-def insert_data_into_database(data, file_name, cell_values, db_path,file_name_utf8):
149
+def insert_data_into_database(data, file_name, cell_values, db_path, file_name_utf8):
149
     """
150
     """
150
     将数据插入到数据库表 GC_Input_Point 中。如果 TableName 相同,则清空表,
151
     将数据插入到数据库表 GC_Input_Point 中。如果 TableName 相同,则清空表,
151
     然后插入新的数据。
152
     然后插入新的数据。
174
                 INSERT INTO GC_Input_Point (Last_ID, Last_SPName, Last_EPName,Last_HDiff,Last_RLen, New_ID, New_SPName, New_EPName,New_HDiff,New_RLen, TableName, Last_ResultName, New_ResultName)
175
                 INSERT INTO GC_Input_Point (Last_ID, Last_SPName, Last_EPName,Last_HDiff,Last_RLen, New_ID, New_SPName, New_EPName,New_HDiff,New_RLen, TableName, Last_ResultName, New_ResultName)
175
                 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
176
                 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
176
                 """,
177
                 """,
177
-                (a_value, b_value, c_value, d_value, e_value, f_value, g_value, h_value, i_value, j_value, file_name_utf8,
178
+                (a_value, b_value, c_value, d_value, e_value, f_value, g_value, h_value, i_value, j_value,
179
+                 file_name_utf8,
178
                  cell_values['D1'],
180
                  cell_values['D1'],
179
                  cell_values['I1'])
181
                  cell_values['I1'])
180
             )
182
             )
215
     # 调用插入数据库的函数
217
     # 调用插入数据库的函数
216
     if file_name:
218
     if file_name:
217
         insert_into_database(file_name, cell_values, ms_station, last_station_count, new_station_count, last_sum_hdiff,
219
         insert_into_database(file_name, cell_values, ms_station, last_station_count, new_station_count, last_sum_hdiff,
218
-                             new_sum_hdiff, last_sum_rlen, new_sum_rlen, db_path,file_name_utf8)
219
-        insert_data_into_database(data, file_name, cell_values, db_path,file_name_utf8)
220
+                             new_sum_hdiff, last_sum_rlen, new_sum_rlen, db_path, file_name_utf8)
221
+        insert_data_into_database(data, file_name, cell_values, db_path, file_name_utf8)
220
     else:
222
     else:
221
         print("没有数据可插入数据库")
223
         print("没有数据可插入数据库")

+ 5
- 4
Back/GS/GSshow.py Wyświetl plik

1
 import sqlite3
1
 import sqlite3
2
 
2
 
3
 from PySide6.QtGui import QStandardItemModel
3
 from PySide6.QtGui import QStandardItemModel
4
+from Back.Program_Run.data_show import *
4
 
5
 
5
 
6
 
6
 def main_function(ui, db_path, utf_en):
7
 def main_function(ui, db_path, utf_en):
29
     result2 = cursor1.fetchall()
30
     result2 = cursor1.fetchall()
30
 
31
 
31
     # 对结果集进行处理,把汉字转换过来, 添加表头部分
32
     # 对结果集进行处理,把汉字转换过来, 添加表头部分
32
-    nlist1, plist1 = ui.Arrange_Data1(result1)
33
-    nlist2, plist2 = ui.Arrange_Data2(result2)
33
+    nlist1, plist1 = Arrange_Data1(result1)
34
+    nlist2, plist2 = Arrange_Data2(result2)
34
 
35
 
35
     # 创建一个数据模型(复测成果表)
36
     # 创建一个数据模型(复测成果表)
36
     model1 = QStandardItemModel()
37
     model1 = QStandardItemModel()
37
-    model1 = ui.Data_in_Cell1(plist1)
38
+    model1 = Data_in_Cell1(plist1)
38
     model1.setHorizontalHeaderLabels(
39
     model1.setHorizontalHeaderLabels(
39
         ['点名', '前期X', '前期Y', '本期X', '本期Y', '前期-本期X', '前期-本期Y', '前期-本期P', '位移判定'])
40
         ['点名', '前期X', '前期Y', '本期X', '本期Y', '前期-本期X', '前期-本期Y', '前期-本期P', '位移判定'])
40
     model1.setVerticalHeaderLabels(nlist1)
41
     model1.setVerticalHeaderLabels(nlist1)
47
 
48
 
48
     # 创建一个数据模型(基准归算表)
49
     # 创建一个数据模型(基准归算表)
49
     model2 = QStandardItemModel()
50
     model2 = QStandardItemModel()
50
-    model2 = ui.Data_in_Cell2(plist2)
51
+    model2 = Data_in_Cell2(plist2)
51
     model2.setHorizontalHeaderLabels(
52
     model2.setHorizontalHeaderLabels(
52
         ['点名', '基准归算X', '基准归算Y', '前期-归算X', '前期-归算Y', '前期-归算P', '位移判定'])
53
         ['点名', '基准归算X', '基准归算Y', '前期-归算X', '前期-归算Y', '前期-归算P', '位移判定'])
53
     model2.setVerticalHeaderLabels(nlist2)
54
     model2.setVerticalHeaderLabels(nlist2)

+ 0
- 0
Back/Program_Run/__init__.py Wyświetl plik


+ 243
- 0
Back/Program_Run/data_show.py Wyświetl plik

1
+# 数据处理相关代码
2
+from PySide6.QtGui import QStandardItemModel, QStandardItem
3
+# 稳定性成果表
4
+def Arrange_Data(list1):
5
+    # 最终return的
6
+    list2 = []
7
+    # 点号部分
8
+    nlist = []
9
+    for data1 in list1:
10
+        # 点名
11
+        # 存每一行的数据
12
+        resultlist = []
13
+        pn = data1[0].decode('utf-8')
14
+        resultlist.append(pn)
15
+        nlist.append(pn)
16
+        resultlist.append(data1[1])
17
+        resultlist.append(data1[2])
18
+        resultlist.append(data1[3])
19
+        resultlist.append(data1[4])
20
+        resultlist.append(data1[5])
21
+        resultlist.append(data1[6])
22
+        resultlist.append(data1[7])
23
+        resultlist.append(data1[8])
24
+        resultlist.append(data1[9])
25
+        resultlist.append(data1[10])
26
+        resultlist.append(data1[11])
27
+        # 判定1
28
+        an1 = data1[12].decode('utf-8')
29
+        resultlist.append(an1)
30
+        resultlist.append(data1[13])
31
+        resultlist.append(data1[14])
32
+        resultlist.append(data1[15])
33
+        # 判定2
34
+        an2 = data1[16].decode('utf-8')
35
+        resultlist.append(an2)
36
+        list2.append(resultlist)
37
+
38
+    return nlist, list2
39
+
40
+# GS复测成果表
41
+def Arrange_Data1(list1):
42
+    # 最终return的
43
+    list2 = []
44
+    # 点号部分
45
+    nlist = []
46
+    for data1 in list1:
47
+        # 点名
48
+        # 存每一行的数据
49
+        resultlist = []
50
+        pn = data1[0].decode('utf-8')
51
+        resultlist.append(pn)
52
+        nlist.append(pn)
53
+        resultlist.append(data1[1])
54
+        resultlist.append(data1[2])
55
+        resultlist.append(data1[3])
56
+        resultlist.append(data1[4])
57
+        resultlist.append(data1[5])
58
+        resultlist.append(data1[6])
59
+        resultlist.append(data1[7])
60
+        # 判定
61
+        an1 = data1[8].decode('utf-8')
62
+        resultlist.append(an1)
63
+        list2.append(resultlist)
64
+
65
+    return nlist, list2
66
+
67
+# GS基准归算表
68
+def Arrange_Data2(list1):
69
+    # 最终return的
70
+    list2 = []
71
+    # 点号部分
72
+    nlist = []
73
+    for data1 in list1:
74
+        # 点名
75
+        # 存每一行的数据
76
+        resultlist = []
77
+        pn = data1[0].decode('utf-8')
78
+        resultlist.append(pn)
79
+        nlist.append(pn)
80
+        resultlist.append(data1[1])
81
+        resultlist.append(data1[2])
82
+        resultlist.append(data1[3])
83
+        resultlist.append(data1[4])
84
+        resultlist.append(data1[5])
85
+        # 判定
86
+        an1 = data1[6].decode('utf-8')
87
+        resultlist.append(an1)
88
+        list2.append(resultlist)
89
+
90
+    return nlist, list2
91
+
92
+
93
+def Data_in_Cell(list1):
94
+    model = QStandardItemModel()
95
+    xx = 0
96
+    while xx < len(list1):
97
+        data1 = list1[xx]
98
+        # 点号
99
+        cell1 = str(data1[0])
100
+        item = QStandardItem(cell1)
101
+        model.setItem(xx, 0, item)
102
+        # 首期
103
+        cell1 = str(round(data1[1], 4))
104
+        item = QStandardItem(cell1)
105
+        model.setItem(xx, 1, item)
106
+        cell1 = str(round(data1[2], 4))
107
+        item = QStandardItem(cell1)
108
+        model.setItem(xx, 2, item)
109
+        # 上期
110
+        cell1 = str(round(data1[3], 4))
111
+        item = QStandardItem(cell1)
112
+        model.setItem(xx, 3, item)
113
+        cell1 = str(round(data1[4], 4))
114
+        item = QStandardItem(cell1)
115
+        model.setItem(xx, 4, item)
116
+        # 权
117
+        cell1 = str(int(data1[5]))
118
+        item = QStandardItem(cell1)
119
+        model.setItem(xx, 5, item)
120
+        # 本期
121
+        cell1 = str(round(data1[6], 4))
122
+        item = QStandardItem(cell1)
123
+        model.setItem(xx, 6, item)
124
+        cell1 = str(round(data1[7], 4))
125
+        item = QStandardItem(cell1)
126
+        model.setItem(xx, 7, item)
127
+        # 权
128
+        cell1 = str(int(data1[8]))
129
+        item = QStandardItem(cell1)
130
+        model.setItem(xx, 8, item)
131
+        # 本-首
132
+        cell1 = str(round(data1[9], 1))
133
+        item = QStandardItem(cell1)
134
+        model.setItem(xx, 9, item)
135
+        cell1 = str(round(data1[10], 1))
136
+        item = QStandardItem(cell1)
137
+        model.setItem(xx, 10, item)
138
+        cell1 = str(round(data1[11], 1))
139
+        item = QStandardItem(cell1)
140
+        model.setItem(xx, 11, item)
141
+        # 判定(如果是稳定则不显示)
142
+        cell1 = str(data1[12])
143
+        if cell1 == '稳定':
144
+            cell1 = ''
145
+        item = QStandardItem(cell1)
146
+        model.setItem(xx, 12, item)
147
+        # 本-上
148
+        cell1 = str(round(data1[13], 1))
149
+        item = QStandardItem(cell1)
150
+        model.setItem(xx, 13, item)
151
+        cell1 = str(round(data1[14], 1))
152
+        item = QStandardItem(cell1)
153
+        model.setItem(xx, 14, item)
154
+        cell1 = str(round(data1[15], 1))
155
+        item = QStandardItem(cell1)
156
+        model.setItem(xx, 15, item)
157
+        # 判定
158
+        cell1 = str(data1[16])
159
+        if cell1 == '稳定':
160
+            cell1 = ''
161
+        item = QStandardItem(cell1)
162
+        model.setItem(xx, 16, item)
163
+        xx = xx + 1
164
+    return model
165
+
166
+# GS复测成果表
167
+def Data_in_Cell1(list1):
168
+    model = QStandardItemModel()
169
+    xx = 0
170
+    while xx < len(list1):
171
+        data1 = list1[xx]
172
+        # 点号
173
+        cell1 = str(data1[0])
174
+        item = QStandardItem(cell1)
175
+        model.setItem(xx, 0, item)
176
+        # 上期
177
+        cell1 = str(round(data1[1], 4))
178
+        item = QStandardItem(cell1)
179
+        model.setItem(xx, 1, item)
180
+        cell1 = str(round(data1[2], 4))
181
+        item = QStandardItem(cell1)
182
+        model.setItem(xx, 2, item)
183
+        # 本期
184
+        cell1 = str(round(data1[3], 4))
185
+        item = QStandardItem(cell1)
186
+        model.setItem(xx, 3, item)
187
+        cell1 = str(round(data1[4], 4))
188
+        item = QStandardItem(cell1)
189
+        model.setItem(xx, 4, item)
190
+        # 上-本
191
+        cell1 = str(round(data1[5], 1))
192
+        item = QStandardItem(cell1)
193
+        model.setItem(xx, 5, item)
194
+        cell1 = str(round(data1[6], 1))
195
+        item = QStandardItem(cell1)
196
+        model.setItem(xx, 6, item)
197
+        cell1 = str(round(data1[7], 1))
198
+        item = QStandardItem(cell1)
199
+        model.setItem(xx, 7, item)
200
+        # 判定(如果是稳定则不显示)
201
+        cell1 = str(data1[8])
202
+        if cell1 == '稳定':
203
+            cell1 = ''
204
+        item = QStandardItem(cell1)
205
+        model.setItem(xx, 8, item)
206
+        xx = xx + 1
207
+    return model
208
+
209
+# GS基准归算表
210
+def Data_in_Cell2(list1):
211
+    model = QStandardItemModel()
212
+    xx = 0
213
+    while xx < len(list1):
214
+        data1 = list1[xx]
215
+        # 点号
216
+        cell1 = str(data1[0])
217
+        item = QStandardItem(cell1)
218
+        model.setItem(xx, 0, item)
219
+        # 计算
220
+        cell1 = str(round(data1[1], 4))
221
+        item = QStandardItem(cell1)
222
+        model.setItem(xx, 1, item)
223
+        cell1 = str(round(data1[2], 4))
224
+        item = QStandardItem(cell1)
225
+        model.setItem(xx, 2, item)
226
+        # 上-计
227
+        cell1 = str(round(data1[3], 1))
228
+        item = QStandardItem(cell1)
229
+        model.setItem(xx, 3, item)
230
+        cell1 = str(round(data1[4], 1))
231
+        item = QStandardItem(cell1)
232
+        model.setItem(xx, 4, item)
233
+        cell1 = str(round(data1[5], 1))
234
+        item = QStandardItem(cell1)
235
+        model.setItem(xx, 5, item)
236
+        # 判定(如果为稳定则不显示)
237
+        cell1 = str(data1[6])
238
+        if cell1 == '稳定':
239
+            cell1 = ''
240
+        item = QStandardItem(cell1)
241
+        model.setItem(xx, 6, item)
242
+        xx = xx + 1
243
+    return model

+ 54
- 0
Back/Program_Run/database_operations.py Wyświetl plik

1
+# database_operations.py  数据库操作相关代码,主要用于展示数据库名字
2
+import sqlite3
3
+import os
4
+from PySide6.QtWidgets import QMessageBox
5
+
6
+
7
+def create_database_and_tables(self):
8
+    db_name = self.lineEdit.text().strip()
9
+
10
+    if not db_name:
11
+        QMessageBox.warning(self, "警告", "请输入数据库名称")
12
+        return
13
+    # 转换为UTF-8编码
14
+    # db_name_utf8 = db_name.encode('utf-8')
15
+    # 获取当前脚本所在的目录
16
+    current_dir = os.path.dirname(os.path.abspath(__file__))
17
+    # 构建 SQL 文件夹的相对路径(上一级的上一级中的 SQL 文件夹)
18
+    sql_folder = os.path.join(current_dir, '..', '..', 'SQL')
19
+    # 将相对路径转换为绝对路径
20
+    sql_folder = os.path.abspath(sql_folder)
21
+
22
+    # 确保 SQL 文件夹存在
23
+    if not os.path.exists(sql_folder):
24
+        os.makedirs(sql_folder)
25
+
26
+    # 构建数据库文件的完整路径
27
+    db_path = os.path.join(sql_folder, f"{db_name}.db")
28
+    # 读取现有的数据库结构
29
+    existing_db_path = os.path.join(sql_folder, 'DataBase.db')
30
+    if not os.path.exists(existing_db_path):
31
+        QMessageBox.critical(self.main_window, "错误", "找不到现有的数据库结构文件 DataBase.db")
32
+        return
33
+    try:
34
+        # 连接到现有的数据库以获取表结构
35
+        with sqlite3.connect(existing_db_path) as existing_conn:
36
+            existing_cursor = existing_conn.cursor()
37
+            existing_cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
38
+            tables = [row[0] for row in existing_cursor.fetchall()]
39
+
40
+            # 创建新的数据库
41
+            with sqlite3.connect(db_path) as new_conn:
42
+                new_cursor = new_conn.cursor()
43
+
44
+                for table in tables:
45
+                    # 获取表的创建语句
46
+                    existing_cursor.execute(f"SELECT sql FROM sqlite_master WHERE type='table' AND name='{table}';")
47
+                    create_table_sql = existing_cursor.fetchone()[0]
48
+                    new_cursor.execute(create_table_sql)
49
+
50
+                new_conn.commit()
51
+
52
+        QMessageBox.information(self.main_window, "成功", f"项目{db_name}已成功创建")
53
+    except Exception as e:
54
+        QMessageBox.critical(self.main_window, "错误", f"创建项目时出错: {str(e)}")

+ 45
- 0
Back/Program_Run/file_system_watching.py Wyświetl plik

1
+# file_system_watching.py  文件系统监控代码,用于监控comboBox的显示
2
+from watchdog.events import FileSystemEventHandler
3
+from PySide6.QtCore import QCoreApplication
4
+from watchdog.observers import Observer
5
+import os
6
+
7
+class ComboBoxUpdater(FileSystemEventHandler):
8
+    def __init__(self, comboBox, sql_folder):
9
+        super().__init__()
10
+        self.comboBox = comboBox
11
+        self.sql_folder = sql_folder
12
+
13
+    def on_modified(self, event):
14
+        if event.is_directory:
15
+            return
16
+        if event.src_path.endswith('.db'):
17
+            self.update_combo_box()
18
+
19
+    def on_created(self, event):
20
+        if event.is_directory:
21
+            return
22
+        if event.src_path.endswith('.db'):
23
+            self.update_combo_box()
24
+
25
+    def on_deleted(self, event):
26
+        if event.is_directory:
27
+            return
28
+        if event.src_path.endswith('.db'):
29
+            self.update_combo_box()
30
+
31
+    def update_combo_box(self):
32
+        # 清空现有的 comboBox 内容
33
+        self.comboBox.clear()
34
+
35
+        # 列出 SQL 文件夹中的所有 .db 文件
36
+        db_files = [f for f in os.listdir(self.sql_folder) if f.endswith('.db')]
37
+
38
+        # 将数据库文件名添加到 comboBox 中
39
+        for db_file in db_files:
40
+            db_name = os.path.splitext(db_file)[0]  # 获取数据库名称并去掉.db后缀
41
+            self.comboBox.addItem(QCoreApplication.translate("MainWindow", db_name, None))
42
+
43
+        # 如果没有找到任何数据库文件,显示提示信息
44
+        if not db_files:
45
+            self.comboBox.addItem(QCoreApplication.translate("MainWindow", "未找到数据库文件", None))

+ 11
- 1
Back/WD/WDshow.py Wyświetl plik

1
-def main_function(ui, file_path, db_path):
1
+from Back.Program_Run.data_show import *
2
+import sqlite3
3
+
4
+from PySide6.QtGui import QStandardItemModel
5
+
6
+def main_function(ui, db_path, utf_en):
2
     # 只显示一个tab
7
     # 只显示一个tab
3
     ui.tabWidget.setTabVisible(0, True)
8
     ui.tabWidget.setTabVisible(0, True)
4
     ui.tabWidget.setTabVisible(1, False)
9
     ui.tabWidget.setTabVisible(1, False)
5
     ui.tabWidget.setTabVisible(2, False)
10
     ui.tabWidget.setTabVisible(2, False)
6
     # 重新设置文字名称
11
     # 重新设置文字名称
7
     ui.tabWidget.setTabText(0, '平面控制网稳定性计算成果表')
12
     ui.tabWidget.setTabText(0, '平面控制网稳定性计算成果表')
13
+    # 连接到数据库
14
+    db1 = sqlite3.connect(db_path)
15
+    db1.text_factory = lambda x: str(x, 'utf-8')
16
+    cursor1 = db1.cursor()
17
+

+ 74
- 267
Front/modules/ui_main.py Wyświetl plik

8
 ## WARNING! All changes made in this file will be lost when recompiling UI file!
8
 ## WARNING! All changes made in this file will be lost when recompiling UI file!
9
 ################################################################################
9
 ################################################################################
10
 
10
 
11
+import sqlite3
12
+import os
11
 from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
13
 from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
12
                             QMetaObject, QObject, QPoint, QRect,
14
                             QMetaObject, QObject, QPoint, QRect,
13
                             QSize, QTime, QUrl, Qt)
15
                             QSize, QTime, QUrl, Qt)
19
                                QFrame, QGridLayout, QHBoxLayout, QHeaderView,
21
                                QFrame, QGridLayout, QHBoxLayout, QHeaderView,
20
                                QLabel, QLineEdit, QListView, QMainWindow,
22
                                QLabel, QLineEdit, QListView, QMainWindow,
21
                                QPushButton, QSizePolicy, QStackedWidget, QTabWidget,
23
                                QPushButton, QSizePolicy, QStackedWidget, QTabWidget,
22
-                               QTableView, QTextEdit, QVBoxLayout, QWidget)
24
+                               QTableView, QTextEdit, QVBoxLayout, QWidget, QMessageBox)
25
+from Back.Program_Run.data_show import Arrange_Data, Arrange_Data1, Arrange_Data2, Data_in_Cell, Data_in_Cell1, Data_in_Cell2
26
+from Back.Program_Run.database_operations import create_database_and_tables
27
+from Back.Program_Run.file_system_watching import ComboBoxUpdater
28
+from watchdog.observers import Observer
29
+
23
 from .resources_rc import *
30
 from .resources_rc import *
24
 
31
 
25
 
32
 
33
+# class ComboBoxUpdater(FileSystemEventHandler):
34
+#     def __init__(self, comboBox, sql_folder):
35
+#         super().__init__()
36
+#         self.comboBox = comboBox
37
+#         self.sql_folder = sql_folder
38
+#
39
+#     def on_modified(self, event):
40
+#         if event.is_directory:
41
+#             return
42
+#         if event.src_path.endswith('.db'):
43
+#             self.update_combo_box()
44
+#
45
+#     def on_created(self, event):
46
+#         if event.is_directory:
47
+#             return
48
+#         if event.src_path.endswith('.db'):
49
+#             self.update_combo_box()
50
+#
51
+#     def on_deleted(self, event):
52
+#         if event.is_directory:
53
+#             return
54
+#         if event.src_path.endswith('.db'):
55
+#             self.update_combo_box()
56
+#
57
+#     def update_combo_box(self):
58
+#         # 清空现有的 comboBox 内容
59
+#         self.comboBox.clear()
60
+#
61
+#         # 列出 SQL 文件夹中的所有 .db 文件
62
+#         db_files = [f for f in os.listdir(self.sql_folder) if f.endswith('.db')]
63
+#
64
+#         # 将数据库文件名添加到 comboBox 中
65
+#         for db_file in db_files:
66
+#             self.comboBox.addItem(QCoreApplication.translate("MainWindow", db_file, None))
67
+#
68
+#         # 如果没有找到任何数据库文件,显示提示信息
69
+#         if not db_files:
70
+#             self.comboBox.addItem(QCoreApplication.translate("MainWindow", "未找到数据库文件", None))
71
+
26
 
72
 
27
 
73
 
28
 
74
 
29
 class Ui_MainWindow(object):
75
 class Ui_MainWindow(object):
30
     # UI界面
76
     # UI界面
31
     def setupUi(self, MainWindow):
77
     def setupUi(self, MainWindow):
78
+        self.main_window = MainWindow
32
         if not MainWindow.objectName():
79
         if not MainWindow.objectName():
33
             MainWindow.setObjectName(u"MainWindow")
80
             MainWindow.setObjectName(u"MainWindow")
34
         MainWindow.resize(940, 620)
81
         MainWindow.resize(940, 620)
1286
         self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
1333
         self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
1287
 
1334
 
1288
         self.comboBox = QComboBox(self.frame_content_wid_1)
1335
         self.comboBox = QComboBox(self.frame_content_wid_1)
1289
-        self.comboBox.addItem("")
1290
-        self.comboBox.addItem("")
1291
-        self.comboBox.addItem("")
1292
-        self.comboBox.addItem("")
1293
-        self.comboBox.addItem("")
1294
-        self.comboBox.addItem("")
1295
-        self.comboBox.addItem("")
1296
-        self.comboBox.addItem("")
1297
-        self.comboBox.addItem("")
1298
         self.comboBox.setObjectName(u"comboBox")
1336
         self.comboBox.setObjectName(u"comboBox")
1299
         self.comboBox.setMaximumSize(QSize(350, 16777215))
1337
         self.comboBox.setMaximumSize(QSize(350, 16777215))
1300
         self.comboBox.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
1338
         self.comboBox.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
1306
                                     "    min-width: 9em;   \n"
1344
                                     "    min-width: 9em;   \n"
1307
                                     "}\n"
1345
                                     "}\n"
1308
                                     "")
1346
                                     "")
1347
+        # 获取当前脚本所在的目录
1348
+        current_dir = os.path.dirname(os.path.abspath(__file__))
1349
+
1350
+        # 构建 SQL 文件夹的相对路径(上一级的上一级中的 SQL 文件夹)
1351
+        sql_folder = os.path.join(current_dir, '..', '..', 'SQL')
1352
+
1353
+        # 将相对路径转换为绝对路径
1354
+        sql_folder = os.path.abspath(sql_folder)
1355
+
1356
+        # 确保 SQL 文件夹存在
1357
+        if not os.path.exists(sql_folder):
1358
+            QMessageBox.critical(MainWindow, "错误", "SQL 文件夹不存在")
1359
+            return
1360
+        # 初始化 ComboBoxUpdater
1361
+        self.updater = ComboBoxUpdater(self.comboBox, sql_folder)
1362
+        self.observer = Observer()
1363
+        self.observer.schedule(self.updater, path=sql_folder, recursive=False)
1364
+        self.observer.start()
1365
+
1366
+        # 更新 comboBox 的初始内容
1367
+        self.updater.update_combo_box()
1309
 
1368
 
1310
         self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 1)
1369
         self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 1)
1311
 
1370
 
1324
         self.createFile.setFont(font)
1383
         self.createFile.setFont(font)
1325
         self.createFile.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
1384
         self.createFile.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
1326
         self.createFile.setStyleSheet(u"background-color: rgb(52, 59, 72);")
1385
         self.createFile.setStyleSheet(u"background-color: rgb(52, 59, 72);")
1386
+        # 将 createFile 按钮的点击事件与 自身的create_database_and_tables 函数关联,用于创建数据库
1387
+        self.createFile.clicked.connect(create_database_and_tables)
1327
         icon4 = QIcon()
1388
         icon4 = QIcon()
1328
         icon4.addFile(u":/icons/images/icons/cil-folder-open.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
1389
         icon4.addFile(u":/icons/images/icons/cil-folder-open.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
1329
         self.createFile.setIcon(icon4)
1390
         self.createFile.setIcon(icon4)
1844
         self.tabWidget.setCurrentIndex(0)
1905
         self.tabWidget.setCurrentIndex(0)
1845
     # setupUi
1906
     # setupUi
1846
 
1907
 
1908
+    # UI中的文字样式以及文字内容,Unicode编码的形式进行文字编辑的
1847
     def retranslateUi(self, MainWindow):
1909
     def retranslateUi(self, MainWindow):
1848
         MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None))
1910
         MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None))
1849
         self.titleLeftApp.setText(
1911
         self.titleLeftApp.setText(
1937
                                                                            u"<html><head/><body><p><span style=\" font-weight:700;\">\u5bfc\u5165Excel\u8868\u683c</span></p></body></html>",
1999
                                                                            u"<html><head/><body><p><span style=\" font-weight:700;\">\u5bfc\u5165Excel\u8868\u683c</span></p></body></html>",
1938
                                                                            None))
2000
                                                                            None))
1939
         self.label.setText(QCoreApplication.translate("MainWindow", u"\u9009\u62e9\u9879\u76ee\uff1a", None))
2001
         self.label.setText(QCoreApplication.translate("MainWindow", u"\u9009\u62e9\u9879\u76ee\uff1a", None))
1940
-        self.comboBox.setItemText(0, QCoreApplication.translate("MainWindow", u"\u65b0\u5efa\u9879\u76ee", None))
1941
-        self.comboBox.setItemText(1, QCoreApplication.translate("MainWindow", u"\u65b0\u5efa\u9879\u76ee", None))
1942
-        self.comboBox.setItemText(2, QCoreApplication.translate("MainWindow", u"\u65b0\u5efa\u9879\u76ee", None))
1943
-        self.comboBox.setItemText(3, QCoreApplication.translate("MainWindow", u"\u65b0\u5efa\u9879\u76ee", None))
1944
-        self.comboBox.setItemText(4, QCoreApplication.translate("MainWindow", u"\u65b0\u5efa\u9879\u76ee", None))
1945
-        self.comboBox.setItemText(5, QCoreApplication.translate("MainWindow", u"\u65b0\u5efa\u9879\u76ee", None))
1946
-        self.comboBox.setItemText(6, QCoreApplication.translate("MainWindow", u"\u65b0\u5efa\u9879\u76ee", None))
1947
-        self.comboBox.setItemText(7, QCoreApplication.translate("MainWindow", u"\u65b0\u5efa\u9879\u76ee", None))
1948
-        self.comboBox.setItemText(8, QCoreApplication.translate("MainWindow", u"\u65b0\u5efa\u9879\u76ee", None))
1949
 
2002
 
1950
         self.lineEdit.setText("")
2003
         self.lineEdit.setText("")
1951
         self.lineEdit.setPlaceholderText(QCoreApplication.translate("MainWindow",
2004
         self.lineEdit.setPlaceholderText(QCoreApplication.translate("MainWindow",
1954
         self.createFile.setText(QCoreApplication.translate("MainWindow", u"\u65b0\u5efa", None))
2007
         self.createFile.setText(QCoreApplication.translate("MainWindow", u"\u65b0\u5efa", None))
1955
         self.label_4.setText(
2008
         self.label_4.setText(
1956
             QCoreApplication.translate("MainWindow", u"\u9009\u62e9\u8ba1\u7b97\u65b9\u5f0f\uff1a", None))
2009
             QCoreApplication.translate("MainWindow", u"\u9009\u62e9\u8ba1\u7b97\u65b9\u5f0f\uff1a", None))
2010
+
1957
         self.comboBox_2.setItemText(0, QCoreApplication.translate("MainWindow",
2011
         self.comboBox_2.setItemText(0, QCoreApplication.translate("MainWindow",
1958
                                                                   u"\u63a7\u5236\u7f51\u590d\u6d4b\u5e73\u9762\u57fa\u51c6\u8ba1\u7b97",
2012
                                                                   u"\u63a7\u5236\u7f51\u590d\u6d4b\u5e73\u9762\u57fa\u51c6\u8ba1\u7b97",
1959
                                                                   None))
2013
                                                                   None))
1977
                                                         u"<html><head/><body><p><span style=\" font-size:11pt; font-weight:700;\">\u8868\u683c\u793a\u4f8b</span></p></body></html>",
2031
                                                         u"<html><head/><body><p><span style=\" font-size:11pt; font-weight:700;\">\u8868\u683c\u793a\u4f8b</span></p></body></html>",
1978
                                                         None))
2032
                                                         None))
1979
         self.label_5.setText(QCoreApplication.translate("MainWindow",
2033
         self.label_5.setText(QCoreApplication.translate("MainWindow",
1980
-                                                        u"<html><head/><body><p><span style=\" font-size:8pt;\">1.\u8bf7\u6309\u5982\u4e0b\u683c\u5f0f\u4fdd\u5b58\u6570\u636e\u8868\uff0c\u53ef\u8bc6\u522bxls\u3001xlsx\u6587\u4ef6\u3002</span></p><p><span style=\" font-size:8pt;\">2.\u7cfb\u7edf\u5c06\u8bc6\u522b\u7b2c\u4e00\u4e2asheet\u6587\u4ef6\uff0c\u6309\u5bf9\u5e94\u5355\u5143\u683c\u8bfb\u53d6\u6570\u636e\uff08\u5982\u5355\u5143\u683c\u9519\u4f4d\uff0c\u4f1a\u5bfc\u81f4\u7cfb\u7edf\u65e0\u6cd5\u8bc6\u522b\uff09</span></p><p><span style=\" font-size:8pt;\">3.\u6700\u5f31\u8fb9\u8fb9\u957f\u76f8\u5bf9\u4e2d\u8bef\u5dee\u53ef\u8bc6\u522b\u5206\u6570\u5f62\u5f0f\uff0c\u4ec5\u652f\u6301\u82f1\u6587\u72b6\u6001\u4e0b\u201c/\u201d\u4f5c\u4e3a\u5206\u9694\u7b26\u3002</span></p><p><span style=\" font-size:8pt;\">4.\u603b\u8fb9\u6570\u8ba1\u7b97\u65f6\uff0c\u5f80\u8fd4\u7b97\u4e24\u6761\u8fb9\u3002</span></p></body></html>",
2034
+                                                        u"<html><head/><body><p><span style=\" font-size:8pt;\">1.\u8bf7\u6309\u5982\u4e0b\u683c\u5f0f\u4fdd\u5b58\u6570\u636e\u8868\uff0c\u53ef\u8bc6\u522bxls\u3001xlsx\u6587\u4ef6\u3002(*\u6c34\u51c6\u6d4b\u6bb5\u9ad8\u5dee\u7a33\u5b9a\u6027\u8ba1\u7b97\u76ee\u524d\u4ec5\u652f\u6301.xlsx\u6587\u4ef6)</span></p><p><span style=\" font-size:8pt;\">2.\u7cfb\u7edf\u5c06\u8bc6\u522b\u7b2c\u4e00\u4e2asheet\u6587\u4ef6\uff0c\u6309\u5bf9\u5e94\u5355\u5143\u683c\u8bfb\u53d6\u6570\u636e\uff08\u5982\u5355\u5143\u683c\u9519\u4f4d\uff0c\u4f1a\u5bfc\u81f4\u7cfb\u7edf\u65e0\u6cd5\u8bc6\u522b\uff09</span></p><p><span style=\" font-size:8pt;\">3.\u6700\u5f31\u8fb9\u8fb9\u957f\u76f8\u5bf9\u4e2d\u8bef\u5dee\u53ef\u8bc6\u522b\u5206\u6570\u5f62\u5f0f\uff0c\u4ec5\u652f\u6301\u82f1\u6587\u72b6\u6001\u4e0b\u201c/\u201d\u4f5c\u4e3a\u5206\u9694\u7b26\u3002</span></p><p><span style=\" font-size:8pt;\">4.\u603b\u8fb9\u6570\u8ba1\u7b97\u65f6\uff0c\u5f80\u8fd4\u7b97\u4e24\u6761\u8fb9\u3002</span></p></body></html>",
1981
                                                         None))
2035
                                                         None))
1982
         self.download_1.setText(QCoreApplication.translate("MainWindow", u"\u793a\u4f8b\u4e0b\u8f7d1", None))
2036
         self.download_1.setText(QCoreApplication.translate("MainWindow", u"\u793a\u4f8b\u4e0b\u8f7d1", None))
1983
         self.download_2.setText(QCoreApplication.translate("MainWindow", u"\u793a\u4f8b\u4e0b\u8f7d2", None))
2037
         self.download_2.setText(QCoreApplication.translate("MainWindow", u"\u793a\u4f8b\u4e0b\u8f7d2", None))
2033
         self.btn_message.setText(QCoreApplication.translate("MainWindow", u"\u5207\u6362\u4e3b\u9898", None))
2087
         self.btn_message.setText(QCoreApplication.translate("MainWindow", u"\u5207\u6362\u4e3b\u9898", None))
2034
         self.creditsLabel.setText(QCoreApplication.translate("MainWindow", u"\u7248\u6743\u4fe1\u606f", None))
2088
         self.creditsLabel.setText(QCoreApplication.translate("MainWindow", u"\u7248\u6743\u4fe1\u606f", None))
2035
         self.version.setText(QCoreApplication.translate("MainWindow", u"v1.0.0", None))
2089
         self.version.setText(QCoreApplication.translate("MainWindow", u"v1.0.0", None))
2036
-    # retranslateUi
2037
-    # 默认第一个参数是self,所以使用时只有一个参数
2038
-    # 稳定性成果表
2039
-    def Arrange_Data(self, list1):
2040
-        # 最终return的
2041
-        list2 = []
2042
-        # 点号部分
2043
-        nlist = []
2044
-        for data1 in list1:
2045
-            # 点名
2046
-            # 存每一行的数据
2047
-            resultlist = []
2048
-            pn = data1[0].decode('utf-8')
2049
-            resultlist.append(pn)
2050
-            nlist.append(pn)
2051
-            resultlist.append(data1[1])
2052
-            resultlist.append(data1[2])
2053
-            resultlist.append(data1[3])
2054
-            resultlist.append(data1[4])
2055
-            resultlist.append(data1[5])
2056
-            resultlist.append(data1[6])
2057
-            resultlist.append(data1[7])
2058
-            resultlist.append(data1[8])
2059
-            resultlist.append(data1[9])
2060
-            resultlist.append(data1[10])
2061
-            resultlist.append(data1[11])
2062
-            # 判定1
2063
-            an1 = data1[12].decode('utf-8')
2064
-            resultlist.append(an1)
2065
-            resultlist.append(data1[13])
2066
-            resultlist.append(data1[14])
2067
-            resultlist.append(data1[15])
2068
-            # 判定2
2069
-            an2 = data1[16].decode('utf-8')
2070
-            resultlist.append(an2)
2071
-            list2.append(resultlist)
2072
-
2073
-        return nlist, list2
2074
-
2075
-    # GS复测成果表
2076
-    def Arrange_Data1(self, list1):
2077
-        # 最终return的
2078
-        list2 = []
2079
-        # 点号部分
2080
-        nlist = []
2081
-        for data1 in list1:
2082
-            # 点名
2083
-            # 存每一行的数据
2084
-            resultlist = []
2085
-            pn = data1[0].decode('utf-8')
2086
-            resultlist.append(pn)
2087
-            nlist.append(pn)
2088
-            resultlist.append(data1[1])
2089
-            resultlist.append(data1[2])
2090
-            resultlist.append(data1[3])
2091
-            resultlist.append(data1[4])
2092
-            resultlist.append(data1[5])
2093
-            resultlist.append(data1[6])
2094
-            resultlist.append(data1[7])
2095
-            # 判定
2096
-            an1 = data1[8].decode('utf-8')
2097
-            resultlist.append(an1)
2098
-            list2.append(resultlist)
2099
-
2100
-        return nlist, list2
2101
-
2102
-    # GS基准归算表
2103
-    def Arrange_Data2(self, list1):
2104
-        # 最终return的
2105
-        list2 = []
2106
-        # 点号部分
2107
-        nlist = []
2108
-        for data1 in list1:
2109
-            # 点名
2110
-            # 存每一行的数据
2111
-            resultlist = []
2112
-            pn = data1[0].decode('utf-8')
2113
-            resultlist.append(pn)
2114
-            nlist.append(pn)
2115
-            resultlist.append(data1[1])
2116
-            resultlist.append(data1[2])
2117
-            resultlist.append(data1[3])
2118
-            resultlist.append(data1[4])
2119
-            resultlist.append(data1[5])
2120
-            # 判定
2121
-            an1 = data1[6].decode('utf-8')
2122
-            resultlist.append(an1)
2123
-            list2.append(resultlist)
2124
-
2125
-        return nlist, list2
2126
-
2127
-    # GC水准测段高差计算成果表
2128
-
2129
-
2130
-
2131
-    def Data_in_Cell(self, list1):
2132
-        model = QStandardItemModel()
2133
-        xx = 0
2134
-        while xx < len(list1):
2135
-            data1 = list1[xx]
2136
-            # 点号
2137
-            cell1 = str(data1[0])
2138
-            item = QStandardItem(cell1)
2139
-            model.setItem(xx, 0, item)
2140
-            # 首期
2141
-            cell1 = str(round(data1[1], 4))
2142
-            item = QStandardItem(cell1)
2143
-            model.setItem(xx, 1, item)
2144
-            cell1 = str(round(data1[2], 4))
2145
-            item = QStandardItem(cell1)
2146
-            model.setItem(xx, 2, item)
2147
-            # 上期
2148
-            cell1 = str(round(data1[3], 4))
2149
-            item = QStandardItem(cell1)
2150
-            model.setItem(xx, 3, item)
2151
-            cell1 = str(round(data1[4], 4))
2152
-            item = QStandardItem(cell1)
2153
-            model.setItem(xx, 4, item)
2154
-            # 权
2155
-            cell1 = str(int(data1[5]))
2156
-            item = QStandardItem(cell1)
2157
-            model.setItem(xx, 5, item)
2158
-            # 本期
2159
-            cell1 = str(round(data1[6], 4))
2160
-            item = QStandardItem(cell1)
2161
-            model.setItem(xx, 6, item)
2162
-            cell1 = str(round(data1[7], 4))
2163
-            item = QStandardItem(cell1)
2164
-            model.setItem(xx, 7, item)
2165
-            # 权
2166
-            cell1 = str(int(data1[8]))
2167
-            item = QStandardItem(cell1)
2168
-            model.setItem(xx, 8, item)
2169
-            # 本-首
2170
-            cell1 = str(round(data1[9], 1))
2171
-            item = QStandardItem(cell1)
2172
-            model.setItem(xx, 9, item)
2173
-            cell1 = str(round(data1[10], 1))
2174
-            item = QStandardItem(cell1)
2175
-            model.setItem(xx, 10, item)
2176
-            cell1 = str(round(data1[11], 1))
2177
-            item = QStandardItem(cell1)
2178
-            model.setItem(xx, 11, item)
2179
-            # 判定(如果是稳定则不显示)
2180
-            cell1 = str(data1[12])
2181
-            if cell1 == '稳定':
2182
-                cell1 = ''
2183
-            item = QStandardItem(cell1)
2184
-            model.setItem(xx, 12, item)
2185
-            # 本-上
2186
-            cell1 = str(round(data1[13], 1))
2187
-            item = QStandardItem(cell1)
2188
-            model.setItem(xx, 13, item)
2189
-            cell1 = str(round(data1[14], 1))
2190
-            item = QStandardItem(cell1)
2191
-            model.setItem(xx, 14, item)
2192
-            cell1 = str(round(data1[15], 1))
2193
-            item = QStandardItem(cell1)
2194
-            model.setItem(xx, 15, item)
2195
-            # 判定
2196
-            cell1 = str(data1[16])
2197
-            if cell1 == '稳定':
2198
-                cell1 = ''
2199
-            item = QStandardItem(cell1)
2200
-            model.setItem(xx, 16, item)
2201
-            xx = xx + 1
2202
-        return model
2203
-
2204
-    # GS复测成果表
2205
-    def Data_in_Cell1(self, list1):
2206
-        model = QStandardItemModel()
2207
-        xx = 0
2208
-        while xx < len(list1):
2209
-            data1 = list1[xx]
2210
-            # 点号
2211
-            cell1 = str(data1[0])
2212
-            item = QStandardItem(cell1)
2213
-            model.setItem(xx, 0, item)
2214
-            # 上期
2215
-            cell1 = str(round(data1[1], 4))
2216
-            item = QStandardItem(cell1)
2217
-            model.setItem(xx, 1, item)
2218
-            cell1 = str(round(data1[2], 4))
2219
-            item = QStandardItem(cell1)
2220
-            model.setItem(xx, 2, item)
2221
-            # 本期
2222
-            cell1 = str(round(data1[3], 4))
2223
-            item = QStandardItem(cell1)
2224
-            model.setItem(xx, 3, item)
2225
-            cell1 = str(round(data1[4], 4))
2226
-            item = QStandardItem(cell1)
2227
-            model.setItem(xx, 4, item)
2228
-            # 上-本
2229
-            cell1 = str(round(data1[5], 1))
2230
-            item = QStandardItem(cell1)
2231
-            model.setItem(xx, 5, item)
2232
-            cell1 = str(round(data1[6], 1))
2233
-            item = QStandardItem(cell1)
2234
-            model.setItem(xx, 6, item)
2235
-            cell1 = str(round(data1[7], 1))
2236
-            item = QStandardItem(cell1)
2237
-            model.setItem(xx, 7, item)
2238
-            # 判定(如果是稳定则不显示)
2239
-            cell1 = str(data1[8])
2240
-            if cell1 == '稳定':
2241
-                cell1 = ''
2242
-            item = QStandardItem(cell1)
2243
-            model.setItem(xx, 8, item)
2244
-            xx = xx + 1
2245
-        return model
2246
-
2247
-    # GS基准归算表
2248
-    def Data_in_Cell2(self, list1):
2249
-        model = QStandardItemModel()
2250
-        xx = 0
2251
-        while xx < len(list1):
2252
-            data1 = list1[xx]
2253
-            # 点号
2254
-            cell1 = str(data1[0])
2255
-            item = QStandardItem(cell1)
2256
-            model.setItem(xx, 0, item)
2257
-            # 计算
2258
-            cell1 = str(round(data1[1], 4))
2259
-            item = QStandardItem(cell1)
2260
-            model.setItem(xx, 1, item)
2261
-            cell1 = str(round(data1[2], 4))
2262
-            item = QStandardItem(cell1)
2263
-            model.setItem(xx, 2, item)
2264
-            # 上-计
2265
-            cell1 = str(round(data1[3], 1))
2266
-            item = QStandardItem(cell1)
2267
-            model.setItem(xx, 3, item)
2268
-            cell1 = str(round(data1[4], 1))
2269
-            item = QStandardItem(cell1)
2270
-            model.setItem(xx, 4, item)
2271
-            cell1 = str(round(data1[5], 1))
2272
-            item = QStandardItem(cell1)
2273
-            model.setItem(xx, 5, item)
2274
-            # 判定(如果是稳定则不显示)
2275
-            cell1 = str(data1[6])
2276
-            if cell1 == '稳定':
2277
-                cell1 = ''
2278
-            item = QStandardItem(cell1)
2279
-            model.setItem(xx, 6, item)
2280
-            xx = xx + 1
2281
-        return model
2282
-
2283
 
2090
 

BIN
SQL/DataBase.db Wyświetl plik


Ładowanie…
Anuluj
Zapisz