From 0763f01c7ce7680df0ef0f22d00e0173d0eae43d Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Thu, 26 Mar 2026 22:06:03 -0400 Subject: [PATCH 1/5] fix:pdfgui functionality fix after skpkg --- news/fix-gui-functionality.rst | 23 ++++++++++++ pyproject.toml | 2 +- src/diffpy/pdfgui/gui/aboutdialog.py | 5 ++- src/diffpy/pdfgui/gui/pdfguiglobals.py | 49 ++++++++++++-------------- 4 files changed, 51 insertions(+), 28 deletions(-) create mode 100644 news/fix-gui-functionality.rst diff --git a/news/fix-gui-functionality.rst b/news/fix-gui-functionality.rst new file mode 100644 index 00000000..943481e6 --- /dev/null +++ b/news/fix-gui-functionality.rst @@ -0,0 +1,23 @@ +**Added:** + +* No News Added: hot-fix on gui-functionality + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index 01cc3a5c..b366a894 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ exclude = [] # exclude packages matching these glob patterns (empty by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default) [project.scripts] -diffpy-pdfgui = "diffpy.pdfgui.app:main" +pdfgui = "diffpy.pdfgui.applications.pdfgui:main" [tool.setuptools.dynamic] dependencies = {file = ["requirements/pip.txt"]} diff --git a/src/diffpy/pdfgui/gui/aboutdialog.py b/src/diffpy/pdfgui/gui/aboutdialog.py index 821bddd0..eb06f195 100644 --- a/src/diffpy/pdfgui/gui/aboutdialog.py +++ b/src/diffpy/pdfgui/gui/aboutdialog.py @@ -16,12 +16,15 @@ ############################################################################## import random +from datetime import datetime, timezone import wx import wx.lib.agw.hyperlink from diffpy.pdfgui.gui.pdfguiglobals import iconpath -from diffpy.pdfgui.version import __date__, __version__ +from diffpy.pdfgui.version import __version__ + +__date__ = datetime.now(timezone.utc).date().isoformat() _acknowledgement = """\ This software was developed by the Billinge-group as part of the Distributed diff --git a/src/diffpy/pdfgui/gui/pdfguiglobals.py b/src/diffpy/pdfgui/gui/pdfguiglobals.py index 5580dca5..5dc74ca6 100644 --- a/src/diffpy/pdfgui/gui/pdfguiglobals.py +++ b/src/diffpy/pdfgui/gui/pdfguiglobals.py @@ -14,8 +14,8 @@ ############################################################################## """This module contains global parameters needed by PDFgui.""" -import os.path from importlib.resources import files +from pathlib import Path from diffpy.pdfgui.gui import debugoptions @@ -24,34 +24,24 @@ # Maximum number of files to be remembered MAXMRU = 5 # The location of the configuration file -configfilename = os.path.expanduser("~/.pdfgui_py3.cfg") +configfilename = Path.home() / ".pdfgui_py3.cfg" # Project modification flag isAltered = False -# Resolve APPDATADIR base path to application data files. -try: - _mydir = os.path.abspath(str(files(__name__))) -except TypeError: # For Python < 3.12 - _mydir = os.path.abspath(os.path.dirname(__file__)) +_mydir = Path(str(files(__name__))).resolve() -_upbasedir = os.path.normpath(_mydir + "/../../..") -_development_mode = os.path.basename(_upbasedir) == "src" and os.path.isfile( - os.path.join(_upbasedir, "../pyproject.toml") -) +_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" -# pavol -# APPDATADIR = (os.path.dirname(_upbasedir) if _development_mode -# else str(files(_req))) -# long if _development_mode: - APPDATADIR = os.path.dirname(_mydir) + APPDATADIR = _mydir.parent else: - APPDATADIR = str(files(_req)) + APPDATADIR = Path(str(files(_req))).resolve() -APPDATADIR = os.path.abspath(APPDATADIR) +APPDATADIR = APPDATADIR.resolve() # Location of the HTML manual docMainFile = "https://diffpy.github.io/diffpy.pdfgui/manual.html" @@ -62,16 +52,24 @@ def iconpath(iconfilename): - """Full path to the icon file in pdfgui installation. This function - should be used whenever GUI needs access to custom icons. + """Full path to the icon file in pdfgui installation. - iconfilename -- icon file name without any path + This function should be used whenever GUI needs access to custom + icons. - Return string. + Parameters + ---------- + iconfilename : str + The icon file name without any path. + + Returns + ------- + str + The full path to the icon file. """ - rv = os.path.join(APPDATADIR, "icons", iconfilename) - assert os.path.isfile(rv), "icon file does not exist" - return rv + rv = APPDATADIR / "icons" / iconfilename + assert rv.is_file(), "icon file does not exist" + return str(rv) # options and arguments passed on command line @@ -79,7 +77,6 @@ def iconpath(iconfilename): cmdargs = [] # debugging options: - dbopts = debugoptions.DebugOptions() # End of file From dfa6be60a037e22f597c6d8cad98780e114e9056 Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Mon, 30 Mar 2026 15:07:36 -0400 Subject: [PATCH 2/5] fix: fix link fits with string input with error message pops --- news/fix-gui-functionality.rst | 4 ++-- src/diffpy/pdfgui/gui/parameterspanel.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/news/fix-gui-functionality.rst b/news/fix-gui-functionality.rst index 943481e6..4fa49e2b 100644 --- a/news/fix-gui-functionality.rst +++ b/news/fix-gui-functionality.rst @@ -1,6 +1,6 @@ **Added:** -* No News Added: hot-fix on gui-functionality +* **Changed:** @@ -16,7 +16,7 @@ **Fixed:** -* +* Fixed linked the fits with string input **Security:** diff --git a/src/diffpy/pdfgui/gui/parameterspanel.py b/src/diffpy/pdfgui/gui/parameterspanel.py index 6a300f7a..c482e362 100644 --- a/src/diffpy/pdfgui/gui/parameterspanel.py +++ b/src/diffpy/pdfgui/gui/parameterspanel.py @@ -250,7 +250,10 @@ def applyCellChange(self, row, col, value): temp = self.parameters[key].initialValue() if temp != value: self.parameters[key].setInitial(value) - self.grid_parameters.SetCellValue(row, 0, str(float(value))) + if value is int or value is float: + self.grid_parameters.SetCellValue(row, 0, str(float(value))) + else: + self.grid_parameters.SetCellValue(row, 0, value) self.mainFrame.needsSave() elif col == 1: # flag "fixed" From 8b8ede68e98351ce3b9efa3a8bfd800397478482 Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Mon, 30 Mar 2026 18:38:15 -0400 Subject: [PATCH 3/5] chore: retrigger the workflow run after releasing pdffit2 --- news/fix-gui-functionality.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/fix-gui-functionality.rst b/news/fix-gui-functionality.rst index 4fa49e2b..668a28b3 100644 --- a/news/fix-gui-functionality.rst +++ b/news/fix-gui-functionality.rst @@ -16,7 +16,7 @@ **Fixed:** -* Fixed linked the fits with string input +* Fixed linked fits with string input **Security:** From 293b53188ee73d627add0e39e61bacc36c178685 Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Mon, 30 Mar 2026 18:49:53 -0400 Subject: [PATCH 4/5] chore: revert incorrect fix --- news/fix-gui-functionality.rst | 4 ++-- src/diffpy/pdfgui/gui/parameterspanel.py | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/news/fix-gui-functionality.rst b/news/fix-gui-functionality.rst index 668a28b3..e12aac0d 100644 --- a/news/fix-gui-functionality.rst +++ b/news/fix-gui-functionality.rst @@ -1,6 +1,6 @@ **Added:** -* +* No News Added: fix gui functionality after skpkg **Changed:** @@ -16,7 +16,7 @@ **Fixed:** -* Fixed linked fits with string input +* **Security:** diff --git a/src/diffpy/pdfgui/gui/parameterspanel.py b/src/diffpy/pdfgui/gui/parameterspanel.py index c482e362..6a300f7a 100644 --- a/src/diffpy/pdfgui/gui/parameterspanel.py +++ b/src/diffpy/pdfgui/gui/parameterspanel.py @@ -250,10 +250,7 @@ def applyCellChange(self, row, col, value): temp = self.parameters[key].initialValue() if temp != value: self.parameters[key].setInitial(value) - if value is int or value is float: - self.grid_parameters.SetCellValue(row, 0, str(float(value))) - else: - self.grid_parameters.SetCellValue(row, 0, value) + self.grid_parameters.SetCellValue(row, 0, str(float(value))) self.mainFrame.needsSave() elif col == 1: # flag "fixed" From a6c09b3ccbec6ccf7b6af3726b865932578f86e5 Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Fri, 3 Apr 2026 11:14:10 -0400 Subject: [PATCH 5/5] build: change headless to true to enable virtual display --- .github/workflows/matrix-and-codecov.yml | 2 +- .github/workflows/tests-on-pr.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/matrix-and-codecov.yml b/.github/workflows/matrix-and-codecov.yml index 51b39ff5..56723f91 100644 --- a/.github/workflows/matrix-and-codecov.yml +++ b/.github/workflows/matrix-and-codecov.yml @@ -16,6 +16,6 @@ jobs: with: project: diffpy.pdfgui c_extension: false - headless: false + headless: true secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml index 156c3d23..920edafd 100644 --- a/.github/workflows/tests-on-pr.yml +++ b/.github/workflows/tests-on-pr.yml @@ -10,6 +10,6 @@ jobs: with: project: diffpy.pdfgui c_extension: false - headless: false + headless: true secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}