@@ -199,7 +199,7 @@ def OnPlotKeyPress(event):
199199 try : #one way to check if key stroke will work on plot
200200 Parms ,Parms2 = G2frame .GPXtree .GetItemPyData (G2gd .GetGPXtreeItemId (G2frame ,G2frame .PatternId , 'Instrument Parameters' ))
201201 except TypeError :
202- G2frame .G2plotNB .status .SetStatusText ('Select ' + plottype + ' pattern first' ,1 )
202+ G2frame .G2plotNB .status .SetStatusText (f 'Select { plottype } pattern first' ,1 )
203203 return
204204 newPlot = False
205205 if event .key == 'w' :
@@ -1602,6 +1602,19 @@ def onPartialConfig(event):
16021602 for i in 'Obs_color' ,'Calc_color' ,'Diff_color' ,'Bkg_color' :
16031603 pwdrCol [i ] = '#' + GSASIIpath .GetConfigValue (i ,getDefault = True )
16041604
1605+ groupName = None
1606+ groupDict = {}
1607+ if plotType == 'GROUP' :
1608+ groupName = G2frame .groupName # set in GSASIIgroupGUI.UpdateGroup
1609+ Controls = G2frame .GPXtree .GetItemPyData (G2gd .GetGPXtreeItemId (G2frame ,G2frame .root , 'Controls' ))
1610+ groupDict = Controls .get ('Groups' ,{}).get ('groupDict' ,{})
1611+ if groupName not in groupDict :
1612+ print (f'Unexpected: { groupName } not in groupDict' )
1613+ return
1614+ # set data to first histogram in group
1615+ G2frame .PatternId = G2gd .GetGPXtreeItemId (G2frame , G2frame .root , groupDict [groupName ][0 ])
1616+ data = G2frame .GPXtree .GetItemPyData (G2frame .PatternId )
1617+
16051618 if not G2frame .PatternId :
16061619 return
16071620 if 'PKS' in plottype : # This is probably not used anymore; PlotPowderLines seems to be called directly
@@ -1614,6 +1627,11 @@ def onPartialConfig(event):
16141627 else :
16151628 publish = None
16161629 new ,plotNum ,Page ,Plot ,limits = G2frame .G2plotNB .FindPlotTab ('Powder Patterns' ,'mpl' ,publish = publish )
1630+ # if we are changing histogram types (including group to individual, reset plot)
1631+ if not new and hasattr (Page ,'prevPlotType' ):
1632+ if Page .prevPlotType != plotType : new = True
1633+ Page .prevPlotType = plotType
1634+
16171635 if G2frame .ifSetLimitsMode and G2frame .GPXtree .GetItemText (G2frame .GPXtree .GetSelection ()) == 'Limits' :
16181636 # note mode
16191637 if G2frame .ifSetLimitsMode == 1 :
@@ -1641,8 +1659,8 @@ def onPartialConfig(event):
16411659 G2frame .lastPlotType
16421660 except :
16431661 G2frame .lastPlotType = None
1644- groupDict = {}
1645- if plotType == 'PWDR' :
1662+
1663+ if plotType == 'PWDR' or plotType == 'GROUP' :
16461664 try :
16471665 Parms ,Parms2 = G2frame .GPXtree .GetItemPyData (G2gd .GetGPXtreeItemId (G2frame ,
16481666 G2frame .PatternId , 'Instrument Parameters' ))
@@ -1662,8 +1680,6 @@ def onPartialConfig(event):
16621680 G2frame .lastPlotType = Parms ['Type' ][1 ]
16631681 except TypeError : #bad id from GetGPXtreeItemId - skip
16641682 pass
1665- Controls = G2frame .GPXtree .GetItemPyData (G2gd .GetGPXtreeItemId (G2frame ,G2frame .root , 'Controls' ))
1666- groupDict = Controls .get ('Groups' ,{}).get ('groupDict' ,{})
16671683 try :
16681684 G2frame .FixedLimits
16691685 except :
@@ -2003,17 +2019,6 @@ def onPartialConfig(event):
20032019 xLabel = 'E, keV'
20042020 else :
20052021 xLabel = r'$\mathsf{2\theta}$'
2006- # working here
2007- groupName = None
2008- if groupDict :
2009- histname = G2frame .GPXtree .GetItemText (G2frame .PatternId )
2010- for key in groupDict :
2011- if histname in groupDict [key ]:
2012- groupName = key
2013- break
2014- else :
2015- print ('No group for histogram' ,histname )
2016-
20172022 if groupName is not None :
20182023 # plot a group of histograms
20192024 Page .Choice = [' key press' ,
0 commit comments