mirror of https://gitlab.com/pamhyr/pamhyr2
doc: Doc in format html or pdf, back/forward button and firefox button.
parent
a77c342e69
commit
f4d580a000
|
|
@ -43,18 +43,21 @@ cd $OLD_PWD
|
|||
|
||||
echo " *** COPY DATA"
|
||||
|
||||
mkdir -p dist/pamhyr/View/ui
|
||||
mkdir -p dist/pamhyr/View/ui/Widgets
|
||||
cp -r ../src/View/ui/ressources/ dist/pamhyr/View/ui/
|
||||
cp -r ../src/View/ui/Widgets/*.ui dist/pamhyr/View/ui/Widgets/
|
||||
cp -r ../src/View/ui/*.ui dist/pamhyr/View/ui/
|
||||
mkdir -p dist/pamhyr/_internal/View/ui
|
||||
mkdir -p dist/pamhyr/_internal/View/ui/Widgets
|
||||
cp -r ../src/View/ui/ressources/ dist/pamhyr/_internal/View/ui/
|
||||
cp -r ../src/View/ui/Widgets/*.ui dist/pamhyr/_internal/View/ui/Widgets/
|
||||
cp -r ../src/View/ui/*.ui dist/pamhyr/_internal/View/ui/
|
||||
|
||||
mkdir -p dist/pamhyr/lang
|
||||
cp -r ../src/lang/*.qm dist/pamhyr/lang/
|
||||
|
||||
cp ../VERSION dist/pamhyr/
|
||||
cp ../AUTHORS dist/pamhyr/
|
||||
cp ../LICENSE dist/pamhyr/
|
||||
mkdir dist/pamhyr/_internal/
|
||||
#cp ../VERSION dist/pamhyr/_internal/
|
||||
VERSION=$(cat ../VERSION)
|
||||
echo "local-build-$VERSION" > dist/pamhyr/_internal/VERSION
|
||||
cp ../AUTHORS dist/pamhyr/_internal/
|
||||
cp ../LICENSE dist/pamhyr/_internal/
|
||||
|
||||
mkdir -p dist/pamhyr/mage/
|
||||
cp ../mage/mage dist/pamhyr/mage/
|
||||
|
|
@ -65,6 +68,18 @@ mkdir -p dist/pamhyr/tests_cases/
|
|||
mkdir -p dist/pamhyr/tests_cases/Saar
|
||||
cp ../tests_cases/Saar/Saar.pamhyr dist/pamhyr/tests_cases/Saar/
|
||||
|
||||
mkdir -p dist/pamhyr/doc/
|
||||
cp ../doc/dev/documentation.pdf dist/pamhyr/doc/Pamhyr2-dev.pdf
|
||||
cp ../doc/dev/documentation.html dist/pamhyr/doc/Pamhyr2-dev.html
|
||||
|
||||
cp ../doc/users/documentation.pdf dist/pamhyr/doc/Pamhyr2-users.pdf
|
||||
cp ../doc/users/documentation.html dist/pamhyr/doc/Pamhyr2-users.html
|
||||
|
||||
mkdir -p dist/pamhyr/doc/images
|
||||
cp ../doc/users/images/* dist/pamhyr/doc/images/
|
||||
cp ../doc/dev/images/* dist/pamhyr/doc/images/
|
||||
cp ../doc/images/* dist/pamhyr/doc/images/
|
||||
|
||||
echo " *** MAKE SRC PACKAGE"
|
||||
|
||||
OLD_PWD=$PWD
|
||||
|
|
@ -76,11 +91,11 @@ mv ../pamhyr-src.tar.gz ./
|
|||
|
||||
echo " *** MAKE BIN PACKAGE"
|
||||
|
||||
OLD_PWD=$PWD
|
||||
cd dist/
|
||||
tar --xz -cf pamhyr-gnulinux-amd64.tar.xz pamhyr --checkpoint=.100
|
||||
cd $OLD_PWD
|
||||
# OLD_PWD=$PWD
|
||||
# cd dist/
|
||||
# tar --xz -cf pamhyr-gnulinux-amd64.tar.xz pamhyr --checkpoint=.100
|
||||
# cd $OLD_PWD
|
||||
|
||||
mv dist/pamhyr-gnulinux-amd64.tar.xz ./
|
||||
# mv dist/pamhyr-gnulinux-amd64.tar.xz ./
|
||||
|
||||
echo " *** DONE"
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
import os
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
from View.Tools.PamhyrWindow import PamhyrWindow
|
||||
|
||||
|
|
@ -27,7 +28,7 @@ _translate = QCoreApplication.translate
|
|||
logger = logging.getLogger()
|
||||
|
||||
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QAction
|
||||
from PyQt5.QtCore import QUrl
|
||||
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineSettings
|
||||
|
||||
|
|
@ -55,8 +56,18 @@ class DocWindow(PamhyrWindow):
|
|||
|
||||
)
|
||||
|
||||
self._path = self._path_file(filename)
|
||||
|
||||
self.setup_web_engine()
|
||||
self.setup_url(filename)
|
||||
self.setup_url(self._path)
|
||||
self.setup_connection()
|
||||
|
||||
def setup_connection(self):
|
||||
self.findChild(QAction, "action_back").triggered.connect(self.back)
|
||||
self.findChild(QAction, "action_forward").triggered.connect(self.forward)
|
||||
|
||||
self.findChild(QAction, "action_firefox").triggered.connect(self.open_in_firefox)
|
||||
|
||||
|
||||
def setup_web_engine(self):
|
||||
vl = self.find(QVBoxLayout, "verticalLayout")
|
||||
|
|
@ -64,9 +75,23 @@ class DocWindow(PamhyrWindow):
|
|||
|
||||
settings = self._web_view.settings()
|
||||
settings.setAttribute(QWebEngineSettings.PluginsEnabled, True)
|
||||
settings.setAttribute(QWebEngineSettings.JavascriptEnabled, False)
|
||||
settings.setAttribute(QWebEngineSettings.JavascriptEnabled, True)
|
||||
settings.setAttribute(QWebEngineSettings.PdfViewerEnabled, True)
|
||||
|
||||
vl.addWidget(self._web_view)
|
||||
|
||||
def setup_url(self, filename):
|
||||
logger.info(f"Open documentation : {filename}")
|
||||
self._web_view.setUrl(QUrl(f"file://{self._path_file(filename)}"))
|
||||
|
||||
def back(self):
|
||||
self._web_view.back()
|
||||
|
||||
def forward(self):
|
||||
self._web_view.forward()
|
||||
|
||||
def open_in_firefox(self):
|
||||
_ = subprocess.Popen(
|
||||
f"firefox {self._path}",
|
||||
shell = True
|
||||
)
|
||||
|
|
|
|||
|
|
@ -184,9 +184,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
"action_menu_sediment_layers": self.open_sediment_layers,
|
||||
"action_menu_edit_reach_sediment_layers": self.open_reach_sediment_layers,
|
||||
"action_menu_results_last": self.open_last_results,
|
||||
"action_menu_Pamhyr": self.open_doc_user,
|
||||
"action_menu_Pamhyr_dev": self.open_doc_dev,
|
||||
## Help
|
||||
"action_menu_pamhyr_users_pdf": lambda: self.open_doc_user(ext="pdf"),
|
||||
"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_about": self.open_about,
|
||||
# ToolBar action
|
||||
"action_toolBar_quit": self.close,
|
||||
|
|
@ -726,11 +728,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
doc.show()
|
||||
|
||||
|
||||
def open_doc_user(self):
|
||||
self.open_doc("Pamhyr2-users.html")
|
||||
def open_doc_user(self, ext="pdf"):
|
||||
self.open_doc(f"Pamhyr2-users.{ext}")
|
||||
|
||||
def open_doc_dev(self):
|
||||
self.open_doc("Pamhyr2-dev.html")
|
||||
def open_doc_dev(self, ext="pdf"):
|
||||
self.open_doc(f"Pamhyr2-dev.{ext}")
|
||||
|
||||
#########
|
||||
# DEBUG #
|
||||
|
|
|
|||
|
|
@ -467,7 +467,12 @@ class ASubMainWindow(QMainWindow, ASubWindowFeatures, WindowToolKit):
|
|||
super(ASubMainWindow, self).__init__(parent=parent)
|
||||
if ui is not None:
|
||||
self.ui = loadUi(
|
||||
os.path.join(os.path.dirname(__file__), "..", "ui", f"{ui}.ui"),
|
||||
os.path.abspath(
|
||||
os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
"..", "ui", f"{ui}.ui"
|
||||
)
|
||||
),
|
||||
self
|
||||
)
|
||||
|
||||
|
|
@ -499,7 +504,12 @@ class ASubWindow(QDialog, ASubWindowFeatures, WindowToolKit):
|
|||
def __init__(self, name="", ui="dummy", parent=None, **kwargs):
|
||||
super(ASubWindow, self).__init__(parent=parent)
|
||||
self.ui = loadUi(
|
||||
os.path.join(os.path.dirname(__file__), "..", "ui", f"{ui}.ui"),
|
||||
os.path.abspath(
|
||||
os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
"..", "ui", f"{ui}.ui"
|
||||
)
|
||||
),
|
||||
self
|
||||
)
|
||||
self.name = name
|
||||
|
|
@ -530,7 +540,12 @@ class AWidget(QWidget, ASubWindowFeatures):
|
|||
def __init__(self, ui="", parent=None):
|
||||
super(AWidget, self).__init__(parent=parent)
|
||||
self.ui = loadUi(
|
||||
os.path.join(os.path.dirname(__file__), "..", "ui", "Widgets", f"{ui}.ui"),
|
||||
os.path.abspath(
|
||||
os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
"..", "ui", "Widgets", f"{ui}.ui"
|
||||
)
|
||||
),
|
||||
self
|
||||
)
|
||||
self.parent = parent
|
||||
|
|
|
|||
|
|
@ -164,8 +164,16 @@
|
|||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="action_menu_Pamhyr"/>
|
||||
<addaction name="action_menu_Pamhyr_dev"/>
|
||||
<widget class="QMenu" name="menuPamhyr2">
|
||||
<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_developers_pdf"/>
|
||||
<addaction name="action_menu_pamhyr_developers_html"/>
|
||||
</widget>
|
||||
<addaction name="menuPamhyr2"/>
|
||||
<addaction name="action_menu_Mage"/>
|
||||
</widget>
|
||||
<addaction name="menuDoc"/>
|
||||
|
|
@ -907,11 +915,6 @@
|
|||
<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>
|
||||
|
|
@ -922,6 +925,26 @@
|
|||
<string>Mage</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_menu_pamhyr_users_pdf">
|
||||
<property name="text">
|
||||
<string>Users (pdf)</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_menu_pamhyr_users_html">
|
||||
<property name="text">
|
||||
<string>Users (html)</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_menu_pamhyr_developers_pdf">
|
||||
<property name="text">
|
||||
<string>Developers (pdf)</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_menu_pamhyr_developers_html">
|
||||
<property name="text">
|
||||
<string>Developers (html)</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
<width>800</width>
|
||||
<height>450</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -25,12 +25,52 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<width>800</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="action_back"/>
|
||||
<addaction name="action_forward"/>
|
||||
<addaction name="action_firefox"/>
|
||||
</widget>
|
||||
<action name="action_firefox">
|
||||
<property name="text">
|
||||
<string>Firefox</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open document in Firefox</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_back">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>ressources/gtk-go-back.png</normaloff>ressources/gtk-go-back.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>back</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_forward">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>ressources/gtk-go-forward.png</normaloff>ressources/gtk-go-forward.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>forward</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue