Skip to content

Commit c3e92b8

Browse files
authored
Merge pull request #139 from AdvancedPhotonSource/kvec_isodistort_zyp
use isodistort web site for k-vector searching
2 parents 39cffed + e36cb33 commit c3e92b8

File tree

6 files changed

+14830
-91
lines changed

6 files changed

+14830
-91
lines changed

GSASII/GSASIIphsGUI.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,7 +1645,7 @@ def OnPhaseName(event):
16451645
'called when the phase name is changed in "General"'
16461646
event.Skip()
16471647
newName = NameTxt.GetValue().strip()
1648-
renamePhaseName(Item,generalData,newName)
1648+
renamePhaseName(G2frame,data,Item,generalData,newName)
16491649
NameTxt.SetValue(newName)
16501650

16511651
def OnPhaseType(event):
@@ -5774,7 +5774,7 @@ def OnReplacePhase(event):
57745774
newname = rd.Phase['General']['Name']
57755775
data['General']['Name'] = phsnam
57765776
# rename phase to new name from file
5777-
renamePhaseName(G2frame.PickId, data['General'],newname)
5777+
renamePhaseName(G2frame,data,G2frame.PickId, data['General'],newname)
57785778
# force a reload of current tree item
57795779
G2frame.PickIdText = []
57805780
wx.CallAfter(G2gd.SelectDataTreeItem,G2frame,G2frame.PickId)
@@ -13265,39 +13265,6 @@ def rbKeyPress(event):
1326513265
G2frame.Raise()
1326613266
return
1326713267

13268-
def renamePhaseName(phaseItem,generalData,newName):
13269-
'''Called to rename the phase. Updates the tree and items that
13270-
reference the file name.
13271-
'''
13272-
oldName = generalData['Name']
13273-
phaseRIdList,usedHistograms = G2frame.GetPhaseInfofromTree()
13274-
phaseNameList = usedHistograms.keys() # phase names in use
13275-
if newName and newName != oldName:
13276-
newName = G2obj.MakeUniqueLabel(newName,list(phaseNameList))
13277-
generalData['Name'] = newName
13278-
G2frame.G2plotNB.Rename(oldName,generalData['Name'])
13279-
G2frame.GPXtree.SetItemText(phaseItem,generalData['Name'])
13280-
# change phase name key in Reflection Lists for each histogram
13281-
for hist in data['Histograms']:
13282-
ht = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,hist)
13283-
rt = G2gd.GetGPXtreeItemId(G2frame,ht,'Reflection Lists')
13284-
if not rt: continue
13285-
RfList = G2frame.GPXtree.GetItemPyData(rt)
13286-
if oldName not in RfList:
13287-
print('Warning: '+oldName+' not in Reflection List for '+
13288-
hist)
13289-
continue
13290-
RfList[newName] = RfList[oldName]
13291-
del RfList[oldName]
13292-
# rename Restraints
13293-
resId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,'Restraints')
13294-
Restraints = G2frame.GPXtree.GetItemPyData(resId)
13295-
i = G2gd.GetGPXtreeItemId(G2frame,resId,oldName)
13296-
if i: G2frame.GPXtree.SetItemText(i,newName)
13297-
if len(Restraints) and oldName in Restraints:
13298-
Restraints[newName] = Restraints[oldName]
13299-
del Restraints[oldName]
13300-
1330113268
#### UpdatePhaseData execution starts here
1330213269
# make sure that the phase menu bars get created before selecting
1330313270
# any (this will only be true on the first call to UpdatePhaseData)
@@ -13653,3 +13620,36 @@ def saveIsoNewPhase(G2frame,phData,newPhase,orgFilName):
1365313620
G2frame.GSASprojectfile = f'{s[0]}_{num}.gpx'
1365413621
G2IO.ProjFileSave(G2frame)
1365513622
return G2frame.GSASprojectfile
13623+
13624+
def renamePhaseName(G2frame,data,phaseItem,generalData,newName):
13625+
'''Called to rename the phase. Updates the tree and items that
13626+
reference the file name.
13627+
'''
13628+
oldName = generalData['Name']
13629+
phaseRIdList,usedHistograms = G2frame.GetPhaseInfofromTree()
13630+
phaseNameList = usedHistograms.keys() # phase names in use
13631+
if newName and newName != oldName:
13632+
newName = G2obj.MakeUniqueLabel(newName,list(phaseNameList))
13633+
generalData['Name'] = newName
13634+
G2frame.G2plotNB.Rename(oldName,generalData['Name'])
13635+
G2frame.GPXtree.SetItemText(phaseItem,generalData['Name'])
13636+
# change phase name key in Reflection Lists for each histogram
13637+
for hist in data['Histograms']:
13638+
ht = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,hist)
13639+
rt = G2gd.GetGPXtreeItemId(G2frame,ht,'Reflection Lists')
13640+
if not rt: continue
13641+
RfList = G2frame.GPXtree.GetItemPyData(rt)
13642+
if oldName not in RfList:
13643+
print('Warning: '+oldName+' not in Reflection List for '+
13644+
hist)
13645+
continue
13646+
RfList[newName] = RfList[oldName]
13647+
del RfList[oldName]
13648+
# rename Restraints
13649+
resId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,'Restraints')
13650+
Restraints = G2frame.GPXtree.GetItemPyData(resId)
13651+
i = G2gd.GetGPXtreeItemId(G2frame,resId,oldName)
13652+
if i: G2frame.GPXtree.SetItemText(i,newName)
13653+
if len(Restraints) and oldName in Restraints:
13654+
Restraints[newName] = Restraints[oldName]
13655+
del Restraints[oldName]

0 commit comments

Comments
 (0)