diff --git a/src/diffpy/pdfgui/doc/manual/fixHTMLCode.py b/src/diffpy/pdfgui/doc/manual/fixHTMLCode.py index 0e410070..def749b5 100644 --- a/src/diffpy/pdfgui/doc/manual/fixHTMLCode.py +++ b/src/diffpy/pdfgui/doc/manual/fixHTMLCode.py @@ -1,4 +1,7 @@ #!/usr/bin/python +import os +import re +import sys """Replace all equation marks in HTML file with tag to display corresponding PNG file. This assumes PNG files are in correct sequence. @@ -16,10 +19,6 @@ ############################################################################## # business -import os -import re -import sys - eqcnt = 0 diff --git a/src/diffpy/pdfgui/gui/aboutdialog.py b/src/diffpy/pdfgui/gui/aboutdialog.py index 37bd30c7..c9e8a556 100644 --- a/src/diffpy/pdfgui/gui/aboutdialog.py +++ b/src/diffpy/pdfgui/gui/aboutdialog.py @@ -40,7 +40,7 @@ computer programs for studying nanostructure in crystals, J. Phys.: Condens. Matter 19, 335219 (2007).""" -_copyright = "(c) 2005-{year},".format(year=__date__[:4]) +_copyright = "(c) 2005-2024-{year},".format(year=__date__[:4]) _homepage = "https://www.diffpy.org" @@ -233,7 +233,7 @@ def onColumbiaLogo(self, event): # wxGlade: DialogAbout. # end of class DialogAbout -##### testing code ########################################################### +# testing code ########################################################### if __name__ == "__main__": app = wx.App() diff --git a/src/diffpy/pdfgui/gui/mainframe.py b/src/diffpy/pdfgui/gui/mainframe.py index b7e32efc..41e74e83 100644 --- a/src/diffpy/pdfgui/gui/mainframe.py +++ b/src/diffpy/pdfgui/gui/mainframe.py @@ -4,7 +4,7 @@ # # PDFgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2006 trustees of the Michigan State University. +# (c) 2006-2024 trustees of the Michigan State University. # All rights reserved. # # File coded by: Chris Farrow @@ -758,21 +758,21 @@ def __menuBindings(self): # For recent items self.Bind(wx.EVT_MENU_RANGE, self.onMRUFile, id=wx.ID_FILE1, id2=wx.ID_FILE5) - ## Edit Menu + # Edit Menu self.Bind(wx.EVT_MENU, self.onDelete, id=self.deleteId) self.Bind(wx.EVT_MENU, self.onCopy, id=self.copyId) self.Bind(wx.EVT_MENU, self.onPaste, id=self.pasteId) self.Bind(wx.EVT_MENU, self.onPasteLink, id=self.pasteLinkId) self.Bind(wx.EVT_MENU, self.onPreferences, self.prefItem) - ## View menu + # View menu self.Bind(wx.EVT_MENU, self.onDefaultLayout, self.defaultLayoutItem) self.Bind(wx.EVT_MENU, self.onShowFit, self.showFitItem) self.Bind(wx.EVT_MENU, self.onShowPlot, self.showPlotItem) self.Bind(wx.EVT_MENU, self.onShowOutput, self.showOutputItem) self.Bind(wx.EVT_MENU, self.onShowJournal, self.showJournalItem) - ## Fits Menu + # Fits Menu self.Bind(wx.EVT_MENU, self.onNewFit, id=self.newFitId) self.Bind(wx.EVT_MENU, self.onRun, id=self.runFitId) self.Bind(wx.EVT_MENU, self.onStop, id=self.stopFitId) @@ -780,9 +780,9 @@ def __menuBindings(self): self.Bind(wx.EVT_MENU, self.onRSeries, self.rseriesItem) self.Bind(wx.EVT_MENU, self.onTSeries, self.tseriesItem) self.Bind(wx.EVT_MENU, self.onDSeries, self.dseriesItem) - ## Macros are inserted individually + # Macros are inserted individually - ## Phases Menu + # Phases Menu self.Bind(wx.EVT_MENU, self.onInsPhase, id=self.newPhaseId) self.Bind(wx.EVT_MENU, self.onPrintBL, id=self.printBLId) self.Bind(wx.EVT_MENU, self.onPrintBA, id=self.printBAId) @@ -791,16 +791,16 @@ def __menuBindings(self): self.Bind(wx.EVT_MENU, self.onPlotIStruct, id=self.plotIStructId) self.Bind(wx.EVT_MENU, self.onPlotFStruct, id=self.plotFStructId) - ## Data Menu + # Data Menu self.Bind(wx.EVT_MENU, self.onInsData, id=self.newDataId) self.Bind(wx.EVT_MENU, self.onExportPDF, id=self.exportFitPDFId) - ## Calculations Menu + # Calculations Menu self.Bind(wx.EVT_MENU, self.onInsCalc, id=self.newCalcId) self.Bind(wx.EVT_MENU, self.onRun, id=self.runCalcId) self.Bind(wx.EVT_MENU, self.onSaveCalc, id=self.exportCalcPDFId) - ## Help Menu + # Help Menu self.Bind(wx.EVT_MENU, self.onDocumentation, self.docItem) self.Bind(wx.EVT_MENU, self.onAbout, self.aboutItem) self.Bind(wx.EVT_MENU, self.onRequest, self.requestItem) @@ -1529,11 +1529,11 @@ def disableSharedMenuItems(self, menu): noPhases = False if node: phases = self.treeCtrlMain.GetPhases(node) - ## No insert calculation if there are no phases + # No insert calculation if there are no phases if len(phases) == 0: noPhases = True - ## No insert calculation if there are no phases + # No insert calculation if there are no phases if noPhases: menu.Enable(self.newCalcId, False) @@ -1544,7 +1544,7 @@ def disableSharedMenuItems(self, menu): clipbranchtype = None cdata = self.treeCtrlMain.GetClipboard() - ## No paste if nothing in the clipboard + # No paste if nothing in the clipboard if cdata is None: menu.Enable(self.pasteId, False) menu.Enable(self.pasteLinkId, False) @@ -1573,7 +1573,7 @@ def disableSharedMenuItems(self, menu): menu.SetLabel(self.pasteId, pastetext) # Disable certain entries based upon where we clicked. - ## No copy, paste, or insert on multiple items. + # No copy, paste, or insert on multiple items. if len(selections) > 1: menu.Enable(self.copyId, False) menu.Enable(self.pasteId, False) @@ -1581,7 +1581,7 @@ def disableSharedMenuItems(self, menu): menu.Enable(self.newDataId, False) menu.Enable(self.newPhaseId, False) menu.Enable(self.newCalcId, False) - ## Disallow paste of fit if no items selected + # Disallow paste of fit if no items selected elif not selections: menu.Enable(self.copyId, False) menu.Enable(self.deleteId, False) @@ -1708,7 +1708,7 @@ def disableMainMenuItems(self): if not cdata.Gcalc: menu.Enable(self.exportFitPDFId, False) - ## Check the run/stop status. + # Check the run/stop status. if self.runningDict: menu.Enable(self.newId, False) menu.Enable(self.runCalcId, False) @@ -1756,7 +1756,7 @@ def disableMainMenuItems(self): return # Shared menu items - ## The bulk of the code for these methods is in the FitTree class. + # The bulk of the code for these methods is in the FitTree class. def onNewFit(self, event): """Start a new fit tree. @@ -2377,7 +2377,14 @@ def onExportNewStruct(self, event): # branchname = self.treeCtrlMain.GetBranchName(node) name = self.treeCtrlMain.GetItemText(node) basename = ".".join(name.split(".")[:-1]) or name - matchstring = "PDFfit structure file (*.stru)|*.stru|Crystallographic Information File (*.cif)|*.cif|Protein Data Bank file (*.pdb)|*.pdb|Labeled coordinate file (*.xyz)|*.xyz|Raw corrdinate file (*.xyz)|*.xyz|AtomEye configuration file|*" + matchstring = ( + "PDFfit structure file (*.stru)|*.stru|" + "Crystallographic Information File (*.cif)|*.cif|" + "Protein Data Bank file (*.pdb)|*.pdb|" + "Labeled coordinate file (*.xyz)|*.xyz|" + "Raw coordinate file (*.xyz)|*.xyz|" + "AtomEye configuration file|*" + ) d = wx.FileDialog( None, "Save as...", @@ -2416,7 +2423,14 @@ def onExportStruct(self, event): # branchname = self.treeCtrlMain.GetBranchName(node) name = self.treeCtrlMain.GetItemText(node) basename = ".".join(name.split(".")[:-1]) or name - matchstring = "PDFfit structure file (*.stru)|*.stru|Crystallographic Information File (*.cif)|*.cif|Protein Data Bank file (*.pdb)|*.pdb|Labeled coordinate file (*.xyz)|*.xyz|Raw corrdinate file (*.xyz)|*.xyz|AtomEye configuration file|*" + matchstring = ( + "PDFfit structure file (*.stru)|*.stru|" + "Crystallographic Information File (*.cif)|*.cif|" + "Protein Data Bank file (*.pdb)|*.pdb|" + "Labeled coordinate file (*.xyz)|*.xyz|" + "Raw coordinate file (*.xyz)|*.xyz|" + "AtomEye configuration file|*" + ) d = wx.FileDialog( None, "Save as...", diff --git a/src/diffpy/pdfgui/gui/parameterspanel.py b/src/diffpy/pdfgui/gui/parameterspanel.py index fc375704..064e3d3f 100644 --- a/src/diffpy/pdfgui/gui/parameterspanel.py +++ b/src/diffpy/pdfgui/gui/parameterspanel.py @@ -4,7 +4,7 @@ # # PDFgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2006 trustees of the Michigan State University. +# (c) 2006-2024 trustees of the Michigan State University. # All rights reserved. # # File coded by: Dmitriy Bryndin, Chris Farrow @@ -116,7 +116,7 @@ def refresh(self): nRows = len(self.parameters) - ### update the grid + # update the grid # remove all rows and create new ones self.grid_parameters.BeginBatch() gridrows = self.grid_parameters.GetNumberRows() @@ -297,7 +297,7 @@ def popupMenu(self, window, x, y): menu.Destroy() return - ##### Popup menu events ################################################## + # Popup menu events ################################################## def onPopupFill(self, event): """Fills cells selected in the grid with a new value""" @@ -402,7 +402,7 @@ def onPopupRenameParameters(self, event): event.Skip() return - ##### end of Popup menu events ########################################### + # end of Popup menu events ########################################### def onApplyParameters(self, event): # wxGlade: ParametersPanel. self.fit.applyParameters() @@ -439,7 +439,7 @@ def fillCells(self, indices, value): # end of class ParametersPanel -##### testing code ############################################################ +# testing code ############################################################ if __name__ == "__main__": class MyFrame(wx.Frame): @@ -481,4 +481,4 @@ def onInit(self): app = MyApp(0) app.MainLoop() -##### end of testing code ##################################################### +# end of testing code ##################################################### diff --git a/src/diffpy/pdfgui/gui/pdfguiglobals.py b/src/diffpy/pdfgui/gui/pdfguiglobals.py index b19a7ddb..7a5164f6 100644 --- a/src/diffpy/pdfgui/gui/pdfguiglobals.py +++ b/src/diffpy/pdfgui/gui/pdfguiglobals.py @@ -3,7 +3,7 @@ # # PDFgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2006 trustees of the Michigan State University. +# (c) 2006-2024 trustees of the Michigan State University. # All rights reserved. # # File coded by: Pavol Juhas @@ -19,6 +19,8 @@ from pkg_resources import Requirement, resource_filename +from diffpy.pdfgui.gui import debugoptions + # Name of the program name = "PDFgui" # Maximum number of files to be remembered @@ -76,7 +78,6 @@ def iconpath(iconfilename): cmdargs = [] # debugging options: -from diffpy.pdfgui.gui import debugoptions dbopts = debugoptions.DebugOptions() diff --git a/src/diffpy/pdfgui/gui/tooltips.py b/src/diffpy/pdfgui/gui/tooltips.py index 095b4ffa..4aa9a0f5 100644 --- a/src/diffpy/pdfgui/gui/tooltips.py +++ b/src/diffpy/pdfgui/gui/tooltips.py @@ -3,7 +3,7 @@ # # PDFgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2007 trustees of the Michigan State University. +# (c) 2007-2024 trustees of the Michigan State University. # All rights reserved. # # File coded by: Dmitriy Bryndin @@ -17,9 +17,12 @@ """ +def isalias(s): + return s[1:-1] and s[:: len(s) - 1] == "{}" and s[1:-1].replace("_", "").isalnum() + + def _expand_tooltip_aliases(ttps): "Replace aliased equivalent values {other} in tooltip strings." - isalias = lambda s: (s[1:-1] and s[:: len(s) - 1] == "{}" and s[1:-1].replace("_", "").isalnum()) for n, t in list(ttps.items()): if not isalias(t): continue @@ -79,7 +82,10 @@ def _expand_tooltip_aliases(ttps): dopingseriespanel = { - # 'instructionsLabel' : '', # StaticText "Select a fit from the tree on the left then add datasets and assign\ndoping elements and values below. If you have not set up a fit to be\nthe template for the series, hit cancel and rerun this macro once a\nfit has been created." + # 'instructionsLabel' : '', # StaticText "Select a fit from the tree on the left then add + # datasets and assign\ndoping elements and values below. If you + # have not set up a fit to be\nthe template for the series, hit + # cancel and rerun this macro once a\nfit has been created." # 'labelBaseElement' : '', # StaticText "Base element" # 'textCtrlBaseElement' : '', # TextCtrl # 'labelDopant' : '', # StaticText "Dopant" @@ -175,7 +181,9 @@ def _expand_tooltip_aliases(ttps): temperatureseriespanel = { - # 'instructionsLabel' : '', # StaticText "Select a fit from the tree on the left then add datasets and assign\ntemperatues below. If you have not set up a fit to be the template\nfor the series, hit cancel and rerun this macro once a fit has been\ncreated." + # 'instructionsLabel' : '', # StaticText "Select a fit from the tree on the left + # then add datasets and assign\ntemperatues below. If you have not set up a fit to + # be the template\nfor the series, hit cancel and rerun this macro once a fit has been\ncreated." "listCtrlFiles": "Click header to sort by temperature", # AutoWidthListCtrl # 'buttonUp' : '', # BitmapButton # 'buttonDown' : '', # BitmapButton diff --git a/src/diffpy/pdfgui/gui/windowperspective.py b/src/diffpy/pdfgui/gui/windowperspective.py index 838be3ca..ed54d370 100644 --- a/src/diffpy/pdfgui/gui/windowperspective.py +++ b/src/diffpy/pdfgui/gui/windowperspective.py @@ -3,7 +3,7 @@ # # PDFgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2007 trustees of the Michigan State University. +# (c) 2007-2024 trustees of the Michigan State University. # All rights reserved. # # File coded by: Chris Farrow @@ -15,4 +15,4 @@ """This contains the default perspective for the gui window.""" -default = "layout2|name=dseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=calculation;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=welcome;caption=;state=768;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=adddata;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=serverconfig;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=addphase;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=blank;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=phase;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=dataset;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=preferences;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=fit;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=rseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=tseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPanel;caption=PDFfit2 Output;state=10487804;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=40;minw=200;minh=40;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=treeCtrlMain;caption=Fit Tree;state=10487804;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=200;besth=100;minw=200;minh=40;maxw=-1;maxh=-1;floatx=471;floaty=730;floatw=208;floath=124|name=plotPanel;caption=Plot Control;state=10487804;dir=4;layer=0;row=0;pos=1;prop=100000;bestw=200;besth=250;minw=200;minh=150;maxw=-1;maxh=-1;floatx=337;floaty=393;floatw=208;floath=274|name=journalPanel;caption=Project Journal;state=10487807;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=450;besth=450;minw=200;minh=200;maxw=-1;maxh=-1;floatx=393;floaty=113;floatw=450;floath=450|dock_size(3,0,0)=59|dock_size(4,0,0)=202|dock_size(5,0,0)=362|" +default = "layout2|name=dseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=calculation;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=welcome;caption=;state=768;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=adddata;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=serverconfig;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=addphase;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=blank;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=phase;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=dataset;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=preferences;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=fit;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=rseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=tseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPanel;caption=PDFfit2 Output;state=10487804;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=40;minw=200;minh=40;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=treeCtrlMain;caption=Fit Tree;state=10487804;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=200;besth=100;minw=200;minh=40;maxw=-1;maxh=-1;floatx=471;floaty=730;floatw=208;floath=124|name=plotPanel;caption=Plot Control;state=10487804;dir=4;layer=0;row=0;pos=1;prop=100000;bestw=200;besth=250;minw=200;minh=150;maxw=-1;maxh=-1;floatx=337;floaty=393;floatw=208;floath=274|name=journalPanel;caption=Project Journal;state=10487807;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=450;besth=450;minw=200;minh=200;maxw=-1;maxh=-1;floatx=393;floaty=113;floatw=450;floath=450|dock_size(3,0,0)=59|dock_size(4,0,0)=202|dock_size(5,0,0)=362|" # noqa: E501 diff --git a/src/diffpy/pdfgui/gui/wxextensions/validators.py b/src/diffpy/pdfgui/gui/wxextensions/validators.py index 5a09ffff..9cbd4be3 100644 --- a/src/diffpy/pdfgui/gui/wxextensions/validators.py +++ b/src/diffpy/pdfgui/gui/wxextensions/validators.py @@ -1,9 +1,14 @@ #!/usr/bin/env python + +import string + +import wx + ############################################################################## # # wxextensions by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2006 trustees of the Michigan State University. +# (c) 2006-2024 trustees of the Michigan State University. # All rights reserved. # # File coded by: Chris Farrow @@ -23,10 +28,6 @@ DIGIT_ONLY = 2 FLOAT_ONLY = 3 -import string - -import wx - class TextValidator(wx.Validator): """This validator is designed to check text input for wxTextCtrls. (It might diff --git a/src/diffpy/pdfgui/tests/testaboutdialog.py b/src/diffpy/pdfgui/tests/testaboutdialog.py index 1123d46d..28f4bdc4 100644 --- a/src/diffpy/pdfgui/tests/testaboutdialog.py +++ b/src/diffpy/pdfgui/tests/testaboutdialog.py @@ -2,7 +2,7 @@ ############################################################################## # # diffpy.pdfgui Complex Modeling Initiative -# (c) 2019 Brookhaven Science Associates, +# (c) 2019-2024 Brookhaven Science Associates, # Brookhaven National Laboratory. # All rights reserved. # @@ -43,11 +43,13 @@ def _clickbutton(self, button): self.dialog.ProcessEvent(e) return + def set_url(self, u): + setattr(self, "url", u) + def test_LogoClicks(self): "Check handling of clicks on various logos" d = self.dialog - stealurl = lambda u: setattr(self, "url", u) - with overridewebbrowser(stealurl): + with overridewebbrowser(self.set_url): self._clickbutton(d.bitmap_button_nsf) self.assertTrue(self.url.endswith("www.nsf.gov")) self._clickbutton(d.bitmap_button_danse)