Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions news/fix-gui-functionality.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* No News Added: hot-fix on gui-functionality

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}
Expand Down
5 changes: 4 additions & 1 deletion src/diffpy/pdfgui/gui/aboutdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
49 changes: 23 additions & 26 deletions src/diffpy/pdfgui/gui/pdfguiglobals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
Expand All @@ -62,24 +52,31 @@


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
cmdopts = []
cmdargs = []

# debugging options:

dbopts = debugoptions.DebugOptions()

# End of file
Loading