From b5a3ee75680cbe99fef28b0bdb77254121afc89b Mon Sep 17 00:00:00 2001
From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr>
Date: Wed, 24 Jan 2024 11:40:52 +0100
Subject: [PATCH] doc: Delete user documentation and use gitlab wiki instead.

---
 .gitlab-ci.yml                |  4 ++--
 packages/make-windows-dir.bat |  4 ++--
 src/View/MainWindow.py        | 14 ++++++++------
 src/View/ui/MainWindow.ui     |  7 +++----
 4 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 075ebcfa..ef23ff83 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -262,8 +262,8 @@ build-linux:
     - mkdir -p pamhyr/doc/
     - mkdir -p pamhyr/doc/images/
     - mkdir -p pamhyr/doc/html/
-    - cp ../doc/users/documentation.pdf pamhyr/doc/Pamhyr2-users.pdf
-    - cp ../doc/users/documentation.html pamhyr/doc/Pamhyr2-users.html
+    # - cp ../doc/users/documentation.pdf pamhyr/doc/Pamhyr2-users.pdf
+    # - cp ../doc/users/documentation.html pamhyr/doc/Pamhyr2-users.html
     - cp ../doc/dev/documentation.pdf pamhyr/doc/Pamhyr2-dev.pdf
     - cp ../doc/dev/documentation.html pamhyr/doc/Pamhyr2-dev.html
     #- cp ../doc/users/images/* pamhyr/doc/images
diff --git a/packages/make-windows-dir.bat b/packages/make-windows-dir.bat
index ecd9fca3..cd06d5b9 100644
--- a/packages/make-windows-dir.bat
+++ b/packages/make-windows-dir.bat
@@ -53,9 +53,9 @@ copy /y ..\tests_cases\Saar\Saar.pamhyr pamhyr\tests_cases\Saar\
 rem Documentations
 mkdir pamhyr\doc
 mkdir pamhyr\doc\images
-copy /y ..\doc\users\documentation.pdf pamhyr\doc\Pamhyr2-users.pdf
+rem copy /y ..\doc\users\documentation.pdf pamhyr\doc\Pamhyr2-users.pdf
 copy /y ..\doc\dev\documentation.pdf pamhyr\doc\Pamhyr2-dev.pdf
-copy /y ..\doc\users\documentation.html pamhyr\doc\Pamhyr2-users.html
+rem copy /y ..\doc\users\documentation.html pamhyr\doc\Pamhyr2-users.html
 copy /y ..\doc\dev\documentation.html pamhyr\doc\Pamhyr2-dev.html
 copy /y ..\doc\users\images\* pamhyr\doc\images
 copy /y ..\doc\dev\images\* pamhyr\doc\images
diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py
index 809c3a4d..126fab83 100644
--- a/src/View/MainWindow.py
+++ b/src/View/MainWindow.py
@@ -209,12 +209,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
             "action_menu_results_last": self.open_last_results,
             "action_open_results_from_file": self.open_results_from_file,
             # Help
-            "action_menu_pamhyr_users_pdf":
-            lambda: self.open_doc_user(ext="pdf"),
+            "action_menu_pamhyr_users_wiki": self.open_doc_user,
             "action_menu_pamhyr_developers_pdf":
             lambda: self.open_doc_dev(ext="pdf"),
-            "action_menu_pamhyr_users_html":
-            lambda: self.open_doc_user(ext="html"),
             "action_menu_pamhyr_developers_html":
             lambda: self.open_doc_dev(ext="html"),
             "action_menu_mage": self.open_doc_mage,
@@ -937,6 +934,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
         )
 
     def open_doc(self, filename):
+        if "https://" in filename:
+            url = QUrl(filename)
+            QDesktopServices.openUrl(url)
+            return
+
         if _doc == "external":
             url = QUrl(f"file://{self._doc_path_file(filename)}")
             QDesktopServices.openUrl(url)
@@ -951,8 +953,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
                 )
                 doc.show()
 
-    def open_doc_user(self, ext="pdf"):
-        self.open_doc(f"Pamhyr2-users.{ext}")
+    def open_doc_user(self):
+        self.open_doc(f"https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home")
 
     def open_doc_dev(self, ext="pdf"):
         self.open_doc(f"Pamhyr2-dev.{ext}")
diff --git a/src/View/ui/MainWindow.ui b/src/View/ui/MainWindow.ui
index ecb069cc..33ab0723 100644
--- a/src/View/ui/MainWindow.ui
+++ b/src/View/ui/MainWindow.ui
@@ -162,8 +162,7 @@
       <property name="title">
        <string>Pamhyr2 </string>
       </property>
-      <addaction name="action_menu_pamhyr_users_pdf"/>
-      <addaction name="action_menu_pamhyr_users_html"/>
+      <addaction name="action_menu_pamhyr_users_wiki"/>
       <addaction name="action_menu_pamhyr_developers_pdf"/>
       <addaction name="action_menu_pamhyr_developers_html"/>
      </widget>
@@ -908,9 +907,9 @@
     <string>Open mage documentation</string>
    </property>
   </action>
-  <action name="action_menu_pamhyr_users_pdf">
+  <action name="action_menu_pamhyr_users_wiki">
    <property name="text">
-    <string>Users (pdf)</string>
+    <string>Users (wiki)</string>
    </property>
   </action>
   <action name="action_menu_pamhyr_users_html">
-- 
GitLab