浏览代码

Ajout du formulaire de contact

omassot 7 年之前
父节点
当前提交
0b8425d84e
共有 5 个文件被更改,包括 407 次插入54 次删除
  1. 44 0
      ui/dlg_contact.py
  2. 254 0
      ui/dlg_contact.ui
  3. 12 1
      ui/dlg_main.py
  4. 97 53
      ui/dlg_main.ui
  5. 二进制
      ui/rsc/mn_logo_mini.png

+ 44 - 0
ui/dlg_contact.py

@@ -0,0 +1,44 @@
+"""
+"""
+import logging
+import os
+import platform
+import subprocess
+
+from PyQt5 import QtWidgets
+from PyQt5 import uic
+from PyQt5.QtGui import QIcon, QPixmap
+
+from core.constants import MAIN, LOGDIR, RSCDIR
+from path import Path
+
+
+logger = logging.getLogger("mncheck")
+
+Ui_Contact, _ = uic.loadUiType(MAIN / 'ui'/ 'dlg_contact.ui')
+
+
+class DlgContact(QtWidgets.QDialog):
+    def __init__(self, parent=None):
+        super().__init__(parent)
+        self.createWidgets()
+
+    def createWidgets(self):
+        """ set up the interface """
+        self.ui = Ui_Contact()
+        self.ui.setupUi(self)
+
+        self.setWindowIcon(QIcon(MAIN / "icon.png"))
+
+        self.ui.lbl_mn_logo.setPixmap(QPixmap(RSCDIR / "mn_logo_mini.png"))
+        self.ui.lbl_warning_logo.setPixmap(QPixmap(RSCDIR / "warning_16.png"))
+        
+        self.ui.btn_open_log_dir.clicked.connect(self.open_log_dir)
+    
+    def open_log_dir(self):
+        path = Path(LOGDIR).abspath()
+        if platform.system() == "Windows":
+            os.startfile(path)
+        else:
+            subprocess.Popen(["open", path])
+

+ 254 - 0
ui/dlg_contact.ui

@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>dlg_contact</class>
+ <widget class="QDialog" name="dlg_contact">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>402</width>
+    <height>296</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>402</width>
+    <height>296</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>402</width>
+    <height>296</height>
+   </size>
+  </property>
+  <property name="font">
+   <font>
+    <family>Verdana</family>
+   </font>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <property name="windowIcon">
+   <iconset>
+    <normaloff>../icon.png</normaloff>../icon.png</iconset>
+  </property>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>20</y>
+     <width>231</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <property name="font">
+    <font>
+     <pointsize>12</pointsize>
+     <weight>75</weight>
+     <bold>true</bold>
+    </font>
+   </property>
+   <property name="text">
+    <string>Manche Numérique 2019</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="lbl_mn_logo">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>111</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+   <property name="pixmap">
+    <pixmap>rsc/mn_logo_mini.png</pixmap>
+   </property>
+   <property name="scaledContents">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QLabel" name="lbl_mail">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>150</y>
+     <width>371</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <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>
+     <underline>true</underline>
+    </font>
+   </property>
+   <property name="text">
+    <string>sig@manchenumerique.fr</string>
+   </property>
+   <property name="alignment">
+    <set>Qt::AlignCenter</set>
+   </property>
+   <property name="openExternalLinks">
+    <bool>true</bool>
+   </property>
+   <property name="textInteractionFlags">
+    <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_6">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>130</y>
+     <width>371</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Pour signaler un problème ou suggérer une amélioration:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_7">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>200</y>
+     <width>361</width>
+     <height>41</height>
+    </rect>
+   </property>
+   <property name="font">
+    <font>
+     <pointsize>8</pointsize>
+     <italic>false</italic>
+    </font>
+   </property>
+   <property name="text">
+    <string>Lorsque c'est nécessaire, veuillez joindre à votre courriel le livrable concerné, le(s) fichier(s) de log, et/ou une capture d'écran.</string>
+   </property>
+   <property name="alignment">
+    <set>Qt::AlignJustify|Qt::AlignVCenter</set>
+   </property>
+   <property name="wordWrap">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="btn_open_log_dir">
+   <property name="geometry">
+    <rect>
+     <x>190</x>
+     <y>260</y>
+     <width>191</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Ouvrir l'emplacement des logs</string>
+   </property>
+  </widget>
+  <widget class="QFrame" name="frame">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>60</y>
+     <width>371</width>
+     <height>61</height>
+    </rect>
+   </property>
+   <property name="frameShape">
+    <enum>QFrame::Box</enum>
+   </property>
+   <property name="frameShadow">
+    <enum>QFrame::Sunken</enum>
+   </property>
+   <widget class="QLabel" name="lbl_warning_logo">
+    <property name="geometry">
+     <rect>
+      <x>0</x>
+      <y>0</y>
+      <width>41</width>
+      <height>41</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+    <property name="pixmap">
+     <pixmap>rsc/warning_16.png</pixmap>
+    </property>
+    <property name="alignment">
+     <set>Qt::AlignCenter</set>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_3">
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>0</y>
+      <width>321</width>
+      <height>61</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>MnCheck est fourni sans garantie d'exhaustivité et ne dispense pas l'opérateur de tout contrôle complémentaire qu'il jugerait nécessaire.</string>
+    </property>
+    <property name="alignment">
+     <set>Qt::AlignJustify|Qt::AlignVCenter</set>
+    </property>
+    <property name="wordWrap">
+     <bool>true</bool>
+    </property>
+   </widget>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 12 - 1
ui/dlg_main.py

@@ -13,6 +13,7 @@ from PyQt5.QtWidgets import QApplication, QTreeWidgetItem
 
 from core.checking import TestResult
 from core.constants import MAIN, RSCDIR
+from ui.dlg_contact import DlgContact
 
 
 logger = logging.getLogger("mncheck")
@@ -32,7 +33,7 @@ class QComlink(QObject):
 
 class DlgMain(QtWidgets.QDialog):
     def __init__(self, iface, parent=None):
-        super(DlgMain, self).__init__(parent)
+        super().__init__(parent)
         self.available_schemas = mncheck.list_schemas()        
         self.iface = iface
         self.schema_lib = None
@@ -44,6 +45,8 @@ class DlgMain(QtWidgets.QDialog):
         self.ui = Ui_Main()
         self.ui.setupUi(self)
         
+        self.setWindowIcon(QIcon(MAIN / "icon.png"))
+        
         self.ui.btn_run.setIcon(QIcon(RSCDIR / "play.png"))
         self.ui.btn_run.clicked.connect(self.run)
         
@@ -52,6 +55,9 @@ class DlgMain(QtWidgets.QDialog):
         
         self.ui.btn_settings.setIcon(QIcon(RSCDIR / "settings.png"))
         self.ui.btn_settings.clicked.connect(self.show_settings)
+        
+        self.ui.btn_settings.setIcon(QIcon(RSCDIR / "settings.png"))
+        self.ui.btn_contact.clicked.connect(self.show_contact)
 
         for i, schema_name in enumerate(self.available_schemas):
             s = mncheck.get_schema(schema_name)
@@ -241,6 +247,11 @@ class DlgMain(QtWidgets.QDialog):
         layer.removeSelection()
         layer.select(feature.id())
         
+    def show_contact(self):
+        dlg = DlgContact()
+        dlg.show()
+        dlg.exec_()
+    
     def show_help(self):
         pass
     

+ 97 - 53
ui/dlg_main.ui

@@ -146,81 +146,125 @@
      <attribute name="headerVisible">
       <bool>false</bool>
      </attribute>
+     <attribute name="headerStretchLastSection">
+      <bool>true</bool>
+     </attribute>
      <column>
       <property name="text">
        <string>icon</string>
       </property>
+      <property name="font">
+       <font>
+        <family>Segoe UI</family>
+       </font>
+      </property>
      </column>
      <column>
       <property name="text">
        <string>text</string>
       </property>
+      <property name="font">
+       <font>
+        <family>Segoe UI</family>
+       </font>
+      </property>
      </column>
      <column>
       <property name="text">
        <string>item</string>
       </property>
+      <property name="font">
+       <font>
+        <italic>true</italic>
+       </font>
+      </property>
      </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>
+    <widget class="QProgressBar" name="progress_bar">
+     <property name="value">
+      <number>0</number>
      </property>
-     <property name="openExternalLinks">
-      <bool>true</bool>
+     <property name="textVisible">
+      <bool>false</bool>
      </property>
     </widget>
    </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
+     <property name="topMargin">
+      <number>0</number>
+     </property>
+     <item>
+      <spacer name="horizontalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btn_contact">
+       <property name="palette">
+        <palette>
+         <active>
+          <colorrole role="ButtonText">
+           <brush brushstyle="SolidPattern">
+            <color alpha="255">
+             <red>0</red>
+             <green>0</green>
+             <blue>255</blue>
+            </color>
+           </brush>
+          </colorrole>
+         </active>
+         <inactive>
+          <colorrole role="ButtonText">
+           <brush brushstyle="SolidPattern">
+            <color alpha="255">
+             <red>0</red>
+             <green>0</green>
+             <blue>255</blue>
+            </color>
+           </brush>
+          </colorrole>
+         </inactive>
+         <disabled>
+          <colorrole role="ButtonText">
+           <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>
+         <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="flat">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
   </layout>
  </widget>
  <resources/>

二进制
ui/rsc/mn_logo_mini.png