Commit 8544dd11 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

doc: Disactive documentation display in Pamhyr2 for lighter packages.

Showing with 41 additions and 10 deletions
+41 -10
PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.12.2
PyQtWebEngine==5.15.6
#PyQtWebEngine==5.15.6
pyqtgraph>=0.12.1
matplotlib>=3.4.1
numpy>=1.24.2
......
......@@ -16,7 +16,7 @@
# -*- coding: utf-8 -*-
import os
import os, sys
import logging
import subprocess
from queue import Queue
......@@ -56,9 +56,17 @@ from View.SolverParameters.Window import SolverParametersWindow
from View.RunSolver.Window import SelectSolverWindow, SolverLogWindow
from View.CheckList.Window import CheckListWindow
from View.Results.Window import ResultsWindow
from View.Doc.Window import DocWindow
from View.Debug.Window import ReplWindow
# Optional internal display of documentation for make the application
# package lighter...
try:
from View.Doc.Window import DocWindow
_doc = "internal"
except Exception as e:
print("Handle exception: {e}")
_doc = "external"
from Model.Study import Study
logger = logging.getLogger()
......@@ -132,6 +140,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
if self.conf.last_study != "" and not self.conf.close_correctly:
self.dialog_reopen_study()
if _doc == "external":
logger.info("doc: Internal documentation is not available...")
def set_title(self):
title = "(dbg) " if self.conf.debug else ""
......@@ -726,16 +737,36 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
# DOCUMENTATION #
#################
def _doc_path_file(self, filename):
if ".py" in sys.argv[0]:
return os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..", "..", "doc", filename
)
)
return os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..", "..", "..", "doc", filename
)
)
def open_doc(self, filename):
if ".odt" in filename:
url = QUrl(f"file://{DocWindow._path_file(filename)}")
if _doc == "external":
url = QUrl(f"file://{self._doc_path_file(filename)}")
QDesktopServices.openUrl(url)
else:
doc = DocWindow(
filename = filename,
parent = self
)
doc.show()
if ".odt" in filename:
url = QUrl(f"file://{DocWindow._path_file(filename)}")
QDesktopServices.openUrl(url)
else:
doc = DocWindow(
filename = filename,
parent = self
)
doc.show()
def open_doc_user(self, ext="pdf"):
self.open_doc(f"Pamhyr2-users.{ext}")
......
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