Commit 559d7dc0 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

doc: Keep doc html and add doc window in Pamhyr2.

Showing with 169 additions and 2 deletions
+169 -2
...@@ -98,6 +98,8 @@ build-users-doc: ...@@ -98,6 +98,8 @@ build-users-doc:
artifacts: artifacts:
paths: paths:
- doc/users/documentation.pdf - doc/users/documentation.pdf
- doc/users/documentation.html
- doc/users/images/
build-developers-doc: build-developers-doc:
stage: build stage: build
...@@ -121,6 +123,7 @@ build-developers-doc: ...@@ -121,6 +123,7 @@ build-developers-doc:
- doc/dev/documentation.pdf - doc/dev/documentation.pdf
- doc/dev/documentation.html - doc/dev/documentation.html
- doc/dev/html.tar - doc/dev/html.tar
- doc/dev/images/
build-linux: build-linux:
stage: build stage: build
......
# Window.py -- Pamhyr
# Copyright (C) 2023 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import os
import logging
from View.Tools.PamhyrWindow import PamhyrWindow
from PyQt5.QtCore import QCoreApplication
_translate = QCoreApplication.translate
logger = logging.getLogger()
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtCore import QUrl
from PyQt5.QtWebKitWidgets import QWebView
from PyQt5.QtWebKit import QWebSettings
class DocWindow(PamhyrWindow):
_pamhyr_ui = "WebView"
_pamhyr_name = "Doc"
def _path_file(self, filename):
return os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..", "..", "..", "doc", filename
)
)
def __init__(self, filename=None,
study=None, config=None,
parent=None):
super(DocWindow, self).__init__(
title = self._pamhyr_name,
study = study,
config = config,
options = [],
parent = parent
)
self.setup_setting()
self.setup_url(filename)
def setup_url(self, filename):
webView = self.find(QWebView, "webView")
webView.setUrl(QUrl(f"file://{self._path_file(filename)}"))
def setup_setting(self):
webView = self.find(QWebView, "webView")
settings = webView.settings()
settings.setAttribute(QWebSettings.PluginsEnabled, True)
settings.setAttribute(QWebSettings.JavascriptEnabled, False)
...@@ -56,6 +56,7 @@ from View.SolverParameters.Window import SolverParametersWindow ...@@ -56,6 +56,7 @@ from View.SolverParameters.Window import SolverParametersWindow
from View.RunSolver.Window import SelectSolverWindow, SolverLogWindow from View.RunSolver.Window import SelectSolverWindow, SolverLogWindow
from View.CheckList.Window import CheckListWindow from View.CheckList.Window import CheckListWindow
from View.Results.Window import ResultsWindow from View.Results.Window import ResultsWindow
from View.Doc.Window import DocWindow
from View.Debug.Window import ReplWindow from View.Debug.Window import ReplWindow
from Model.Study import Study from Model.Study import Study
...@@ -183,6 +184,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): ...@@ -183,6 +184,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
"action_menu_sediment_layers": self.open_sediment_layers, "action_menu_sediment_layers": self.open_sediment_layers,
"action_menu_edit_reach_sediment_layers": self.open_reach_sediment_layers, "action_menu_edit_reach_sediment_layers": self.open_reach_sediment_layers,
"action_menu_results_last": self.open_last_results, "action_menu_results_last": self.open_last_results,
"action_menu_Pamhyr": self.open_doc_user,
"action_menu_Pamhyr_dev": self.open_doc_dev,
## Help ## Help
"action_menu_about": self.open_about, "action_menu_about": self.open_about,
# ToolBar action # ToolBar action
...@@ -715,6 +718,20 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): ...@@ -715,6 +718,20 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
self.open_solver_results(self._last_solver, self._last_results) self.open_solver_results(self._last_solver, self._last_results)
def open_doc(self, filename):
doc = DocWindow(
filename = filename,
parent = self
)
doc.show()
def open_doc_user(self):
self.open_doc("Pamhyr2-users.html")
def open_doc_dev(self):
self.open_doc("Pamhyr2-dev.html")
######### #########
# DEBUG # # DEBUG #
######### #########
......
...@@ -160,8 +160,15 @@ ...@@ -160,8 +160,15 @@
<property name="title"> <property name="title">
<string>&amp;Help</string> <string>&amp;Help</string>
</property> </property>
<addaction name="action_menu_help_pamhyr"/> <widget class="QMenu" name="menuDoc">
<addaction name="action_menu_help_mage"/> <property name="title">
<string>Help</string>
</property>
<addaction name="action_menu_Pamhyr"/>
<addaction name="action_menu_Pamhyr_dev"/>
<addaction name="action_menu_Mage"/>
</widget>
<addaction name="menuDoc"/>
<addaction name="action_menu_about"/> <addaction name="action_menu_about"/>
</widget> </widget>
<widget class="QMenu" name="menuSediment"> <widget class="QMenu" name="menuSediment">
...@@ -895,6 +902,26 @@ ...@@ -895,6 +902,26 @@
<string>Edit reach sediment layers</string> <string>Edit reach sediment layers</string>
</property> </property>
</action> </action>
<action name="actionDoc">
<property name="text">
<string>Doc</string>
</property>
</action>
<action name="action_menu_Pamhyr">
<property name="text">
<string>Pamhyr2 users</string>
</property>
</action>
<action name="action_menu_Pamhyr_dev">
<property name="text">
<string>Pamhyr2 developer</string>
</property>
</action>
<action name="action_menu_Mage">
<property name="text">
<string>Mage</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections> <connections>
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QWebView" name="webView">
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header location="global">QtWebKitWidgets/QWebView</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment