mirror of https://gitlab.com/pamhyr/pamhyr2
doc: Disactive documentation display in Pamhyr2 for lighter packages.
parent
1f8b0bddb4
commit
8544dd1144
|
|
@ -1,7 +1,7 @@
|
||||||
PyQt5==5.15.4
|
PyQt5==5.15.4
|
||||||
PyQt5-Qt5==5.15.2
|
PyQt5-Qt5==5.15.2
|
||||||
PyQt5-sip==12.12.2
|
PyQt5-sip==12.12.2
|
||||||
PyQtWebEngine==5.15.6
|
#PyQtWebEngine==5.15.6
|
||||||
pyqtgraph>=0.12.1
|
pyqtgraph>=0.12.1
|
||||||
matplotlib>=3.4.1
|
matplotlib>=3.4.1
|
||||||
numpy>=1.24.2
|
numpy>=1.24.2
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os, sys
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
|
|
@ -56,9 +56,17 @@ 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
|
||||||
|
|
||||||
|
# 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
|
from Model.Study import Study
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
@ -132,6 +140,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
if self.conf.last_study != "" and not self.conf.close_correctly:
|
if self.conf.last_study != "" and not self.conf.close_correctly:
|
||||||
self.dialog_reopen_study()
|
self.dialog_reopen_study()
|
||||||
|
|
||||||
|
if _doc == "external":
|
||||||
|
logger.info("doc: Internal documentation is not available...")
|
||||||
|
|
||||||
def set_title(self):
|
def set_title(self):
|
||||||
title = "(dbg) " if self.conf.debug else ""
|
title = "(dbg) " if self.conf.debug else ""
|
||||||
|
|
||||||
|
|
@ -726,16 +737,36 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
# DOCUMENTATION #
|
# 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):
|
def open_doc(self, filename):
|
||||||
if ".odt" in filename:
|
if _doc == "external":
|
||||||
url = QUrl(f"file://{DocWindow._path_file(filename)}")
|
url = QUrl(f"file://{self._doc_path_file(filename)}")
|
||||||
QDesktopServices.openUrl(url)
|
QDesktopServices.openUrl(url)
|
||||||
else:
|
else:
|
||||||
doc = DocWindow(
|
if ".odt" in filename:
|
||||||
filename = filename,
|
url = QUrl(f"file://{DocWindow._path_file(filename)}")
|
||||||
parent = self
|
QDesktopServices.openUrl(url)
|
||||||
)
|
else:
|
||||||
doc.show()
|
doc = DocWindow(
|
||||||
|
filename = filename,
|
||||||
|
parent = self
|
||||||
|
)
|
||||||
|
doc.show()
|
||||||
|
|
||||||
def open_doc_user(self, ext="pdf"):
|
def open_doc_user(self, ext="pdf"):
|
||||||
self.open_doc(f"Pamhyr2-users.{ext}")
|
self.open_doc(f"Pamhyr2-users.{ext}")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue