Sfoglia il codice sorgente

Corrections diverses

omassot 7 anni fa
parent
commit
cc6357f827
3 ha cambiato i file con 70 aggiunte e 5 eliminazioni
  1. 3 1
      core/validation_errors.py
  2. 9 4
      ui/dlg_main.py
  3. 58 0
      ui/dlg_main.ui

+ 3 - 1
core/validation_errors.py

@@ -3,12 +3,14 @@
 @author: olivier.massot, 2018
 '''
 
-VALIDATION_ERROR_LEVELS = {10: "MINEURE", 20: "AVERTISSEMENT", 30: "ERREUR", 40: "CRITIQUE"}
 MINOR = 10
 WARNING = 20
 ERROR = 30
 CRITICAL = 40
 
+_errorlvl_to_str = {10: "MINEURE", 20: "AVERTISSEMENT", 30: "ERREUR", 40: "CRITIQUE"}
+
+
 class BaseValidationError():
     order_ = 0
     name = "Erreur"

+ 9 - 4
ui/dlg_main.py

@@ -113,9 +113,17 @@ class DlgMain(QtWidgets.QDialog):
             logger.info("Aucun schéma sélectionné - Opération annulée")
             return
         
+        try:
+            self._run(validator)
+        except:
+            raise
+        finally:
+            QApplication.restoreOverrideCursor()
+    
+    def _run(self, validator):
         report = validator.submit(self.iface)
         
-        logger.debug(report)
+        logger.debug(f"Rapport d'exec: {report}")
         
         for chk in report["checkpoints"]:
             cur_row = self.ui.tbl_layers.rowCount()
@@ -131,7 +139,6 @@ class DlgMain(QtWidgets.QDialog):
             if not chk["valid"]:
                 self.ui.tbl_layers.setItem(cur_row, 2, QTableWidgetItem("Des erreurs ont été trouvées"))
 
-        
         for type_err in report["errors"]:
             for err in report["errors"][type_err]["list"]:
                 cur_row = self.ui.tbl_layers.rowCount()
@@ -147,8 +154,6 @@ class DlgMain(QtWidgets.QDialog):
                 self.ui.tbl_layers.setItem(cur_row, 1, lbl_field)
                 self.ui.tbl_layers.setItem(cur_row, 2, lbl_err)
     
-        QApplication.restoreOverrideCursor()
-    
     def show_help(self):
         pass
     

+ 58 - 0
ui/dlg_main.ui

@@ -192,6 +192,64 @@
      </column>
     </widget>
    </item>
+   <item>
+    <widget class="QLabel" name="label_2">
+     <property name="palette">
+      <palette>
+       <active>
+        <colorrole role="WindowText">
+         <brush brushstyle="SolidPattern">
+          <color alpha="255">
+           <red>0</red>
+           <green>0</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+       </active>
+       <inactive>
+        <colorrole role="WindowText">
+         <brush brushstyle="SolidPattern">
+          <color alpha="255">
+           <red>0</red>
+           <green>0</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+       </inactive>
+       <disabled>
+        <colorrole role="WindowText">
+         <brush brushstyle="SolidPattern">
+          <color alpha="255">
+           <red>120</red>
+           <green>120</green>
+           <blue>120</blue>
+          </color>
+         </brush>
+        </colorrole>
+       </disabled>
+      </palette>
+     </property>
+     <property name="font">
+      <font>
+       <family>Verdana</family>
+       <pointsize>8</pointsize>
+       <italic>true</italic>
+       <underline>true</underline>
+      </font>
+     </property>
+     <property name="text">
+      <string>Signaler un problème ou suggérer une amélioration</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="openExternalLinks">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <resources/>