Skip to content

Commit

Permalink
Merge pull request #100 from diffpy/next
Browse files Browse the repository at this point in the history
v2.0.3
  • Loading branch information
dragonyanglong authored May 19, 2023
2 parents 7c2aef5 + a1712a1 commit c9dcb68
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 92 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Notable differences from version 1.1.2.

## Version 2.0.2 – 2023-05-14
## Version 2.0.3 – 2023-05-18

### Added

Expand All @@ -22,3 +22,5 @@ Notable differences from version 1.1.2.
### Fixed

- Incompatible conversion between bytes and str from py2 to py3.
- The `listCtrlFiles.InsertItem` error in windows.
- Make the string parser in doping series working.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# Use this version when git data are not available, like in git zip archive.
# Update when tagging a new release.
FALLBACK_VERSION = '2.0.2'
FALLBACK_VERSION = '2.0.3'

# determine if we run with Python 3.
PY3 = (sys.version_info[0] == 3)
Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/pdfgui/gui/design/dopingseriespanel.wxg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!-- generated by wxGlade 0.9.3 on Fri Aug 9 17:38:34 2019 -->
<!-- generated by wxGlade 1.0.5 on Thu May 18 18:54:34 2023 -->

<application encoding="ISO-8859-1" for_version="3.0" header_extension=".h" indent_amount="4" indent_symbol="space" is_template="0" language="python" mark_blocks="1" option="0" overwrite="0" path="../dopingseriespanel.py" source_extension=".cpp" use_gettext="0" use_new_namespace="1">
<object class="DopingSeriesPanel" name="panel_1" base="EditTopLevelPanel">
Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/pdfgui/gui/design/temperatureseriespanel.wxg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!-- generated by wxGlade 0.9.3 on Tue Aug 13 14:48:48 2019 -->
<!-- generated by wxGlade 1.0.5 on Thu May 18 18:51:02 2023 -->

<application encoding="ISO-8859-1" for_version="3.0" header_extension=".h" indent_amount="4" indent_symbol="space" is_template="0" language="python" mark_blocks="1" option="0" overwrite="0" path="../temperatureseriespanel.py" source_extension=".cpp" use_gettext="0" use_new_namespace="1">
<object class="TemperatureSeriesPanel" name="panel_1" base="EditTopLevelPanel">
Expand Down
107 changes: 61 additions & 46 deletions src/diffpy/pdfgui/gui/dopingseriespanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,79 @@ def __init__(self, *args, **kwds):
# begin wxGlade: DopingSeriesPanel.__init__
kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL
wx.Panel.__init__(self, *args, **kwds)

sizer_1 = wx.BoxSizer(wx.VERTICAL)

self.instructionsLabel = wx.StaticText(self, wx.ID_ANY, "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.")
self.instructionsLabel.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Sans"))
sizer_1.Add(self.instructionsLabel, 0, wx.ALL | wx.EXPAND, 5)

sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
sizer_1.Add(sizer_6, 0, wx.EXPAND, 0)

self.labelBaseElement = wx.StaticText(self, wx.ID_ANY, "Base element")
sizer_6.Add(self.labelBaseElement, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

self.textCtrlBaseElement = wx.TextCtrl(self, wx.ID_ANY, "")
sizer_6.Add(self.textCtrlBaseElement, 0, wx.ALL, 5)

self.labelDopant = wx.StaticText(self, wx.ID_ANY, "Dopant")
sizer_6.Add(self.labelDopant, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

self.textCtrlDopant = wx.TextCtrl(self, wx.ID_ANY, "")
sizer_6.Add(self.textCtrlDopant, 0, wx.ALL, 5)

sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)

sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
sizer_2.Add(sizer_4, 1, wx.EXPAND, 0)

self.listCtrlFiles = AutoWidthListCtrl(self, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.LC_EDIT_LABELS | wx.LC_REPORT)
sizer_4.Add(self.listCtrlFiles, 1, wx.ALL | wx.EXPAND, 5)

sizer_5 = wx.BoxSizer(wx.VERTICAL)
sizer_4.Add(sizer_5, 0, wx.EXPAND, 0)

sizer_5.Add((0, 0), 1, 0, 0)

self.buttonUp = wx.BitmapButton(self, wx.ID_ANY, wx.NullBitmap)
self.buttonUp.SetSize(self.buttonUp.GetBestSize())
sizer_5.Add(self.buttonUp, 0, wx.ALL, 5)

self.buttonDown = wx.BitmapButton(self, wx.ID_ANY, wx.NullBitmap)
self.buttonDown.SetSize(self.buttonDown.GetBestSize())
sizer_5.Add(self.buttonDown, 0, wx.ALL, 5)

sizer_5.Add((0, 0), 1, 0, 0)

grid_sizer_1 = wx.GridSizer(1, 2, 10, 10)
sizer_1.Add(grid_sizer_1, 0, wx.ALL, 5)

self.buttonAdd = wx.Button(self, wx.ID_ADD, "Add")
grid_sizer_1.Add(self.buttonAdd, 0, 0, 0)

self.buttonDelete = wx.Button(self, wx.ID_DELETE, "Delete")
grid_sizer_1.Add(self.buttonDelete, 0, 0, 0)

self.static_line_1 = wx.StaticLine(self, wx.ID_ANY)
sizer_1.Add(self.static_line_1, 0, wx.EXPAND, 0)

sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
sizer_1.Add(sizer_3, 0, wx.EXPAND, 0)

sizer_3.Add((20, 20), 1, wx.EXPAND, 0)

self.goButton = wx.Button(self, wx.ID_OK, "OK")
sizer_3.Add(self.goButton, 0, wx.ALL, 5)

self.cancelButton = wx.Button(self, wx.ID_CANCEL, "Cancel")
sizer_3.Add(self.cancelButton, 0, wx.ALL, 5)

self.__set_properties()
self.__do_layout()
self.SetSizer(sizer_1)
sizer_1.Fit(self)

self.Layout()

self.Bind(wx.EVT_LIST_COL_CLICK, self.onColClick, self.listCtrlFiles)
self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.onEndLabelEdit, self.listCtrlFiles)
Expand All @@ -61,49 +118,6 @@ def __init__(self, *args, **kwds):
# end wxGlade
self.__customProperties()

def __set_properties(self):
# begin wxGlade: DopingSeriesPanel.__set_properties
self.instructionsLabel.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Sans"))
self.buttonUp.SetSize(self.buttonUp.GetBestSize())
self.buttonDown.SetSize(self.buttonDown.GetBestSize())
# end wxGlade

def __do_layout(self):
# begin wxGlade: DopingSeriesPanel.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
grid_sizer_1 = wx.GridSizer(1, 2, 10, 10)
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
sizer_5 = wx.BoxSizer(wx.VERTICAL)
sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
sizer_1.Add(self.instructionsLabel, 0, wx.ALL | wx.EXPAND, 5)
sizer_6.Add(self.labelBaseElement, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
sizer_6.Add(self.textCtrlBaseElement, 0, wx.ALL, 5)
sizer_6.Add(self.labelDopant, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
sizer_6.Add(self.textCtrlDopant, 0, wx.ALL, 5)
sizer_1.Add(sizer_6, 0, wx.EXPAND, 0)
sizer_4.Add(self.listCtrlFiles, 1, wx.ALL | wx.EXPAND, 5)
sizer_5.Add((0, 0), 1, 0, 0)
sizer_5.Add(self.buttonUp, 0, wx.ALL, 5)
sizer_5.Add(self.buttonDown, 0, wx.ALL, 5)
sizer_5.Add((0, 0), 1, 0, 0)
sizer_4.Add(sizer_5, 0, wx.EXPAND, 0)
sizer_2.Add(sizer_4, 1, wx.EXPAND, 0)
sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
grid_sizer_1.Add(self.buttonAdd, 0, 0, 0)
grid_sizer_1.Add(self.buttonDelete, 0, 0, 0)
sizer_1.Add(grid_sizer_1, 0, wx.ALL, 5)
sizer_1.Add(self.static_line_1, 0, wx.EXPAND, 0)
sizer_3.Add((20, 20), 1, wx.EXPAND, 0)
sizer_3.Add(self.goButton, 0, wx.ALL, 5)
sizer_3.Add(self.cancelButton, 0, wx.ALL, 5)
sizer_1.Add(sizer_3, 0, wx.EXPAND, 0)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# end wxGlade

def __customProperties(self):
"""Set the custom properties."""
self.fit = None
Expand Down Expand Up @@ -296,7 +310,8 @@ def fillList(self):
if idx == -1: idx = len(cp)
for doping, filename in self.datasets:
shortname = "..." + filename[idx:]
index = self.listCtrlFiles.InsertItem(sys.maxsize, str(doping))
# index = self.listCtrlFiles.InsertItem(sys.maxsize, str(doping)) #doesn't work for windows
index = self.listCtrlFiles.InsertItem(100000, str(doping)) #doesn't work for windows
self.listCtrlFiles.SetItem(index, 1, shortname)
return

Expand Down
3 changes: 2 additions & 1 deletion src/diffpy/pdfgui/gui/mainframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ def __customProperties(self):

# The configuration parser for getting configuration data.
# self.cP = QuotedConfigParser()
self.cP = QuotedConfigParser(strict=False) #Long try this to avoid DuplicateSectionError
# Long try this to avoid DuplicateSectionError and ParsingError
self.cP = QuotedConfigParser(strict=False, allow_no_value=True)

# Set the program mode
self.mode = "fitting"
Expand Down
90 changes: 50 additions & 40 deletions src/diffpy/pdfgui/gui/temperatureseriespanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,64 @@ def __init__(self, *args, **kwds):
# begin wxGlade: TemperatureSeriesPanel.__init__
kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL
wx.Panel.__init__(self, *args, **kwds)

sizer_1 = wx.BoxSizer(wx.VERTICAL)

self.instructionsLabel = wx.StaticText(self, wx.ID_ANY, "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.")
self.instructionsLabel.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Sans"))
sizer_1.Add(self.instructionsLabel, 0, wx.ALL | wx.EXPAND, 5)

sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)

sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
sizer_2.Add(sizer_4, 1, wx.EXPAND, 0)

self.listCtrlFiles = AutoWidthListCtrl(self, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.LC_EDIT_LABELS | wx.LC_REPORT)
sizer_4.Add(self.listCtrlFiles, 1, wx.ALL | wx.EXPAND, 5)

sizer_5 = wx.BoxSizer(wx.VERTICAL)
sizer_4.Add(sizer_5, 0, wx.EXPAND, 0)

sizer_5.Add((0, 0), 1, 0, 0)

self.buttonUp = wx.BitmapButton(self, wx.ID_ANY, wx.NullBitmap)
self.buttonUp.SetSize(self.buttonUp.GetBestSize())
sizer_5.Add(self.buttonUp, 0, wx.ALL, 5)

self.buttonDown = wx.BitmapButton(self, wx.ID_ANY, wx.NullBitmap)
self.buttonDown.SetSize(self.buttonDown.GetBestSize())
sizer_5.Add(self.buttonDown, 0, wx.ALL, 5)

sizer_5.Add((0, 0), 1, 0, 0)

grid_sizer_1 = wx.GridSizer(1, 2, 10, 10)
sizer_1.Add(grid_sizer_1, 0, wx.ALL, 5)

self.buttonAdd = wx.Button(self, wx.ID_ADD, "Add")
grid_sizer_1.Add(self.buttonAdd, 0, 0, 0)

self.buttonDelete = wx.Button(self, wx.ID_DELETE, "Delete")
grid_sizer_1.Add(self.buttonDelete, 0, 0, 0)

self.static_line_1 = wx.StaticLine(self, wx.ID_ANY)
sizer_1.Add(self.static_line_1, 0, wx.EXPAND, 0)

sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
sizer_1.Add(sizer_3, 0, wx.EXPAND, 0)

sizer_3.Add((20, 20), 1, wx.EXPAND, 0)

self.goButton = wx.Button(self, wx.ID_OK, "OK")
sizer_3.Add(self.goButton, 0, wx.ALL, 5)

self.cancelButton = wx.Button(self, wx.ID_CANCEL, "Cancel")
sizer_3.Add(self.cancelButton, 0, wx.ALL, 5)

self.SetSizer(sizer_1)
sizer_1.Fit(self)

self.__set_properties()
self.__do_layout()
self.Layout()

self.Bind(wx.EVT_LIST_COL_CLICK, self.onColClick, self.listCtrlFiles)
self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.onEndLabelEdit, self.listCtrlFiles)
Expand All @@ -58,43 +104,6 @@ def __init__(self, *args, **kwds):
self.buttonDown.SetBitmapLabel(wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN))
self.__customProperties()

def __set_properties(self):
# begin wxGlade: TemperatureSeriesPanel.__set_properties
self.instructionsLabel.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Sans"))
self.buttonUp.SetSize(self.buttonUp.GetBestSize())
self.buttonDown.SetSize(self.buttonDown.GetBestSize())
# end wxGlade

def __do_layout(self):
# begin wxGlade: TemperatureSeriesPanel.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
grid_sizer_1 = wx.GridSizer(1, 2, 10, 10)
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
sizer_5 = wx.BoxSizer(wx.VERTICAL)
sizer_1.Add(self.instructionsLabel, 0, wx.ALL | wx.EXPAND, 5)
sizer_4.Add(self.listCtrlFiles, 1, wx.ALL | wx.EXPAND, 5)
sizer_5.Add((0, 0), 1, 0, 0)
sizer_5.Add(self.buttonUp, 0, wx.ALL, 5)
sizer_5.Add(self.buttonDown, 0, wx.ALL, 5)
sizer_5.Add((0, 0), 1, 0, 0)
sizer_4.Add(sizer_5, 0, wx.EXPAND, 0)
sizer_2.Add(sizer_4, 1, wx.EXPAND, 0)
sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
grid_sizer_1.Add(self.buttonAdd, 0, 0, 0)
grid_sizer_1.Add(self.buttonDelete, 0, 0, 0)
sizer_1.Add(grid_sizer_1, 0, wx.ALL, 5)
sizer_1.Add(self.static_line_1, 0, wx.EXPAND, 0)
sizer_3.Add((20, 20), 1, wx.EXPAND, 0)
sizer_3.Add(self.goButton, 0, wx.ALL, 5)
sizer_3.Add(self.cancelButton, 0, wx.ALL, 5)
sizer_1.Add(sizer_3, 0, wx.EXPAND, 0)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# end wxGlade

def __customProperties(self):
"""Set the custom properties."""
self.fit = None
Expand Down Expand Up @@ -283,7 +292,8 @@ def fillList(self):
if idx == -1: idx = len(cp)
for temperature, filename in self.datasets:
shortname = "..." + filename[idx:]
index = self.listCtrlFiles.InsertItem(sys.maxsize, str(temperature))
# index = self.listCtrlFiles.InsertItem(sys.maxsize, str(temperature)) #doesn't work for windows
index = self.listCtrlFiles.InsertItem(100000, str(temperature))
self.listCtrlFiles.SetItem(index, 1, shortname)
return

Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/pdfgui/gui/wxextensions/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def OnChar(self, event):
event.Skip()
return

if self.flag == ALPHA_ONLY and chr(key) in string.letters:
if self.flag == ALPHA_ONLY and chr(key) in string.ascii_letters:
event.Skip()
return

Expand Down

0 comments on commit c9dcb68

Please sign in to comment.