Просмотр исходного кода

20241220

已全部转化到main.py上。
数据一览实现点击显示,上方留了一行可写排序筛选等功能按键。
(高差部分没改,ui_main在数据一览的tabwidget叫“View”)
rmy 4 месяцев назад
Родитель
Сommit
f342a7dafe
7 измененных файлов: 802 добавлений и 173 удалений
  1. 13
    10
      .idea/workspace.xml
  2. 103
    19
      Back/GS/GSshow.py
  3. 136
    2
      Back/Program_Run/data_show.py
  4. 96
    21
      Back/WD/WDshow.py
  5. 357
    1
      Front/main.py
  6. 11
    0
      Front/modules/ui_functions.py
  7. 86
    120
      Front/modules/ui_main.py

+ 13
- 10
.idea/workspace.xml Просмотреть файл

@@ -5,11 +5,14 @@
5 5
   </component>
6 6
   <component name="ChangeListManager">
7 7
     <list default="true" id="6d1a886d-ec9c-4f93-8633-d9bd0340f3de" name="Changes" comment="">
8
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
8 9
       <change beforePath="$PROJECT_DIR$/Back/GS/GSshow.py" beforeDir="false" afterPath="$PROJECT_DIR$/Back/GS/GSshow.py" afterDir="false" />
9 10
       <change beforePath="$PROJECT_DIR$/Back/Program_Run/data_show.py" beforeDir="false" afterPath="$PROJECT_DIR$/Back/Program_Run/data_show.py" afterDir="false" />
10 11
       <change beforePath="$PROJECT_DIR$/Back/WD/WDshow.py" beforeDir="false" afterPath="$PROJECT_DIR$/Back/WD/WDshow.py" afterDir="false" />
11
-      <change beforePath="$PROJECT_DIR$/Front/main_new.py" beforeDir="false" afterPath="$PROJECT_DIR$/Front/main_new.py" afterDir="false" />
12
+      <change beforePath="$PROJECT_DIR$/Front/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/Front/main.py" afterDir="false" />
13
+      <change beforePath="$PROJECT_DIR$/Front/modules/ui_functions.py" beforeDir="false" afterPath="$PROJECT_DIR$/Front/modules/ui_functions.py" afterDir="false" />
12 14
       <change beforePath="$PROJECT_DIR$/Front/modules/ui_main.py" beforeDir="false" afterPath="$PROJECT_DIR$/Front/modules/ui_main.py" afterDir="false" />
15
+      <change beforePath="$PROJECT_DIR$/SQL/1.db" beforeDir="false" afterPath="$PROJECT_DIR$/SQL/1.db" afterDir="false" />
13 16
     </list>
14 17
     <option name="SHOW_DIALOG" value="false" />
15 18
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -27,16 +30,16 @@
27 30
     <option name="hideEmptyMiddlePackages" value="true" />
28 31
     <option name="showLibraryContents" value="true" />
29 32
   </component>
30
-  <component name="PropertiesComponent"><![CDATA[{
31
-  "keyToString": {
32
-    "Python.main.executor": "Run",
33
-    "Python.main_new.executor": "Run",
34
-    "RunOnceActivity.ShowReadmeOnStart": "true",
35
-    "git-widget-placeholder": "master",
36
-    "last_opened_file_path": "D:/4work_now/20240819GS/pyside6_test/treewidget.py",
37
-    "settings.editor.selected.configurable": "preferences.language.and.region"
33
+  <component name="PropertiesComponent">{
34
+  &quot;keyToString&quot;: {
35
+    &quot;Python.main.executor&quot;: &quot;Run&quot;,
36
+    &quot;Python.main_new.executor&quot;: &quot;Run&quot;,
37
+    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
38
+    &quot;git-widget-placeholder&quot;: &quot;master&quot;,
39
+    &quot;last_opened_file_path&quot;: &quot;D:/4work_now/20240819GS/pyside6_test/treewidget.py&quot;,
40
+    &quot;settings.editor.selected.configurable&quot;: &quot;File.Encoding&quot;
38 41
   }
39
-}]]></component>
42
+}</component>
40 43
   <component name="RunManager" selected="Python.main">
41 44
     <configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
42 45
       <module name="20241211" />

+ 103
- 19
Back/GS/GSshow.py Просмотреть файл

@@ -9,29 +9,15 @@ def main_function(ui, db_path, utf_en):
9 9
     ui.tabWidget.setTabVisible(0, True)
10 10
     ui.tabWidget.setTabVisible(1, True)
11 11
     ui.tabWidget.setTabVisible(2, True)
12
-    ui.tabWidget.setTabVisible(3, True)
13 12
     # 重新设置文字名称
14
-    ui.tabWidget.setTabText(0, '输入数据')
15
-    ui.tabWidget.setTabText(1, '复测成果表')
16
-    ui.tabWidget.setTabText(2, '基准归算模型')
17
-    ui.tabWidget.setTabText(3, '复测基准归算表')
13
+    ui.tabWidget.setTabText(0, '复测成果表')
14
+    ui.tabWidget.setTabText(1, '基准归算模型')
15
+    ui.tabWidget.setTabText(2, '复测基准归算表')
18 16
 
19 17
     # 连接到数据库
20 18
     db1 = sqlite3.connect(db_path)
21 19
     db1.text_factory = lambda x: str(x, 'utf-8')
22 20
     cursor1 = db1.cursor()
23
-
24
-    #输入数据
25
-    sqlstr0 = 'select PointName,Last_X,Last_Y,New_X,New_Y,cgcs from GS_Input_Point WHERE TableName = ?'
26
-    cursor1.execute(sqlstr0, (utf_en,))
27
-    result0 = cursor1.fetchall()
28
-    model0,nlist0 = GS_In_Data(result0)
29
-    model0.setHorizontalHeaderLabels(
30
-        ['点名', '前期X', '前期Y', '本期X', '本期Y','成果次数'])
31
-    model0.setVerticalHeaderLabels(nlist0)
32
-    # 展示表格
33
-    ui.resultTableView.setModel(model0)
34
-    ui.resultTableView.show()
35 21
     # 隐藏 QLabel
36 22
     ui.default_remind.hide()
37 23
 
@@ -58,8 +44,8 @@ def main_function(ui, db_path, utf_en):
58 44
     model1.setVerticalHeaderLabels(nlist1)
59 45
 
60 46
     # 展示表格
61
-    ui.inputTableView.setModel(model1)
62
-    ui.inputTableView.show()
47
+    ui.resultTableView.setModel(model1)
48
+    ui.resultTableView.show()
63 49
     # 隐藏 QLabel
64 50
     ui.default_remind.hide()
65 51
 
@@ -98,3 +84,101 @@ li.checked::marker {{ content: "\\2612"; }}
98 84
 <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">          </span><span style=" font-size:14pt; font-weight:700;">X、Y</span><span style=" font-size:14pt;">为{str1}已知系统的{str2}归算坐标。</span></p></body></html>"""
99 85
 
100 86
     ui.printTableView.setHtml(str0)
87
+
88
+def main_function1(ui, db_path, utf_en):
89
+    # 就用已有的选项卡
90
+    ui.View.setTabVisible(0, True)
91
+    ui.View.setTabVisible(1, True)
92
+    ui.View.setTabVisible(2, True)
93
+    ui.View.setTabVisible(3, True)
94
+    # 重新设置文字名称
95
+    ui.View.setTabText(0, '输入数据')
96
+    ui.View.setTabText(1, '基准归算模型')
97
+    ui.View.setTabText(2, '复测基准归算表')
98
+    ui.View.setTabText(3, '复测成果表')
99
+
100
+    # 连接到数据库
101
+    db1 = sqlite3.connect(db_path)
102
+    db1.text_factory = lambda x: str(x, 'utf-8')
103
+    cursor1 = db1.cursor()
104
+
105
+    #输入数据
106
+    sqlstr00 = 'select PointName,Last_X,Last_Y,New_X,New_Y,cgcs from GS_Input_Point WHERE TableName = ?'
107
+    sqlstr10 = 'select Last_ResultName,New_ResultName,Avg_SL,Ms_Dir,Ms_WSL,SL_Count,Dir_Count,Scale_Value from GS_Input_Param WHERE TableName = ?'
108
+    cursor1.execute(sqlstr00, (utf_en,))
109
+    result00 = cursor1.fetchall()
110
+    cursor1.execute(sqlstr10, (utf_en,))
111
+    result10 = cursor1.fetchall()
112
+    model0,nlist0 = GS_In_Data(result00,result10[0])
113
+    model0.setHorizontalHeaderLabels(
114
+        ['点名', '前期X', '前期Y', '本期X', '本期Y','成果次数','上期成果名','本期成果名','平均边长','方向值中误差','最弱边边长相对中误差','总测边数','总方向观测数','缩放值'])
115
+    model0.setVerticalHeaderLabels(nlist0)
116
+    # 展示表格
117
+    ui.resultTableView1.setModel(model0)
118
+    ui.resultTableView1.show()
119
+    # 隐藏 QLabel
120
+    ui.default_remind1.hide()
121
+
122
+
123
+    # 查询表内符合的所有数据(分成两个结果分别显示)
124
+    # 注意查询中的tablename,数据库中如果没有相同的表名,会报错,所以需要先判断一下
125
+    # 复测成果表
126
+    sqlstr1 = 'select PointName,Last_X,Last_Y,Result_X,Result_Y,Last_ResultX,Last_ResultY,Last_ResultP,Dis_Ass from GS_Result_Point WHERE TableName = ?'
127
+    cursor1.execute(sqlstr1, (utf_en,))
128
+    result1 = cursor1.fetchall()
129
+
130
+    # 基准归算表
131
+    sqlstr11 = 'select PointName,Cal_X,Cal_Y,Last_CalX,Last_CalY,Last_CalP,Dis_Ass from GS_Result_Point WHERE TableName = ?'
132
+    cursor1.execute(sqlstr11, (utf_en,))
133
+    result2 = cursor1.fetchall()
134
+
135
+    # 对结果集进行处理,把汉字转换过来, 添加表头部分
136
+    nlist1, plist1 = Arrange_Data1(result1)
137
+    nlist2, plist2 = Arrange_Data2(result2)
138
+
139
+    model1 = Data_in_Cell1(plist1)
140
+    model1.setHorizontalHeaderLabels(
141
+        ['点名', '前期X', '前期Y', '本期X', '本期Y', '前期-本期X', '前期-本期Y', '前期-本期P', '位移判定'])
142
+    model1.setVerticalHeaderLabels(nlist1)
143
+
144
+    # 展示表格
145
+    ui.inputTableView1.setModel(model1)
146
+    ui.inputTableView1.show()
147
+    # 隐藏 QLabel
148
+    ui.default_remind1.hide()
149
+
150
+    model2 = Data_in_Cell2(plist2)
151
+    model2.setHorizontalHeaderLabels(
152
+        ['点名', '基准归算X', '基准归算Y', '前期-归算X', '前期-归算Y', '前期-归算P', '位移判定'])
153
+    model2.setVerticalHeaderLabels(nlist2)
154
+
155
+    # 展示表格
156
+    ui.reconTableView1.setModel(model2)
157
+    ui.reconTableView1.show()
158
+
159
+    # 富文本的html
160
+    sqlstr2 = 'select Last_ResultName, New_ResultName, Formula_X1, Formula_X2, Formula_X3, Formula_Y1, Formula_Y2, Formula_Y3 from GS_Trans_Param WHERE TableName = ?'
161
+    cursor1.execute(sqlstr2, (utf_en,))
162
+    result3 = cursor1.fetchone()
163
+    # 检查 result3 是否为 None
164
+    if result3 is None:
165
+        str0 = "<p>未找到相关数据。</p>"
166
+    else:
167
+        str1 = result3[0].decode('utf-8') if isinstance(result3[0], bytes) else result3[0]
168
+        str2 = result3[1].decode('utf-8') if isinstance(result3[1], bytes) else result3[1]
169
+        n1, n2, n3, n4, n5, n6 = result3[2], result3[3], result3[4], result3[5], result3[6], result3[7]
170
+
171
+        str0 = f"""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
172
+<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
173
+p, li {{ white-space: pre-wrap; }}
174
+hr {{ height: 1px; border-width: 0; }}
175
+li.unchecked::marker {{ content: "\\2610"; }}
176
+li.checked::marker {{ content: "\\2612"; }}
177
+</style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;">
178
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; color:#000000;">{str2}--{str1}</span><span style=" font-size:14pt;">已知系统转换公式:</span></p>
179
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:700;">X</span><span style=" font-size:14pt;">=({n1})</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+({n2})</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+({n3})</span></p>
180
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:700;">Y</span><span style=" font-size:14pt;">=({n4})</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+({n5})</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+({n6})</span></p>
181
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">式中:</span><span style=" font-size:14pt; font-weight:700; color:#000000;">x、y</span><span style=" font-size:14pt;">为{str2}坐标;</span></p>
182
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">          </span><span style=" font-size:14pt; font-weight:700;">X、Y</span><span style=" font-size:14pt;">为{str1}已知系统的{str2}归算坐标。</span></p></body></html>"""
183
+
184
+    ui.printTableView1.setHtml(str0)

+ 136
- 2
Back/Program_Run/data_show.py Просмотреть файл

@@ -1,4 +1,6 @@
1 1
 # 数据处理相关代码
2
+from time import process_time_ns
3
+
2 4
 from PySide6.QtGui import QStandardItemModel, QStandardItem
3 5
 # 稳定性成果表
4 6
 def Arrange_Data(list1):
@@ -243,11 +245,12 @@ def Data_in_Cell2(list1):
243 245
     return model
244 246
 
245 247
 #稳定性分析输入显示
246
-def WD_In_Data(list1):
248
+def WD_In_Data(list1,list0):
247 249
     # 最终return的
248 250
     list2 = []
249 251
     # 点号部分
250 252
     nlist = []
253
+    ii = 0
251 254
     for data1 in list1:
252 255
         # 点名
253 256
         # 存每一行的数据
@@ -262,6 +265,28 @@ def WD_In_Data(list1):
262 265
         resultlist.append(data1[5])
263 266
         resultlist.append(data1[6])
264 267
         resultlist.append(data1[7])
268
+        if ii == 0:
269
+            frn = list0[0].decode('utf-8')
270
+            resultlist.append(frn)
271
+            prn = list0[1].decode('utf-8')
272
+            resultlist.append(prn)
273
+            nrn = list0[2].decode('utf-8')
274
+            resultlist.append(nrn)
275
+            resultlist.append(list0[3])
276
+            resultlist.append(list0[4])
277
+            resultlist.append(list0[5])
278
+            resultlist.append(list0[6])
279
+            resultlist.append(list0[7])
280
+            ii = ii + 1
281
+        else:
282
+            resultlist.append('')
283
+            resultlist.append('')
284
+            resultlist.append('')
285
+            resultlist.append(0)
286
+            resultlist.append(0)
287
+            resultlist.append(0)
288
+            resultlist.append(0)
289
+            resultlist.append(0)
265 290
         list2.append(resultlist)
266 291
     model = QStandardItemModel()
267 292
     xx = 0
@@ -296,15 +321,58 @@ def WD_In_Data(list1):
296 321
         cell1 = str(round(data1[7], 4))
297 322
         item = QStandardItem(cell1)
298 323
         model.setItem(xx, 7, item)
324
+        # 几个参数
325
+        cell1 = str(data1[8])
326
+        item = QStandardItem(cell1)
327
+        model.setItem(xx, 8, item)
328
+        cell1 = str(data1[9])
329
+        item = QStandardItem(cell1)
330
+        model.setItem(xx, 9, item)
331
+        cell1 = str(data1[10])
332
+        item = QStandardItem(cell1)
333
+        model.setItem(xx, 10, item)
334
+        if data1[11] == 0 and data1[12] == 0:
335
+            cell1 = str('')
336
+            item = QStandardItem(cell1)
337
+            model.setItem(xx, 11, item)
338
+            cell1 = str('')
339
+            item = QStandardItem(cell1)
340
+            model.setItem(xx, 12, item)
341
+            cell1 = str('')
342
+            item = QStandardItem(cell1)
343
+            model.setItem(xx, 13, item)
344
+            cell1 = str('')
345
+            item = QStandardItem(cell1)
346
+            model.setItem(xx, 14, item)
347
+            cell1 = str('')
348
+            item = QStandardItem(cell1)
349
+            model.setItem(xx, 15, item)
350
+        else:
351
+            cell1 = str(round(data1[11], 2))
352
+            item = QStandardItem(cell1)
353
+            model.setItem(xx, 11, item)
354
+            cell1 = str(round(data1[12], 2))
355
+            item = QStandardItem(cell1)
356
+            model.setItem(xx, 12, item)
357
+            cell1 = str(round(data1[13], 2))
358
+            item = QStandardItem(cell1)
359
+            model.setItem(xx, 13, item)
360
+            cell1 = str(round(data1[14], 2))
361
+            item = QStandardItem(cell1)
362
+            model.setItem(xx, 14, item)
363
+            cell1 = str(round(data1[15], 2))
364
+            item = QStandardItem(cell1)
365
+            model.setItem(xx, 15, item)
299 366
         xx = xx + 1
300 367
     return model,nlist
301 368
 
302 369
 #改算计算输入显示
303
-def GS_In_Data(list1):
370
+def GS_In_Data(list1,list0):
304 371
     # 最终return的
305 372
     list2 = []
306 373
     # 点号部分
307 374
     nlist = []
375
+    ii = 0
308 376
     for data1 in list1:
309 377
         # 点名
310 378
         # 存每一行的数据
@@ -317,6 +385,27 @@ def GS_In_Data(list1):
317 385
         resultlist.append(data1[3])
318 386
         resultlist.append(data1[4])
319 387
         resultlist.append(data1[5])
388
+        if ii == 0:
389
+            prn = list0[0].decode('utf-8')
390
+            resultlist.append(prn)
391
+            nrn = list0[1].decode('utf-8')
392
+            resultlist.append(nrn)
393
+            resultlist.append(list0[2])
394
+            resultlist.append(list0[3])
395
+            resultlist.append(list0[4])
396
+            resultlist.append(list0[5])
397
+            resultlist.append(list0[6])
398
+            resultlist.append(list0[7])
399
+            ii = ii + 1
400
+        else:
401
+            resultlist.append('')
402
+            resultlist.append('')
403
+            resultlist.append(0)
404
+            resultlist.append(0)
405
+            resultlist.append(0)
406
+            resultlist.append(0)
407
+            resultlist.append(0)
408
+            resultlist.append(0)
320 409
         list2.append(resultlist)
321 410
     model = QStandardItemModel()
322 411
     xx = 0
@@ -344,5 +433,50 @@ def GS_In_Data(list1):
344 433
         cell1 = str(int(data1[5]))
345 434
         item = QStandardItem(cell1)
346 435
         model.setItem(xx, 5, item)
436
+        #几个参数
437
+        cell1 = str(data1[6])
438
+        item = QStandardItem(cell1)
439
+        model.setItem(xx, 6, item)
440
+        cell1 = str(data1[7])
441
+        item = QStandardItem(cell1)
442
+        model.setItem(xx, 7, item)
443
+        if data1[8] == 0 and data1[9] == 0:
444
+            cell1 = str('')
445
+            item = QStandardItem(cell1)
446
+            model.setItem(xx, 8, item)
447
+            cell1 = str('')
448
+            item = QStandardItem(cell1)
449
+            model.setItem(xx, 9, item)
450
+            cell1 = str('')
451
+            item = QStandardItem(cell1)
452
+            model.setItem(xx, 10, item)
453
+            cell1 = str('')
454
+            item = QStandardItem(cell1)
455
+            model.setItem(xx, 11, item)
456
+            cell1 = str('')
457
+            item = QStandardItem(cell1)
458
+            model.setItem(xx, 12, item)
459
+            cell1 = str('')
460
+            item = QStandardItem(cell1)
461
+            model.setItem(xx, 13, item)
462
+        else:
463
+            cell1 = str(round(data1[8], 2))
464
+            item = QStandardItem(cell1)
465
+            model.setItem(xx, 8, item)
466
+            cell1 = str(round(data1[9], 2))
467
+            item = QStandardItem(cell1)
468
+            model.setItem(xx, 9, item)
469
+            cell1 = str(format(data1[10], '.3e') )
470
+            item = QStandardItem(cell1)
471
+            model.setItem(xx, 10, item)
472
+            cell1 = str(round(data1[11], 2))
473
+            item = QStandardItem(cell1)
474
+            model.setItem(xx, 11, item)
475
+            cell1 = str(round(data1[12], 2))
476
+            item = QStandardItem(cell1)
477
+            model.setItem(xx, 12, item)
478
+            cell1 = str(round(data1[13], 2))
479
+            item = QStandardItem(cell1)
480
+            model.setItem(xx, 13, item)
347 481
         xx = xx + 1
348 482
     return model,nlist

+ 96
- 21
Back/WD/WDshow.py Просмотреть файл

@@ -3,36 +3,21 @@ import sqlite3
3 3
 
4 4
 from PySide6.QtGui import QStandardItemModel
5 5
 
6
-
6
+#计算结束后的显示
7 7
 def main_function(ui, db_path, utf_en):
8 8
     # 只显示头两个tab
9 9
     ui.tabWidget.setTabVisible(0, True)
10 10
     ui.tabWidget.setTabVisible(1, True)
11
-    ui.tabWidget.setTabVisible(2, True)
11
+    ui.tabWidget.setTabVisible(2, False)
12 12
     # 重新设置文字名称
13
-    ui.tabWidget.setTabText(1, '稳定性分析成果表')
14
-    ui.tabWidget.setTabText(2, '自由网成果归算模型')
15
-    ui.tabWidget.setTabText(0, '输入数据')
13
+    ui.tabWidget.setTabText(0, '稳定性分析成果表')
14
+    ui.tabWidget.setTabText(1, '自由网成果归算模型')
16 15
     # 链接数据库并显示
17 16
     # 连接到数据库
18 17
     # 将结果输出到数据库
19 18
     db1 = sqlite3.connect(db_path)
20 19
     # 获取游标
21 20
     cursor1 = db1.cursor()
22
-    # 查询表内符合的所有输入数据
23
-    sqlstr0 = 'select PointName,First_X,First_Y,Last_X,Last_Y,Wight,New_X,New_Y from WD_Input_Point WHERE TableName = ?'
24
-    cursor1.execute(sqlstr0, (utf_en,))
25
-    # 获取结果集
26
-    result0 = cursor1.fetchall()
27
-    # 把结果集放进去,把汉字转换过来,添加表头部分
28
-    model0,nlist0 = WD_In_Data(result0)
29
-    # 设置表头(先用统称吧,后期修改)
30
-    model0.setHorizontalHeaderLabels(
31
-        ['点名', '首期X', '首期Y', '上期X', '上期Y', '权', '本期X', '本期Y'])
32
-    model0.setVerticalHeaderLabels(nlist0)
33
-    # QTableView并将数据模型与之关联
34
-    ui.resultTableView.setModel(model0)
35
-    ui.resultTableView.show()
36 21
 
37 22
     # 查询表内符合的所有数据
38 23
     sqlstr1 = 'select PointName,First_X,First_Y,Last_X,Last_Y,Last_Wight,Result_X,Result_Y,New_Wight,New_FirstX,New_FirstY,New_FirstP,NFDis_Ass,New_LastX,New_LastY,New_LastP,NLDis_Ass from WD_Result_Point WHERE TableName = ?'
@@ -50,8 +35,8 @@ def main_function(ui, db_path, utf_en):
50 35
     model1.setVerticalHeaderLabels(nlist)
51 36
 
52 37
     # QTableView并将数据模型与之关联
53
-    ui.reconTableView.setModel(model1)
54
-    ui.reconTableView.show()
38
+    ui.resultTableView.setModel(model1)
39
+    ui.resultTableView.show()
55 40
 
56 41
     # 隐藏 QLabel(默认提示语言)
57 42
     ui.default_remind.hide()
@@ -87,3 +72,93 @@ li.checked::marker { content: "\2612"; }
87 72
 <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">式中:</span><span style=" font-size:14pt; font-weight:700; color:#000000;">x、y</span><span style=" font-size:14pt;">为</span><span style=" font-size:14pt; color:#000000;">""" + str2 + """</span><span style=" font-size:14pt;">坐标;</span></p>
88 73
 <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">          </span><span style=" font-size:14pt; font-weight:700;">X、Y</span><span style=" font-size:14pt;">为""" + str1 + """已知系统的""" + str2 + """归算坐标。</span></p></body></html>"""
89 74
     ui.printTableView.setHtml(str0)
75
+
76
+def main_function1(ui, db_path, utf_en):
77
+    # 只显示头两个tab
78
+    ui.View.setTabVisible(0, True)
79
+    ui.View.setTabVisible(1, True)
80
+    ui.View.setTabVisible(2, True)
81
+    ui.View.setTabVisible(3, False)
82
+    # 重新设置文字名称
83
+    ui.View.setTabText(1, '自由网成果归算模型')
84
+    ui.View.setTabText(2, '稳定性分析成果表')
85
+    ui.View.setTabText(0, '输入数据')
86
+    # 链接数据库并显示
87
+    # 连接到数据库
88
+    # 将结果输出到数据库
89
+    db1 = sqlite3.connect(db_path)
90
+    # 获取游标
91
+    cursor1 = db1.cursor()
92
+    # 查询表内符合的所有输入数据
93
+    sqlstr00 = 'select PointName,First_X,First_Y,Last_X,Last_Y,Wight,New_X,New_Y from WD_Input_Point WHERE TableName = ?'
94
+    cursor1.execute(sqlstr00, (utf_en,))
95
+    # 获取结果集
96
+    result0 = cursor1.fetchall()
97
+    #参数部分
98
+    sqlstr10 = 'select First_ResultName,Last_ResultName,New_ResultName,Avg_SL,Ms_Dir,SL_Count,Dir_Count,Scale_Value from WD_Input_Param WHERE TableName = ?'
99
+    cursor1.execute(sqlstr10, (utf_en,))
100
+    # 获取结果集
101
+    result1 = cursor1.fetchall()
102
+    # 把结果集放进去,把汉字转换过来,添加表头部分
103
+    model0,nlist0 = WD_In_Data(result0,result1[0])
104
+    # 设置表头(先用统称吧,后期修改)
105
+    model0.setHorizontalHeaderLabels(
106
+        ['点名', '首期X', '首期Y', '上期X', '上期Y', '权', '本期X', '本期Y','首期成果名','上期成果名','本期成果名','平均边长','方向值中误差','总边数','总方向数','缩放值'])
107
+    model0.setVerticalHeaderLabels(nlist0)
108
+    # QTableView并将数据模型与之关联
109
+    ui.resultTableView1.setModel(model0)
110
+    ui.resultTableView1.show()
111
+
112
+    # 查询表内符合的所有数据
113
+    sqlstr1 = 'select PointName,First_X,First_Y,Last_X,Last_Y,Last_Wight,Result_X,Result_Y,New_Wight,New_FirstX,New_FirstY,New_FirstP,NFDis_Ass,New_LastX,New_LastY,New_LastP,NLDis_Ass from WD_Result_Point WHERE TableName = ?'
114
+    cursor1.execute(sqlstr1, (utf_en,))
115
+    # 获取结果集
116
+    result = cursor1.fetchall()
117
+    # 对结果集进行处理,把汉字转换过来,添加表头部分
118
+    nlist, plist = Arrange_Data(result)
119
+    # 把数据放进去
120
+    model1 = Data_in_Cell(plist)
121
+    # 设置表头
122
+    model1.setHorizontalHeaderLabels(
123
+        ['点名', '首期X', '首期Y', '上期X', '上期Y', '权', '本期X', '本期Y', '权', '本期-首期X', '本期-首期Y',
124
+         '本期-首期P', '位移判定', '本期-上期X', '本期-上期Y', '本期-上期P', '位移判定'])
125
+    model1.setVerticalHeaderLabels(nlist)
126
+
127
+    # QTableView并将数据模型与之关联
128
+    ui.reconTableView1.setModel(model1)
129
+    ui.reconTableView1.show()
130
+
131
+    # 隐藏 QLabel(默认提示语言)
132
+    ui.default_remind1.hide()
133
+    # 富文本的html
134
+    sqlstr2 = 'select Last_ResultName,New_ResultName,Formula_X1,Formula_X2,Formula_X3,Formula_Y1,Formula_Y2,Formula_Y3 from WD_Result_Param WHERE TableName = ?'
135
+    cursor1.execute(sqlstr2, (utf_en,))
136
+    # 获取结果集
137
+    result2 = cursor1.fetchall()
138
+    str1 = result2[0][0].decode('utf-8')
139
+    str2 = result2[0][1].decode('utf-8')
140
+    n1 = result2[0][2]
141
+    n2 = result2[0][3]
142
+    n3 = result2[0][4]
143
+    n4 = result2[0][5]
144
+    n5 = result2[0][6]
145
+    n6 = result2[0][7]
146
+    str0 = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
147
+<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
148
+p, li { white-space: pre-wrap; }
149
+hr { height: 1px; border-width: 0; }
150
+li.unchecked::marker { content: "\2610"; }
151
+li.checked::marker { content: "\2612"; }
152
+</style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;">
153
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; color:#000000;">""" + str2 + """--""" + str1 + """</span><span style=" font-size:14pt;">已知系统转换公式:</span></p>
154
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:700;">X</span><span style=" font-size:14pt;">=(</span><span style=" font-size:14pt; color:#aa0000;">""" + str(
155
+        n1) + """</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00aa00;">""" + str(
156
+        n2) + """</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00007f;">""" + str(
157
+        n3) + """</span><span style=" font-size:14pt;">)</span></p>
158
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:700;">Y</span><span style=" font-size:14pt;">=(</span><span style=" font-size:14pt; color:#aa0000;">""" + str(
159
+        n4) + """</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00aa00;">""" + str(
160
+        n5) + """</span><span style=" font-size:14pt;">)</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+(</span><span style=" font-size:14pt; color:#00007f;">""" + str(
161
+        n6) + """</span><span style=" font-size:14pt;">)</span></p>
162
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">式中:</span><span style=" font-size:14pt; font-weight:700; color:#000000;">x、y</span><span style=" font-size:14pt;">为</span><span style=" font-size:14pt; color:#000000;">""" + str2 + """</span><span style=" font-size:14pt;">坐标;</span></p>
163
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">          </span><span style=" font-size:14pt; font-weight:700;">X、Y</span><span style=" font-size:14pt;">为""" + str1 + """已知系统的""" + str2 + """归算坐标。</span></p></body></html>"""
164
+    ui.printTableView1.setHtml(str0)

+ 357
- 1
Front/main.py Просмотреть файл

@@ -15,7 +15,11 @@
15 15
 # ///////////////////////////////////////////////////////////////
16 16
 import time
17 17
 
18
-from PySide6.QtWidgets import QFileDialog
18
+from PySide6.QtWidgets import QFileDialog,QWidget, QVBoxLayout, QTreeWidget, QApplication, QTreeWidgetItem
19
+from PySide6.QtCore import Signal,  Qt, Slot, QObject
20
+from PySide6.QtSql import QSqlTableModel,QSqlDatabase
21
+import sqlite3
22
+from PySide6.QtGui import QIcon
19 23
 
20 24
 import sys
21 25
 import os
@@ -32,7 +36,12 @@ os.environ["QT_FONT_DPI"] = "96"  # FIX Problem for High DPI and Scale above 100
32 36
 # SET AS GLOBAL WIDGETS
33 37
 # ///////////////////////////////////////////////////////////////
34 38
 widgets = None
39
+excelname = ''
35 40
 
41
+# 获取项目根目录
42
+project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
43
+# 将项目根目录添加到 sys.path
44
+sys.path.append(project_root)
36 45
 
37 46
 # 表格的模型
38 47
 class MyTableModel(QAbstractTableModel):
@@ -56,6 +65,146 @@ class MyTableModel(QAbstractTableModel):
56 65
             return self._data[index.row()][index.column()]
57 66
         return None
58 67
 
68
+#数据一览树状
69
+class TreeWidgetItem:
70
+    def __init__(self, id: any, parent_id: any, name: str, icon: QIcon = None, extend: object = None):
71
+        """
72
+        菜单数据接口
73
+        :param id: ID
74
+        :param parent_id: 父ID
75
+        :param name: 菜单名称
76
+        :param icon: 图标
77
+        :param extend: 扩展数据
78
+        """
79
+        self.id: any = id
80
+        self.parent_id: any = parent_id
81
+        self.name: str = name
82
+        self.extend: object = extend
83
+        # 实例化
84
+        self.treeWidgetItem = QTreeWidgetItem([self.name])
85
+        # 存储相关数据
86
+        self.treeWidgetItem.setData(0, Qt.UserRole + 1, extend)
87
+        self.treeWidgetItem.setIcon(0, QIcon(':/icons/default.png'))
88
+        if icon is not None:
89
+            self.treeWidgetItem.setIcon(0, icon)
90
+
91
+
92
+class ElTreeData(QObject):
93
+    """
94
+    Data Model
95
+    """
96
+    items_changed: Signal = Signal(str)
97
+    styleSheet_changed: Signal = Signal(str)
98
+
99
+    def __init__(self, items: list[TreeWidgetItem] = None, styleSheet: str = None):
100
+        super(ElTreeData, self).__init__()
101
+        # 定义数据
102
+        self._items: list[TreeWidgetItem]
103
+        self._styleSheet: str
104
+        # 初始化数据
105
+        self.items = items
106
+        self.styleSheet = styleSheet
107
+
108
+    @property
109
+    def items(self):
110
+        return self._items
111
+
112
+    @items.setter
113
+    def items(self, value):
114
+        self._items = value
115
+        # 数据改变时发出信号
116
+        self.items_changed.emit(self.items)
117
+
118
+    @property
119
+    def styleSheet(self):
120
+        return self._styleSheet
121
+
122
+    @styleSheet.setter
123
+    def styleSheet(self, value):
124
+        self._styleSheet = value
125
+        # 数据改变时发出信号
126
+        self.styleSheet_changed.emit(self.styleSheet)
127
+
128
+# 全数据库
129
+class ElTree(QWidget):
130
+    """
131
+    Control
132
+    """
133
+    itemClicked: Signal = Signal(object)
134
+    itemDoubleClicked: Signal = Signal(object)
135
+
136
+    def __init__(self, treeData: ElTreeData, parent=None):
137
+        super(ElTree, self).__init__(parent=parent)
138
+
139
+        self.data = treeData
140
+        # 将按钮的点击信号绑定到当前类的点击信号
141
+        widgets.allTreeWidget.itemClicked.connect(lambda item: self.itemClicked.emit(item.data(0, Qt.UserRole + 1)))
142
+        widgets.allTreeWidget.itemDoubleClicked.connect(
143
+            lambda item: self.itemDoubleClicked.emit(item.data(0, Qt.UserRole + 1)))
144
+        self.__render_items(True)
145
+
146
+    def __render_items(self, is_clear: bool):
147
+        if is_clear:
148
+            widgets.allTreeWidget.clear()
149
+            widgets.qureyTreeWidget.clear()
150
+        widgets.allTreeWidget.setColumnCount(1)
151
+        widgets.allTreeWidget.setHeaderHidden(True)
152
+        widgets.qureyTreeWidget.setColumnCount(1)
153
+        widgets.qureyTreeWidget.setHeaderHidden(True)
154
+        if self.data.items is not None:
155
+            # 转为字典
156
+            mapping: dict[any, TreeWidgetItem] = dict(zip([i.id for i in self.data.items], self.data.items))
157
+            # 树容器
158
+            treeWidgetItems: list[QTreeWidgetItem] = []
159
+            for d in self.data.items:
160
+                # 如果找不到父级项,则是根节点
161
+                parent: TreeWidgetItem = mapping.get(d.parent_id)
162
+                if parent is None:
163
+                    treeWidgetItems.append(d.treeWidgetItem)
164
+                else:
165
+                    parent.treeWidgetItem.addChild(d.treeWidgetItem)
166
+
167
+            # 挂载到树上
168
+            widgets.allTreeWidget.insertTopLevelItems(0, treeWidgetItems)
169
+
170
+# 查询
171
+class ElTree1(QWidget):
172
+    """
173
+    Control
174
+    """
175
+    itemClicked: Signal = Signal(object)
176
+    itemDoubleClicked: Signal = Signal(object)
177
+
178
+    def __init__(self, treeData: ElTreeData, parent=None):
179
+        super(ElTree1, self).__init__(parent=parent)
180
+        self.data = treeData
181
+        # 将按钮的点击信号绑定到当前类的点击信号
182
+        widgets.qureyTreeWidget.itemClicked.connect(lambda item: self.itemClicked.emit(item.data(0, Qt.UserRole + 1)))
183
+        widgets.qureyTreeWidget.itemDoubleClicked.connect(
184
+            lambda item: self.itemDoubleClicked.emit(item.data(0, Qt.UserRole + 1)))
185
+        self.__render_items(True)
186
+
187
+    def __render_items(self, is_clear: bool):
188
+        if is_clear:
189
+            widgets.qureyTreeWidget.clear()
190
+        widgets.qureyTreeWidget.setColumnCount(1)
191
+        widgets.qureyTreeWidget.setHeaderHidden(True)
192
+        if self.data.items is not None:
193
+            # 转为字典
194
+            mapping: dict[any, TreeWidgetItem] = dict(zip([i.id for i in self.data.items], self.data.items))
195
+            # 树容器
196
+            treeWidgetItems: list[QTreeWidgetItem] = []
197
+            for d in self.data.items:
198
+                # 如果找不到父级项,则是根节点
199
+                parent: TreeWidgetItem = mapping.get(d.parent_id)
200
+                if parent is None:
201
+                    treeWidgetItems.append(d.treeWidgetItem)
202
+                else:
203
+                    parent.treeWidgetItem.addChild(d.treeWidgetItem)
204
+
205
+            # 挂载到树上
206
+            widgets.qureyTreeWidget.insertTopLevelItems(0, treeWidgetItems)
207
+
59 208
 
60 209
 class MainWindow(QMainWindow):
61 210
 
@@ -117,6 +266,8 @@ class MainWindow(QMainWindow):
117 266
         widgets.upload.clicked.connect(self.buttonClick)
118 267
         # 文件计算
119 268
         widgets.compute.clicked.connect(self.buttonClick)
269
+        #数据一览的搜索键
270
+        widgets.search.clicked.connect(self.buttonClick)
120 271
 
121 272
         # 拓展左侧栏
122 273
         # def openCloseLeftBox():
@@ -159,6 +310,11 @@ class MainWindow(QMainWindow):
159 310
         widgets.btn_home.setStyleSheet(UIFunctions.selectMenu(widgets.btn_home.styleSheet()))
160 311
         # self.bind()
161 312
 
313
+        # 初始化树状数据库
314
+        tree_button = self.sql_init()
315
+        tree_button.itemClicked.connect(self.itembuttonClick)
316
+        tree_button.itemDoubleClicked.connect(self.itembuttonClick)
317
+
162 318
     # 绑定组件
163 319
     def bind(self):
164 320
         # 计算
@@ -238,6 +394,10 @@ class MainWindow(QMainWindow):
238 394
             else:
239 395
                 QMessageBox.warning(self, '警告', '请先选择项目并上传文件')
240 396
 
397
+        #树状查询
398
+        if btnName == "search":
399
+            self.searchClick()
400
+
241 401
         # 输出点击回馈
242 402
         print(f'Button "{btnName}" pressed!')
243 403
 
@@ -279,6 +439,202 @@ class MainWindow(QMainWindow):
279 439
         if event.buttons() == Qt.RightButton:
280 440
             print('Mouse click: RIGHT CLICK')
281 441
 
442
+    # 设一个全局变量,存数据库中所有的包含内容(数据库-三种方法-表)
443
+    dblist = []
444
+
445
+    # 初始化数据一览(数据库全展示)
446
+    def sql_init(self):
447
+        # 初始化全部数据库
448
+        # inpath = r'D:\4work_now\20240819GS\20241211\SQL'
449
+        inpath = os.path.abspath('../SQL')
450
+        # 读取所有的数据库名
451
+        sqlitem = []
452
+        id = 1
453
+        for filename in os.listdir(inpath):
454
+            # 数据库
455
+            dbname = filename.split('.', -1)[0]
456
+            dbpath = os.path.join(inpath, filename)
457
+            sqlitem.append(TreeWidgetItem(id, 0, dbname, icon=QIcon(
458
+                os.path.abspath(os.path.join(self.absPath, "images/icons/cil-clone.png")))))
459
+            pid = id
460
+            id = id + 1
461
+            # 三种方法
462
+            sqlitem.append(TreeWidgetItem(id, pid, '水准测段高差稳定计算', icon=QIcon(
463
+                os.path.join(self.absPath, "images/icons/cil-description.png"))))
464
+            gcid = id
465
+            id = id + 1
466
+            sqlitem.append(TreeWidgetItem(id, pid, '控制网复测平面基准计算', icon=QIcon(
467
+                os.path.join(self.absPath, "images/icons/cil-description.png"))))
468
+            gsid = id
469
+            id = id + 1
470
+            sqlitem.append(TreeWidgetItem(id, pid, '平面控制网稳定性计算', icon=QIcon(
471
+                os.path.join(self.absPath, "images/icons/cil-description.png"))))
472
+            wdid = id
473
+            id = id + 1
474
+            # 读取所有的表名(三种方式往下)
475
+            db1 = sqlite3.connect(dbpath)
476
+            # 获取游标
477
+            cursor1 = db1.cursor()
478
+            sqlstr1 = 'SELECT TableName FROM GC_Input_Param;'
479
+            cursor1.execute(sqlstr1)
480
+            result1 = cursor1.fetchall()
481
+            for re1 in result1:
482
+                str1 = re1[0].decode('utf-8')
483
+                list1 = []
484
+                list1.append(dbname)
485
+                list1.append('水准测段高差稳定计算')
486
+                list1.append(str1)
487
+                self.dblist.append(list1)
488
+                sqlitem.append(TreeWidgetItem(id, gcid, str1, icon=QIcon(
489
+                    os.path.join(self.absPath, "images/icons/cil-file.png")), extend={'listData': list1}))
490
+                id = id + 1
491
+            sqlstr2 = 'SELECT TableName FROM GS_Input_Param;'
492
+            cursor1.execute(sqlstr2)
493
+            result2 = cursor1.fetchall()
494
+            for re2 in result2:
495
+                str2 = re2[0].decode('utf-8')
496
+                list2 = []
497
+                list2.append(dbname)
498
+                list2.append('控制网复测平面基准计算')
499
+                list2.append(str2)
500
+                self.dblist.append(list2)
501
+                sqlitem.append(TreeWidgetItem(id, gsid, str2,
502
+                                              icon=QIcon(os.path.join(self.absPath, "images/icons/cil-file.png")),
503
+                                              extend={'listData': list2}))
504
+                id = id + 1
505
+            sqlstr3 = 'SELECT TableName FROM WD_Input_Param;'
506
+            cursor1.execute(sqlstr3)
507
+            result3 = cursor1.fetchall()
508
+            for re3 in result3:
509
+                str3 = re3[0].decode('utf-8')
510
+                list3 = []
511
+                list3.append(dbname)
512
+                list3.append('平面控制网稳定性计算')
513
+                list3.append(str3)
514
+                self.dblist.append(list3)
515
+                sqlitem.append(TreeWidgetItem(id, wdid, str3,
516
+                                              icon=QIcon(os.path.join(self.absPath, "images/icons/cil-file.png")),
517
+                                              extend={'listData': list3}))
518
+                id = id + 1
519
+        button = ElTree(ElTreeData(sqlitem))
520
+        return button
521
+
522
+    # 关键词查询
523
+    def searchClick(self):
524
+        # GET BUTTON CLICKED
525
+        btn = self.sender()
526
+        btnName = btn.objectName()
527
+        # 获取文本
528
+        text1 = self.ui.lineEdit_2.text()
529
+        # 符合的list
530
+        fhlist = []
531
+        # 查询(待优化)
532
+        for list1 in self.dblist:
533
+            for li in list1:
534
+                if text1 in li:
535
+                    fhlist.append(list1)
536
+                    break
537
+        # 更新item值
538
+        sqlitem = []
539
+        # 前两层是否一致
540
+        str1 = ''
541
+        str2 = ''
542
+        id = 1
543
+        pid = 0
544
+        fid = 0
545
+        zdy = []
546
+        for list2 in fhlist:
547
+            dbname = list2[0]
548
+            if dbname != str1:
549
+                str1 = dbname
550
+                pid = id
551
+                str2 = ''
552
+                sqlitem.append(TreeWidgetItem(id, 0, dbname, icon=QIcon(
553
+                    os.path.join(self.absPath, "images/icons/cil-clone.png"))))
554
+            zdy1 = []
555
+            zdy1.append(id)
556
+            zdy1.append(0)
557
+            zdy1.append(dbname)
558
+            zdy.append(zdy1)
559
+            id = id + 1
560
+            mename = list2[1]
561
+            if mename != str2:
562
+                str2 = mename
563
+                fid = id
564
+                sqlitem.append(TreeWidgetItem(id, pid, mename, icon=QIcon(
565
+                    os.path.join(self.absPath, "images/icons/cil-description.png"))))
566
+            zdy1 = []
567
+            zdy1.append(id)
568
+            zdy1.append(pid)
569
+            zdy1.append(mename)
570
+            zdy.append(zdy1)
571
+            id = id + 1
572
+            sqlitem.append(TreeWidgetItem(id, fid, list2[2], icon=QIcon(
573
+                os.path.join(self.absPath, "images/icons/cil-file.png")), extend={'listData': list2}))
574
+            zdy1 = []
575
+            zdy1.append(id)
576
+            zdy1.append(fid)
577
+            zdy1.append(list2[2])
578
+            zdy.append(zdy1)
579
+            id = id + 1
580
+        search_button = ElTree1(ElTreeData(sqlitem))
581
+        search_button.itemClicked.connect(self.itembuttonClick1)
582
+        search_button.itemDoubleClicked.connect(self.itembuttonClick1)
583
+
584
+    # 全树的item展示
585
+    def itembuttonClick(self):
586
+        # 判定是否获取的是根节点
587
+        pd = 1
588
+        select_item = self.ui.allTreeWidget.currentItem()
589
+        # 获取点击的item的text和它对应的上两个节点
590
+        str1 = select_item.text(0)
591
+        try:
592
+            pa_item = select_item.parent()
593
+            current_text = pa_item.text(0)
594
+            z_item = pa_item.parent()
595
+            str3 = z_item.text(0)
596
+        except:
597
+            pd = -1
598
+        if current_text == '':
599
+            pd = -1
600
+        if str3 == '':
601
+            pd = -1
602
+        if pd == -1:
603
+            pass
604
+        else:
605
+            # 数据库目录
606
+            inpath = os.path.abspath('../SQL')
607
+            file_path = inpath + '/' + str3 + '.db'
608
+            # 数据库路径,哪种方法,表名
609
+            UIFunctions.search_data_to_show(self, file_path, current_text, str1)
610
+
611
+    #搜索的item展示
612
+    def itembuttonClick1(self):
613
+        # 判定是否获取的是根节点
614
+        pd = 1
615
+        select_item = self.ui.qureyTreeWidget.currentItem()
616
+        # 获取点击的item的text和它对应的上两个节点
617
+        str1 = select_item.text(0)
618
+        try:
619
+            pa_item = select_item.parent()
620
+            current_text = pa_item.text(0)
621
+            z_item = pa_item.parent()
622
+            str3 = z_item.text(0)
623
+        except:
624
+            pd = -1
625
+        if current_text == '':
626
+            pd = -1
627
+        if str3 == '':
628
+            pd = -1
629
+        if pd == -1:
630
+            pass
631
+        else:
632
+            # 数据库目录
633
+            inpath = os.path.abspath('../SQL')
634
+            file_path = inpath + '/' + str3 + '.db'
635
+            #数据库路径,哪种方法,表名
636
+            UIFunctions.search_data_to_show(self, file_path,current_text,str1)
637
+
282 638
 
283 639
 if __name__ == "__main__":
284 640
     app = QApplication(sys.argv)

+ 11
- 0
Front/modules/ui_functions.py Просмотреть файл

@@ -362,4 +362,15 @@ class UIFunctions(MainWindow):
362 362
             pass
363 363
         else:
364 364
             QMessageBox.warning(self, '警告', '请选择有效的计算类型')
365
+
366
+    #数据一览,点击查询
367
+    def search_data_to_show(self,file_path,current_text,tablename):
368
+        utf_en = tablename.encode('utf-8')  # 转换文件名为utf-8编码形式
369
+        #高差部分我没改
370
+        if current_text == "水准测段高差稳定计算":
371
+            GCshow.main_function(self.ui, file_path, utf_en)
372
+        elif current_text == "控制网复测平面基准计算":
373
+            GSshow.main_function1(self.ui, file_path, utf_en)
374
+        elif current_text == "平面控制网稳定性计算":
375
+            WDshow.main_function1(self.ui, file_path, utf_en)
365 376
     # END - GUI DEFINITIONS

+ 86
- 120
Front/modules/ui_main.py Просмотреть файл

@@ -1558,20 +1558,6 @@ class Ui_MainWindow(object):
1558 1558
         icon7.addFile(u":/icons/images/icons/3.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
1559 1559
         self.tabWidget.addTab(self.reconTable, icon7, "")
1560 1560
 
1561
-        self.inputTable = QWidget()
1562
-        self.inputTable.setObjectName(u"inputTable")
1563
-        # self.inputTable.setCursor(QCursor(Qt.CursorShape.UpArrowCursor))
1564
-        self.inputTable.setMouseTracking(False)
1565
-        self.inputTable.setTabletTracking(False)
1566
-        self.verticalLayout_32 = QVBoxLayout(self.inputTable)
1567
-        self.verticalLayout_32.setObjectName(u"verticalLayout_32")
1568
-        self.inputTableView = QTableView(self.inputTable)
1569
-        self.inputTableView.setObjectName(u"inputTableView")
1570
-        self.verticalLayout_32.addWidget(self.inputTableView)
1571
-        icon8 = QIcon()
1572
-        icon8.addFile(u":/icons/images/icons/4.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
1573
-        self.tabWidget.addTab(self.inputTable, icon8, "")
1574
-
1575 1561
         self.verticalLayout_20.addWidget(self.tabWidget)
1576 1562
 
1577 1563
         self.verticalLayout_25.addLayout(self.verticalLayout_20)
@@ -1602,7 +1588,7 @@ class Ui_MainWindow(object):
1602 1588
         # 设置到处结果显示页面(tabWidget)的默认隐藏2.3页
1603 1589
         self.tabWidget.setTabVisible(1, False)
1604 1590
         self.tabWidget.setTabVisible(2, False)
1605
-        self.tabWidget.setTabVisible(3, False)
1591
+
1606 1592
 
1607 1593
         self.search = QPushButton(self.datainfo)
1608 1594
         self.search.setObjectName(u"search")
@@ -1662,107 +1648,108 @@ class Ui_MainWindow(object):
1662 1648
         self.verticalLayout_30.setObjectName(u"verticalLayout_30")
1663 1649
         self.horizontalLayout_11 = QHBoxLayout()
1664 1650
         self.horizontalLayout_11.setObjectName(u"horizontalLayout_11")
1665
-        self.label_11 = QLabel(self.datainfo)
1666
-        self.label_11.setObjectName(u"label_11")
1667
-        self.label_11.setStyleSheet(u"border: 2px solid #7284b9;\n"
1668
-                                    "border-radius: 5px;\n"
1669
-                                    "background-color: #6272a4;\n"
1670
-                                    "color:#FFFFFF")
1671
-
1672
-        self.horizontalLayout_11.addWidget(self.label_11)
1673
-
1674
-        self.checkBox_2 = QCheckBox(self.datainfo)
1675
-        self.checkBox_2.setObjectName(u"checkBox_2")
1676
-
1677
-        self.horizontalLayout_11.addWidget(self.checkBox_2)
1678
-
1679
-        self.checkBox = QCheckBox(self.datainfo)
1680
-        self.checkBox.setObjectName(u"checkBox")
1681
-
1682
-        self.horizontalLayout_11.addWidget(self.checkBox)
1683
-
1684
-        self.checkBox_3 = QCheckBox(self.datainfo)
1685
-        self.checkBox_3.setObjectName(u"checkBox_3")
1686
-
1687
-        self.horizontalLayout_11.addWidget(self.checkBox_3)
1688
-
1689
-        self.checkBox_4 = QCheckBox(self.datainfo)
1690
-        self.checkBox_4.setObjectName(u"checkBox_4")
1691
-
1692
-        self.horizontalLayout_11.addWidget(self.checkBox_4)
1651
+        #留个空,什么编辑排序筛选可以放在这儿
1652
+        self.edit_button = QPushButton(self.datainfo)
1653
+        self.edit_button.setObjectName(u"edit_button")
1654
+        sizePolicy4 = QSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed)
1655
+        sizePolicy4.setHorizontalStretch(0)
1656
+        sizePolicy4.setVerticalStretch(0)
1657
+        sizePolicy4.setHeightForWidth(self.edit_button.sizePolicy().hasHeightForWidth())
1658
+        self.edit_button.setSizePolicy(sizePolicy4)
1659
+        self.edit_button.setMinimumSize(QSize(10, 10))
1660
+        self.edit_button.setMaximumSize(QSize(30, 24))
1661
+        self.edit_button.setStyleSheet(u"")
1693 1662
 
1663
+        self.horizontalLayout_11.addWidget(self.edit_button)
1694 1664
         self.verticalLayout_30.addLayout(self.horizontalLayout_11)
1695 1665
 
1696 1666
         self.horizontalLayout_14 = QHBoxLayout()
1697 1667
         self.horizontalLayout_14.setObjectName(u"horizontalLayout_14")
1698
-        self.label_12 = QLabel(self.datainfo)
1699
-        self.label_12.setObjectName(u"label_12")
1700
-        self.label_12.setStyleSheet(u"border: 2px solid #7284b9;\n"
1701
-                                    "border-radius: 5px;\n"
1702
-                                    "background-color: #6272a4;\n"
1703
-                                    "color:#FFFFFF")
1704
-
1705
-        self.horizontalLayout_14.addWidget(self.label_12)
1706
-
1707
-        self.checkBox_5 = QCheckBox(self.datainfo)
1708
-        self.checkBox_5.setObjectName(u"checkBox_5")
1709
-
1710
-        self.horizontalLayout_14.addWidget(self.checkBox_5)
1711
-
1712
-        self.checkBox_6 = QCheckBox(self.datainfo)
1713
-        self.checkBox_6.setObjectName(u"checkBox_6")
1714
-
1715
-        self.horizontalLayout_14.addWidget(self.checkBox_6)
1716
-
1717
-        self.checkBox_7 = QCheckBox(self.datainfo)
1718
-        self.checkBox_7.setObjectName(u"checkBox_7")
1719
-
1720
-        self.horizontalLayout_14.addWidget(self.checkBox_7)
1721
-
1722
-        self.checkBox_8 = QCheckBox(self.datainfo)
1723
-        self.checkBox_8.setObjectName(u"checkBox_8")
1724
-
1725
-        self.horizontalLayout_14.addWidget(self.checkBox_8)
1726
-
1727 1668
         self.verticalLayout_30.addLayout(self.horizontalLayout_14)
1728 1669
 
1729 1670
         self.horizontalLayout_15 = QHBoxLayout()
1730 1671
         self.horizontalLayout_15.setObjectName(u"horizontalLayout_15")
1731
-        self.label_13 = QLabel(self.datainfo)
1732
-        self.label_13.setObjectName(u"label_13")
1733
-        self.label_13.setStyleSheet(u"border: 2px solid #7284b9;\n"
1734
-                                    "border-radius: 5px;\n"
1735
-                                    "background-color: #6272a4;\n"
1736
-                                    "color:#FFFFFF")
1737
-
1738
-        self.horizontalLayout_15.addWidget(self.label_13)
1739
-
1740
-        self.checkBox_9 = QCheckBox(self.datainfo)
1741
-        self.checkBox_9.setObjectName(u"checkBox_9")
1742
-
1743
-        self.horizontalLayout_15.addWidget(self.checkBox_9)
1744
-
1745
-        self.checkBox_10 = QCheckBox(self.datainfo)
1746
-        self.checkBox_10.setObjectName(u"checkBox_10")
1672
+        self.verticalLayout_30.addLayout(self.horizontalLayout_15)
1747 1673
 
1748
-        self.horizontalLayout_15.addWidget(self.checkBox_10)
1674
+        self.View = QTabWidget(self.datainfo)
1675
+        self.View.setObjectName(u"View")
1676
+        self.View.setCursor(QCursor(Qt.CursorShape.ArrowCursor))
1677
+        self.View.setTabPosition(QTabWidget.TabPosition.North)
1678
+        self.View.setTabShape(QTabWidget.TabShape.Rounded)
1679
+        self.View.setElideMode(Qt.TextElideMode.ElideRight)
1680
+        self.View.setTabsClosable(False)
1681
+        self.View.setTabBarAutoHide(False)
1749 1682
 
1750
-        self.checkBox_11 = QCheckBox(self.datainfo)
1751
-        self.checkBox_11.setObjectName(u"checkBox_11")
1683
+        self.verticalLayout_30.addWidget(self.View)
1752 1684
 
1753
-        self.horizontalLayout_15.addWidget(self.checkBox_11)
1685
+        self.resultTable1 = QWidget()
1686
+        self.resultTable1.setObjectName(u"resultTable1")
1687
+        self.verticalLayout_34 = QVBoxLayout(self.resultTable1)
1688
+        self.verticalLayout_34.setObjectName(u"verticalLayout_34")
1689
+        self.resultTableView1 = QTableView(self.resultTable1)
1690
+        self.resultTableView1.setObjectName(u"resultTableView1")
1754 1691
 
1755
-        self.checkBox_12 = QCheckBox(self.datainfo)
1756
-        self.checkBox_12.setObjectName(u"checkBox_12")
1692
+        # 隐藏 resultTableView
1693
+        self.resultTableView1.hide()
1757 1694
 
1758
-        self.horizontalLayout_15.addWidget(self.checkBox_12)
1695
+        # 创建一个 QLabel 并设置文本(第三页文本中心默认提醒)
1696
+        self.default_remind1 = QLabel("左侧点击具体表即可显示", self.resultTable1)
1697
+        self.default_remind1.setAlignment(Qt.AlignCenter)  # 设置文本居中对齐
1698
+        # 将 QLabel 添加到布局中
1699
+        self.verticalLayout_34.addWidget(self.default_remind1)
1700
+        # 表格显示
1701
+        self.verticalLayout_34.addWidget(self.resultTableView1)
1702
+
1703
+        icon51 = QIcon()
1704
+        icon51.addFile(u":/icons/images/icons/1.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
1705
+        self.View.addTab(self.resultTable1, icon51, "")
1706
+
1707
+        self.printTable1 = QWidget()
1708
+        self.printTable1.setObjectName(u"printTable1")
1709
+        self.printTable1.setMouseTracking(False)
1710
+        self.printTable1.setTabletTracking(False)
1711
+        self.verticalLayout_35 = QVBoxLayout(self.printTable1)
1712
+        self.verticalLayout_35.setObjectName(u"verticalLayout_35")
1713
+        self.printTableView1 = QTextEdit(self.printTable1)
1714
+        self.printTableView1.setObjectName(u"printTableView1")
1715
+        self.printTableView1.setReadOnly(True)
1716
+        self.verticalLayout_35.addWidget(self.printTableView1)
1717
+        icon6 = QIcon()
1718
+        icon6.addFile(u":/icons/images/icons/2.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
1719
+        self.View.addTab(self.printTable1, icon6, "")
1759 1720
 
1760
-        self.verticalLayout_30.addLayout(self.horizontalLayout_15)
1721
+        self.reconTable1 = QWidget()
1722
+        self.reconTable1.setObjectName(u"reconTable1")
1723
+        # self.reconTable.setCursor(QCursor(Qt.CursorShape.UpArrowCursor))
1724
+        self.reconTable1.setMouseTracking(False)
1725
+        self.reconTable1.setTabletTracking(False)
1726
+        self.verticalLayout_36 = QVBoxLayout(self.reconTable1)
1727
+        self.verticalLayout_36.setObjectName(u"verticalLayout_36")
1728
+        self.reconTableView1 = QTableView(self.reconTable1)
1729
+        self.reconTableView1.setObjectName(u"modelTableView1")
1730
+        self.verticalLayout_36.addWidget(self.reconTableView1)
1731
+        icon7 = QIcon()
1732
+        icon7.addFile(u":/icons/images/icons/3.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
1733
+        self.View.addTab(self.reconTable1, icon7, "")
1761 1734
 
1762
-        self.View = QTableView(self.datainfo)
1763
-        self.View.setObjectName(u"View")
1735
+        self.inputTable1 = QWidget()
1736
+        self.inputTable1.setObjectName(u"inputTable1")
1737
+        # self.inputTable.setCursor(QCursor(Qt.CursorShape.UpArrowCursor))
1738
+        self.inputTable1.setMouseTracking(False)
1739
+        self.inputTable1.setTabletTracking(False)
1740
+        self.verticalLayout_37 = QVBoxLayout(self.inputTable1)
1741
+        self.verticalLayout_37.setObjectName(u"verticalLayout_37")
1742
+        self.inputTableView1 = QTableView(self.inputTable1)
1743
+        self.inputTableView1.setObjectName(u"inputTableView1")
1744
+        self.verticalLayout_37.addWidget(self.inputTableView1)
1745
+        icon8 = QIcon()
1746
+        icon8.addFile(u":/icons/images/icons/4.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
1747
+        self.View.addTab(self.inputTable1, icon8, "")
1764 1748
 
1765
-        self.verticalLayout_30.addWidget(self.View)
1749
+        # 设置到处结果显示页面(View)的默认隐藏2.3页
1750
+        self.View.setTabVisible(1, False)
1751
+        self.View.setTabVisible(2, False)
1752
+        self.View.setTabVisible(3, False)
1766 1753
 
1767 1754
         self.formLayout_3.setLayout(0, QFormLayout.FieldRole, self.verticalLayout_30)
1768 1755
 
@@ -2039,27 +2026,6 @@ class Ui_MainWindow(object):
2039 2026
         self.comboBox_3.setPlaceholderText(
2040 2027
             QCoreApplication.translate("MainWindow", u"\u7b26\u5408\u67e5\u8be2\u8981\u6c42\u7684\u8868", None))
2041 2028
         self.comboBox_4.setPlaceholderText(QCoreApplication.translate("MainWindow", u"\u6240\u6709\u8868", None))
2042
-        self.label_11.setText(QCoreApplication.translate("MainWindow",
2043
-                                                         u"<html><head/><body><p><img src=\":/icons/images/icons/cil-chart-line.png\"/>\u8868\u9009\u62e9</p></body></html>",
2044
-                                                         None))
2045
-        self.checkBox_2.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2046
-        self.checkBox.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2047
-        self.checkBox_3.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2048
-        self.checkBox_4.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2049
-        self.label_12.setText(QCoreApplication.translate("MainWindow",
2050
-                                                         u"<html><head/><body><p><img src=\":/icons/images/icons/cil-justify-left.png\"/>\u6392\u5e8f</p></body></html>",
2051
-                                                         None))
2052
-        self.checkBox_5.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2053
-        self.checkBox_6.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2054
-        self.checkBox_7.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2055
-        self.checkBox_8.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2056
-        self.label_13.setText(QCoreApplication.translate("MainWindow",
2057
-                                                         u"<html><head/><body><p><img src=\":/icons/images/icons/cil-task.png\"/>\u7b5b\u9009</p></body></html>",
2058
-                                                         None))
2059
-        self.checkBox_9.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2060
-        self.checkBox_10.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2061
-        self.checkBox_11.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2062
-        self.checkBox_12.setText(QCoreApplication.translate("MainWindow", u"CheckBox", None))
2063 2029
         self.btn_message.setText(QCoreApplication.translate("MainWindow", u"\u5207\u6362\u4e3b\u9898", None))
2064 2030
         self.creditsLabel.setText(QCoreApplication.translate("MainWindow", u"\u7248\u6743\u4fe1\u606f", None))
2065 2031
         self.version.setText(QCoreApplication.translate("MainWindow", u"v1.0.0", None))

Загрузка…
Отмена
Сохранить