Skip to content

Commit 9496a69

Browse files
authored
Merge pull request #298 from stevenhua0320/fix-gui-functionality
fix:hot-fix pdfgui functionality fix after skpkg
2 parents 93a7136 + a6c09b3 commit 9496a69

File tree

6 files changed

+53
-30
lines changed

6 files changed

+53
-30
lines changed

.github/workflows/matrix-and-codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ jobs:
1616
with:
1717
project: diffpy.pdfgui
1818
c_extension: false
19-
headless: false
19+
headless: true
2020
secrets:
2121
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/tests-on-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ jobs:
1010
with:
1111
project: diffpy.pdfgui
1212
c_extension: false
13-
headless: false
13+
headless: true
1414
secrets:
1515
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

news/fix-gui-functionality.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* No News Added: fix gui functionality after skpkg
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ exclude = [] # exclude packages matching these glob patterns (empty by default)
4949
namespaces = false # to disable scanning PEP 420 namespaces (true by default)
5050

5151
[project.scripts]
52-
diffpy-pdfgui = "diffpy.pdfgui.app:main"
52+
pdfgui = "diffpy.pdfgui.applications.pdfgui:main"
5353

5454
[tool.setuptools.dynamic]
5555
dependencies = {file = ["requirements/pip.txt"]}

src/diffpy/pdfgui/gui/aboutdialog.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616
##############################################################################
1717

1818
import random
19+
from datetime import datetime, timezone
1920

2021
import wx
2122
import wx.lib.agw.hyperlink
2223

2324
from diffpy.pdfgui.gui.pdfguiglobals import iconpath
24-
from diffpy.pdfgui.version import __date__, __version__
25+
from diffpy.pdfgui.version import __version__
26+
27+
__date__ = datetime.now(timezone.utc).date().isoformat()
2528

2629
_acknowledgement = """\
2730
This software was developed by the Billinge-group as part of the Distributed

src/diffpy/pdfgui/gui/pdfguiglobals.py

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
##############################################################################
1515
"""This module contains global parameters needed by PDFgui."""
1616

17-
import os.path
1817
from importlib.resources import files
18+
from pathlib import Path
1919

2020
from diffpy.pdfgui.gui import debugoptions
2121

@@ -24,34 +24,24 @@
2424
# Maximum number of files to be remembered
2525
MAXMRU = 5
2626
# The location of the configuration file
27-
configfilename = os.path.expanduser("~/.pdfgui_py3.cfg")
27+
configfilename = Path.home() / ".pdfgui_py3.cfg"
2828
# Project modification flag
2929
isAltered = False
3030

31-
# Resolve APPDATADIR base path to application data files.
32-
try:
33-
_mydir = os.path.abspath(str(files(__name__)))
34-
except TypeError: # For Python < 3.12
35-
_mydir = os.path.abspath(os.path.dirname(__file__))
31+
_mydir = Path(str(files(__name__))).resolve()
3632

37-
_upbasedir = os.path.normpath(_mydir + "/../../..")
38-
_development_mode = os.path.basename(_upbasedir) == "src" and os.path.isfile(
39-
os.path.join(_upbasedir, "../pyproject.toml")
40-
)
33+
_upbasedir = _mydir.parents[2]
34+
_development_mode = _upbasedir.name == "src" and (_upbasedir.parent / "pyproject.toml").is_file()
4135

4236
# Requirement must have egg-info. Do not use in _development_mode.
4337
_req = "diffpy.pdfgui"
4438

45-
# pavol
46-
# APPDATADIR = (os.path.dirname(_upbasedir) if _development_mode
47-
# else str(files(_req)))
48-
# long
4939
if _development_mode:
50-
APPDATADIR = os.path.dirname(_mydir)
40+
APPDATADIR = _mydir.parent
5141
else:
52-
APPDATADIR = str(files(_req))
42+
APPDATADIR = Path(str(files(_req))).resolve()
5343

54-
APPDATADIR = os.path.abspath(APPDATADIR)
44+
APPDATADIR = APPDATADIR.resolve()
5545

5646
# Location of the HTML manual
5747
docMainFile = "https://diffpy.github.io/diffpy.pdfgui/manual.html"
@@ -62,24 +52,31 @@
6252

6353

6454
def iconpath(iconfilename):
65-
"""Full path to the icon file in pdfgui installation. This function
66-
should be used whenever GUI needs access to custom icons.
55+
"""Full path to the icon file in pdfgui installation.
6756
68-
iconfilename -- icon file name without any path
57+
This function should be used whenever GUI needs access to custom
58+
icons.
6959
70-
Return string.
60+
Parameters
61+
----------
62+
iconfilename : str
63+
The icon file name without any path.
64+
65+
Returns
66+
-------
67+
str
68+
The full path to the icon file.
7169
"""
72-
rv = os.path.join(APPDATADIR, "icons", iconfilename)
73-
assert os.path.isfile(rv), "icon file does not exist"
74-
return rv
70+
rv = APPDATADIR / "icons" / iconfilename
71+
assert rv.is_file(), "icon file does not exist"
72+
return str(rv)
7573

7674

7775
# options and arguments passed on command line
7876
cmdopts = []
7977
cmdargs = []
8078

8179
# debugging options:
82-
8380
dbopts = debugoptions.DebugOptions()
8481

8582
# End of file

0 commit comments

Comments
 (0)