瀏覽代碼

修改为相对路径

rmy 5 月之前
父節點
當前提交
5e6b96716a
共有 2 個檔案被更改,包括 16 行新增13 行删除
  1. 13
    12
      Front/main_new.py
  2. 3
    1
      Front/modules/ui_functions.py

+ 13
- 12
Front/main_new.py 查看文件

287
         self.useCustomTheme = useCustomTheme
287
         self.useCustomTheme = useCustomTheme
288
         self.absPath = absPath
288
         self.absPath = absPath
289
         # themeFile = r"Front\themes\py_dracula_light.qss"
289
         # themeFile = r"Front\themes\py_dracula_light.qss"
290
-        themeFile = r"D:\4work_now\20240819GS\20241211\Front\themes\py_dracula_light.qss"
290
+        themeFile = os.path.abspath(os.path.join(self.absPath, "themes/py_dracula_light.qss"))
291
 
291
 
292
         # 设置主题和HACKS
292
         # 设置主题和HACKS
293
         if useCustomTheme:
293
         if useCustomTheme:
568
     #初始化数据一览(数据库全展示)
568
     #初始化数据一览(数据库全展示)
569
     def sql_init(self):
569
     def sql_init(self):
570
         #初始化全部数据库
570
         #初始化全部数据库
571
-        inpath = r'D:\4work_now\20240819GS\20241211\SQL'
571
+        # inpath = r'D:\4work_now\20240819GS\20241211\SQL'
572
+        inpath = os.path.abspath('../SQL')
572
         #读取所有的数据库名
573
         #读取所有的数据库名
573
         sqlitem = []
574
         sqlitem = []
574
         id = 1
575
         id = 1
576
             #数据库
577
             #数据库
577
             dbname = filename.split('.',-1)[0]
578
             dbname = filename.split('.',-1)[0]
578
             dbpath = os.path.join(inpath,filename)
579
             dbpath = os.path.join(inpath,filename)
579
-            sqlitem.append(TreeWidgetItem(id,0,dbname,icon=QIcon("D:/4work_now/20240819GS/20241211/Front/images/icons/cil-clone.png")))
580
+            sqlitem.append(TreeWidgetItem(id,0,dbname,icon=QIcon(os.path.abspath(os.path.join(self.absPath, "images/icons/cil-clone.png")))))
580
             pid = id
581
             pid = id
581
             id = id + 1
582
             id = id + 1
582
             #三种方法
583
             #三种方法
583
-            sqlitem.append(TreeWidgetItem(id, pid, '水准测段高差稳定计算', icon=QIcon("D:/4work_now/20240819GS/20241211/Front/images/icons/cil-description.png")))
584
+            sqlitem.append(TreeWidgetItem(id, pid, '水准测段高差稳定计算', icon=QIcon(os.path.join(self.absPath, "images/icons/cil-description.png"))))
584
             gcid = id
585
             gcid = id
585
             id = id + 1
586
             id = id + 1
586
-            sqlitem.append(TreeWidgetItem(id, pid, '控制网复测平面基准计算', icon=QIcon("D:/4work_now/20240819GS/20241211/Front/images/icons/cil-description.png")))
587
+            sqlitem.append(TreeWidgetItem(id, pid, '控制网复测平面基准计算', icon=QIcon(os.path.join(self.absPath, "images/icons/cil-description.png"))))
587
             gsid = id
588
             gsid = id
588
             id = id + 1
589
             id = id + 1
589
-            sqlitem.append(TreeWidgetItem(id, pid, '平面控制网稳定性计算', icon=QIcon("D:/4work_now/20240819GS/20241211/Front/images/icons/cil-description.png")))
590
+            sqlitem.append(TreeWidgetItem(id, pid, '平面控制网稳定性计算', icon=QIcon(os.path.join(self.absPath, "images/icons/cil-description.png"))))
590
             wdid = id
591
             wdid = id
591
             id = id + 1
592
             id = id + 1
592
             #读取所有的表名(三种方式往下)
593
             #读取所有的表名(三种方式往下)
604
                 list1.append(str1)
605
                 list1.append(str1)
605
                 self.dblist.append(list1)
606
                 self.dblist.append(list1)
606
                 sqlitem.append(TreeWidgetItem(id, gcid, str1, icon=QIcon(
607
                 sqlitem.append(TreeWidgetItem(id, gcid, str1, icon=QIcon(
607
-                    "D:/4work_now/20240819GS/20241211/Front/images/icons/cil-file.png"),extend={'listData': list1}))
608
+                    os.path.join(self.absPath, "images/icons/cil-file.png")),extend={'listData': list1}))
608
                 id = id + 1
609
                 id = id + 1
609
             sqlstr2 = 'SELECT TableName FROM GS_Input_Param;'
610
             sqlstr2 = 'SELECT TableName FROM GS_Input_Param;'
610
             cursor1.execute(sqlstr2)
611
             cursor1.execute(sqlstr2)
616
                 list2.append('控制网复测平面基准计算')
617
                 list2.append('控制网复测平面基准计算')
617
                 list2.append(str2)
618
                 list2.append(str2)
618
                 self.dblist.append(list2)
619
                 self.dblist.append(list2)
619
-                sqlitem.append(TreeWidgetItem(id, gsid, str2, icon=QIcon("D:/4work_now/20240819GS/20241211/Front/images/icons/cil-file.png"),extend={'listData': list2}))
620
+                sqlitem.append(TreeWidgetItem(id, gsid, str2, icon=QIcon(os.path.join(self.absPath, "images/icons/cil-file.png")),extend={'listData': list2}))
620
                 id = id + 1
621
                 id = id + 1
621
             sqlstr3 = 'SELECT TableName FROM WD_Input_Param;'
622
             sqlstr3 = 'SELECT TableName FROM WD_Input_Param;'
622
             cursor1.execute(sqlstr3)
623
             cursor1.execute(sqlstr3)
628
                 list3.append('平面控制网稳定性计算')
629
                 list3.append('平面控制网稳定性计算')
629
                 list3.append(str3)
630
                 list3.append(str3)
630
                 self.dblist.append(list3)
631
                 self.dblist.append(list3)
631
-                sqlitem.append(TreeWidgetItem(id, wdid, str3, icon=QIcon("D:/4work_now/20240819GS/20241211/Front/images/icons/cil-file.png"),extend={'listData': list3}))
632
+                sqlitem.append(TreeWidgetItem(id, wdid, str3, icon=QIcon(os.path.join(self.absPath, "images/icons/cil-file.png")),extend={'listData': list3}))
632
                 id = id + 1
633
                 id = id + 1
633
         button = ElTree(ElTreeData(sqlitem))
634
         button = ElTree(ElTreeData(sqlitem))
634
         return button
635
         return button
664
                 pid = id
665
                 pid = id
665
                 str2 = ''
666
                 str2 = ''
666
                 sqlitem.append(TreeWidgetItem(id, 0, dbname, icon=QIcon(
667
                 sqlitem.append(TreeWidgetItem(id, 0, dbname, icon=QIcon(
667
-                    "D:/4work_now/20240819GS/20241211/Front/images/icons/cil-clone.png")))
668
+                    os.path.join(self.absPath, "images/icons/cil-clone.png"))))
668
             zdy1 = []
669
             zdy1 = []
669
             zdy1.append(id)
670
             zdy1.append(id)
670
             zdy1.append(0)
671
             zdy1.append(0)
676
                 str2 = mename
677
                 str2 = mename
677
                 fid = id
678
                 fid = id
678
                 sqlitem.append(TreeWidgetItem(id, pid, mename, icon=QIcon(
679
                 sqlitem.append(TreeWidgetItem(id, pid, mename, icon=QIcon(
679
-                    "D:/4work_now/20240819GS/20241211/Front/images/icons/cil-description.png")))
680
+                    os.path.join(self.absPath, "images/icons/cil-description.png"))))
680
             zdy1 = []
681
             zdy1 = []
681
             zdy1.append(id)
682
             zdy1.append(id)
682
             zdy1.append(pid)
683
             zdy1.append(pid)
684
             zdy.append(zdy1)
685
             zdy.append(zdy1)
685
             id = id + 1
686
             id = id + 1
686
             sqlitem.append(TreeWidgetItem(id, fid, list2[2], icon=QIcon(
687
             sqlitem.append(TreeWidgetItem(id, fid, list2[2], icon=QIcon(
687
-                "D:/4work_now/20240819GS/20241211/Front/images/icons/cil-file.png"), extend={'listData': list2}))
688
+                os.path.join(self.absPath, "images/icons/cil-file.png")), extend={'listData': list2}))
688
             zdy1 = []
689
             zdy1 = []
689
             zdy1.append(id)
690
             zdy1.append(id)
690
             zdy1.append(fid)
691
             zdy1.append(fid)

+ 3
- 1
Front/modules/ui_functions.py 查看文件

16
 
16
 
17
 # MAIN FILE
17
 # MAIN FILE
18
 # ///////////////////////////////////////////////////////////////
18
 # ///////////////////////////////////////////////////////////////
19
+
20
+
19
 from main import *
21
 from main import *
20
 import importlib
22
 import importlib
21
 from Back.GC import GC
23
 from Back.GC import GC
333
             GCcompute.main_function(file_path, db_path)
335
             GCcompute.main_function(file_path, db_path)
334
             GCshow.main_function(self.ui, db_path, utf_en)
336
             GCshow.main_function(self.ui, db_path, utf_en)
335
         elif current_text == "控制网复测平面基准计算":
337
         elif current_text == "控制网复测平面基准计算":
336
-            GScompute.main_function(file_path, db_path)
338
+            # GScompute.main_function(file_path, db_path)
337
             GSshow.main_function(self.ui, db_path, utf_en)
339
             GSshow.main_function(self.ui, db_path, utf_en)
338
             # GSshow.main_function(self.ui, file_path, db_path)
340
             # GSshow.main_function(self.ui, file_path, db_path)
339
         elif current_text == "平面控制网稳定性计算":
341
         elif current_text == "平面控制网稳定性计算":

Loading…
取消
儲存