rmy 3 месяцев назад
Родитель
Сommit
0c15d110bc
1 измененных файлов: 61 добавлений и 60 удалений
  1. 61
    60
      Front/main.py

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

@@ -788,69 +788,70 @@ class MainWindow(QMainWindow):
788 788
         for filename in os.listdir(inpath):
789 789
             # 数据库
790 790
             dbname = filename.split('.', -1)[0]
791
-            dbpath = os.path.join(inpath, filename)
792
-            sqlitem.append(TreeWidgetItem(id, 0, dbname, icon=QIcon(
793
-                os.path.abspath(os.path.join(self.absPath, "images/icons/cil-clone.png")))))
794
-            pid = id
795
-            id = id + 1
796
-            # 三种方法
797
-            sqlitem.append(TreeWidgetItem(id, pid, '水准测段高差稳定计算', icon=QIcon(
798
-                os.path.join(self.absPath, "images/icons/cil-description.png"))))
799
-            gcid = id
800
-            id = id + 1
801
-            sqlitem.append(TreeWidgetItem(id, pid, '控制网复测平面基准计算', icon=QIcon(
802
-                os.path.join(self.absPath, "images/icons/cil-description.png"))))
803
-            gsid = id
804
-            id = id + 1
805
-            sqlitem.append(TreeWidgetItem(id, pid, '平面控制网稳定性计算', icon=QIcon(
806
-                os.path.join(self.absPath, "images/icons/cil-description.png"))))
807
-            wdid = id
808
-            id = id + 1
809
-            # 读取所有的表名(三种方式往下)
810
-            db1 = sqlite3.connect(dbpath)
811
-            # 获取游标
812
-            cursor1 = db1.cursor()
813
-            sqlstr1 = 'SELECT TableName FROM GC_Input_Param;'
814
-            cursor1.execute(sqlstr1)
815
-            result1 = cursor1.fetchall()
816
-            for re1 in result1:
817
-                str1 = re1[0].decode('utf-8')
818
-                list1 = []
819
-                list1.append(dbname)
820
-                list1.append('水准测段高差稳定计算')
821
-                list1.append(str1)
822
-                self.dblist.append(list1)
823
-                sqlitem.append(TreeWidgetItem(id, gcid, str1, icon=QIcon(
824
-                    os.path.join(self.absPath, "images/icons/cil-file.png")), extend={'listData': list1}))
791
+            if dbname != 'DataBase':
792
+                dbpath = os.path.join(inpath, filename)
793
+                sqlitem.append(TreeWidgetItem(id, 0, dbname, icon=QIcon(
794
+                    os.path.abspath(os.path.join(self.absPath, "images/icons/cil-clone.png")))))
795
+                pid = id
825 796
                 id = id + 1
826
-            sqlstr2 = 'SELECT TableName FROM GS_Input_Param;'
827
-            cursor1.execute(sqlstr2)
828
-            result2 = cursor1.fetchall()
829
-            for re2 in result2:
830
-                str2 = re2[0].decode('utf-8')
831
-                list2 = []
832
-                list2.append(dbname)
833
-                list2.append('控制网复测平面基准计算')
834
-                list2.append(str2)
835
-                self.dblist.append(list2)
836
-                sqlitem.append(TreeWidgetItem(id, gsid, str2,
837
-                                              icon=QIcon(os.path.join(self.absPath, "images/icons/cil-file.png")),
838
-                                              extend={'listData': list2}))
797
+                # 三种方法
798
+                sqlitem.append(TreeWidgetItem(id, pid, '水准测段高差稳定计算', icon=QIcon(
799
+                    os.path.join(self.absPath, "images/icons/cil-description.png"))))
800
+                gcid = id
839 801
                 id = id + 1
840
-            sqlstr3 = 'SELECT TableName FROM WD_Input_Param;'
841
-            cursor1.execute(sqlstr3)
842
-            result3 = cursor1.fetchall()
843
-            for re3 in result3:
844
-                str3 = re3[0].decode('utf-8')
845
-                list3 = []
846
-                list3.append(dbname)
847
-                list3.append('平面控制网稳定性计算')
848
-                list3.append(str3)
849
-                self.dblist.append(list3)
850
-                sqlitem.append(TreeWidgetItem(id, wdid, str3,
851
-                                              icon=QIcon(os.path.join(self.absPath, "images/icons/cil-file.png")),
852
-                                              extend={'listData': list3}))
802
+                sqlitem.append(TreeWidgetItem(id, pid, '控制网复测平面基准计算', icon=QIcon(
803
+                    os.path.join(self.absPath, "images/icons/cil-description.png"))))
804
+                gsid = id
805
+                id = id + 1
806
+                sqlitem.append(TreeWidgetItem(id, pid, '平面控制网稳定性计算', icon=QIcon(
807
+                    os.path.join(self.absPath, "images/icons/cil-description.png"))))
808
+                wdid = id
853 809
                 id = id + 1
810
+                # 读取所有的表名(三种方式往下)
811
+                db1 = sqlite3.connect(dbpath)
812
+                # 获取游标
813
+                cursor1 = db1.cursor()
814
+                sqlstr1 = 'SELECT TableName FROM GC_Input_Param;'
815
+                cursor1.execute(sqlstr1)
816
+                result1 = cursor1.fetchall()
817
+                for re1 in result1:
818
+                    str1 = re1[0].decode('utf-8')
819
+                    list1 = []
820
+                    list1.append(dbname)
821
+                    list1.append('水准测段高差稳定计算')
822
+                    list1.append(str1)
823
+                    self.dblist.append(list1)
824
+                    sqlitem.append(TreeWidgetItem(id, gcid, str1, icon=QIcon(
825
+                        os.path.join(self.absPath, "images/icons/cil-file.png")), extend={'listData': list1}))
826
+                    id = id + 1
827
+                sqlstr2 = 'SELECT TableName FROM GS_Input_Param;'
828
+                cursor1.execute(sqlstr2)
829
+                result2 = cursor1.fetchall()
830
+                for re2 in result2:
831
+                    str2 = re2[0].decode('utf-8')
832
+                    list2 = []
833
+                    list2.append(dbname)
834
+                    list2.append('控制网复测平面基准计算')
835
+                    list2.append(str2)
836
+                    self.dblist.append(list2)
837
+                    sqlitem.append(TreeWidgetItem(id, gsid, str2,
838
+                                                  icon=QIcon(os.path.join(self.absPath, "images/icons/cil-file.png")),
839
+                                                  extend={'listData': list2}))
840
+                    id = id + 1
841
+                sqlstr3 = 'SELECT TableName FROM WD_Input_Param;'
842
+                cursor1.execute(sqlstr3)
843
+                result3 = cursor1.fetchall()
844
+                for re3 in result3:
845
+                    str3 = re3[0].decode('utf-8')
846
+                    list3 = []
847
+                    list3.append(dbname)
848
+                    list3.append('平面控制网稳定性计算')
849
+                    list3.append(str3)
850
+                    self.dblist.append(list3)
851
+                    sqlitem.append(TreeWidgetItem(id, wdid, str3,
852
+                                                  icon=QIcon(os.path.join(self.absPath, "images/icons/cil-file.png")),
853
+                                                  extend={'listData': list3}))
854
+                    id = id + 1
854 855
         button = ElTree(ElTreeData(sqlitem))
855 856
         return button
856 857
 

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