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-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}")
|
||||
|
|
|
|||
Loading…
Reference in New Issue