| 17 | |
| 18 | |
| 19 | def _find_slicap_preamble() -> str: |
| 20 | try: |
| 21 | import importlib |
| 22 | sl = importlib.import_module("SLiCAP") |
| 23 | install_path = getattr(getattr(sl, "ini", None), "install_path", None) |
| 24 | if install_path: |
| 25 | c = Path(install_path) / "tex" / "preambuleSLiCAP.tex" |
| 26 | if c.exists(): |
| 27 | return str(c) |
| 28 | except Exception: |
| 29 | pass |
| 30 | ini = Path.home() / "SLiCAP.ini" |
| 31 | if ini.exists(): |
| 32 | try: |
| 33 | cfg = configparser.ConfigParser() |
| 34 | cfg.read(str(ini)) |
| 35 | install_path = cfg.get("install", "installpath", fallback="") |
| 36 | if install_path: |
| 37 | c = Path(install_path) / "tex" / "preambuleSLiCAP.tex" |
| 38 | if c.exists(): |
| 39 | return str(c) |
| 40 | except Exception: |
| 41 | pass |
| 42 | return "" |
| 43 | |
| 44 | |
| 45 | class ParameterDialog(QDialog): |