forked from diffpy/diffpy.pdfgui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpdfguiglobals.py
More file actions
82 lines (63 loc) · 2.04 KB
/
pdfguiglobals.py
File metadata and controls
82 lines (63 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python
##############################################################################
#
# PDFgui by DANSE Diffraction group
# Simon J. L. Billinge
# (c) 2006 trustees of the Michigan State University.
# All rights reserved.
#
# File coded by: Pavol Juhas
#
# See AUTHORS.txt for a list of people who contributed.
# See LICENSE.txt for license information.
#
##############################################################################
"""This module contains global parameters needed by PDFgui."""
from importlib.resources import files
from pathlib import Path
from diffpy.pdfgui.gui import debugoptions
# Name of the program
name = "PDFgui"
# Maximum number of files to be remembered
MAXMRU = 5
# The location of the configuration file
configfilename = Path.home() / ".pdfgui_py3.cfg"
# Project modification flag
isAltered = False
_mydir = Path(str(files(__name__))).resolve()
_upbasedir = _mydir.parents[2]
_development_mode = _upbasedir.name == "src" and (_upbasedir.parent / "pyproject.toml").is_file()
# Requirement must have egg-info. Do not use in _development_mode.
_req = "diffpy.pdfgui"
if _development_mode:
APPDATADIR = _mydir.parent
else:
APPDATADIR = Path(str(files(_req))).resolve()
APPDATADIR = APPDATADIR.resolve()
# Location of the HTML manual
docMainFile = "https://diffpy.github.io/diffpy.pdfgui/manual.html"
del _upbasedir
del _development_mode
del _req
def iconpath(iconfilename):
"""Full path to the icon file in pdfgui installation.
This function should be used whenever GUI needs access to custom
icons.
Parameters
----------
iconfilename : str
The icon file name without any path.
Returns
-------
str
The full path to the icon file.
"""
rv = APPDATADIR / "icons" / iconfilename
assert rv.is_file(), "icon file does not exist"
return str(rv)
# options and arguments passed on command line
cmdopts = []
cmdargs = []
# debugging options:
dbopts = debugoptions.DebugOptions()
# End of file