Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexing #102

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0fddd14
checkpoint after reorg of GUI
briantoby Nov 13, 2024
499f92e
checkpoint: reorg reflection generation, but more work needed
briantoby Nov 14, 2024
0b651c3
checkpoint: cosmetic change; pause to reconcile w/Bob
briantoby Nov 14, 2024
667ee23
update with changes in master
briantoby Nov 16, 2024
dea55f7
a few more changes to GUI: use->show; wipe flag when page is loaded (…
briantoby Nov 18, 2024
7d53aba
created 2 panels, but not displaying or loading correctly
briantoby Nov 19, 2024
c6ab63a
Add an unscrolled top & bottom box for dataWindow; cleanup GSASIIphsG…
briantoby Nov 20, 2024
d995687
Fix HKLshow problem for TryAll option
vondreele Nov 21, 2024
98928d3
Fix start directory issue for "Read selected data from..." menu item …
vondreele Nov 21, 2024
d98457c
Unscrolled regions work; reworked scrolling; Old code works as before…
briantoby Nov 21, 2024
47a5589
Merge branch 'topbox' into indexing. This adds the new unscrolled reg…
briantoby Nov 21, 2024
0c7175d
fix XtraPeakMode
briantoby Nov 22, 2024
e3b9e0b
Add extra peak button; display tickmarks in XtraMode; allow drag of d…
briantoby Nov 22, 2024
e464e90
update Ref Controls & Covar to new fmt; Add title to main PWDR (etc.)…
briantoby Nov 22, 2024
064ed0a
work on cell use logic & table display
briantoby Nov 23, 2024
4ba7c05
copy cell info & refine to Index Peaks; narrow cell GUI
briantoby Nov 23, 2024
16cca41
address where ssopt & controls have different space groups; add unico…
briantoby Nov 23, 2024
97924eb
formatting of modulated cells
briantoby Nov 23, 2024
70cfcc7
improve help placement: constraints, rigid bodies, phase entries, res…
briantoby Dec 4, 2024
b75221e
Redo notebook window
briantoby Dec 5, 2024
42d2f0c
major GUI rework: end sizer reuse in dataWindow; more HelpButton upda…
briantoby Dec 6, 2024
7b71f03
Make Windows/Linux help button bigger; add a preference setting for f…
briantoby Dec 6, 2024
b7c4cfc
speed enhancements for indexing
vondreele Dec 11, 2024
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
40 changes: 30 additions & 10 deletions GSASII/GSASIIconstrGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,18 @@ def UpdateConstraintPanel(panel,typ):
notebook tab. Called in :func:`OnPageChanged`
'''
if panel.GetSizer(): panel.GetSizer().Clear(True)
topSizer = G2frame.dataWindow.topBox
topSizer.Clear(True)
parent = G2frame.dataWindow.topPanel
lbl= "Define/edit constraints on refined parameters"
topSizer.Add(wx.StaticText(parent,label=lbl),0,WACV)
topSizer.Add((-1,-1),1,wx.EXPAND)
if G2frame.testSeqRefineMode():
topSizer.Add(G2G.HelpButton(parent,helpIndex='Constraints-SeqRef'))
else:
topSizer.Add(G2G.HelpButton(parent,helpIndex='Constraints'))
wx.CallAfter(G2frame.dataWindow.SetDataSize)

Siz = wx.BoxSizer(wx.VERTICAL)
Siz.Add((5,5),0)
if typ != 'Sym-Generated':
Expand All @@ -1432,7 +1444,7 @@ def UpdateConstraintPanel(panel,typ):
panel.delBtn.Bind(wx.EVT_BUTTON,OnConstDel)
panel.delBtn.checkboxList = []
butSizer.Add((-1,-1),1,wx.EXPAND,1)
butSizer.Add(G2G.HelpButton(panel,helpIndex='Constraints'))

Siz.Add(butSizer,0,wx.EXPAND)
if G2frame.testSeqRefineMode():
butSizer = wx.BoxSizer(wx.HORIZONTAL)
Expand All @@ -1442,7 +1454,6 @@ def UpdateConstraintPanel(panel,typ):
['auto-wildcard', 'wildcards-only', 'use-all'],
lambda x: wx.CallAfter(UpdateConstraints, G2frame, data, G2frame.constr.GetSelection(), True))
butSizer.Add(btn,0,wx.ALIGN_CENTER_VERTICAL)
butSizer.Add(G2G.HelpButton(panel,helpIndex='Constraints-SeqRef'))
butSizer.Add(wx.StaticText(panel,wx.ID_ANY,' Selected histogram: '),0,WACV)
btn = G2G.EnumSelector(panel, data, '_seqhist',
list(seqHistList),list(range(len(seqHistList))),
Expand Down Expand Up @@ -1687,7 +1698,9 @@ def OnShowISODISTORT(event):

#G2frame.constr = G2G.GSNoteBook(parent=G2frame.dataWindow,size=G2frame.dataWindow.GetClientSize())
G2frame.constr = G2G.GSNoteBook(parent=G2frame.dataWindow)
G2frame.dataWindow.GetSizer().Add(G2frame.constr,1,wx.ALL|wx.EXPAND)
mainSizer = wx.BoxSizer(wx.VERTICAL)
G2frame.dataWindow.SetSizer(mainSizer)
mainSizer.Add(G2frame.constr,1,wx.ALL|wx.EXPAND)
# note that order of pages is hard-coded in RaisePage
PhaseConstr = wx.ScrolledWindow(G2frame.constr)
G2frame.constr.AddPage(PhaseConstr,'Phase')
Expand Down Expand Up @@ -3128,7 +3141,6 @@ def OnDefineTorsSeq(event):
rbData['rbSeq'].append([Orig,Piv,0.0,Riding])
dlg.Destroy()
UpdateResidueRB()


def UpdateVectorRB(Scroll=0):
'''Display & edit a selected Vector RB
Expand Down Expand Up @@ -3180,7 +3192,6 @@ def OnPlotRB(event):
Indx[delRB.GetId()] = rbid
nameSizer.Add(delRB,0,WACV)
nameSizer.Add((-1,-1),1,wx.EXPAND,1)
nameSizer.Add(G2G.HelpButton(VectorRBDisplay,helpIndex=G2frame.dataWindow.helpKey))
return nameSizer

def rbRefAtmSizer(rbid,rbData):
Expand Down Expand Up @@ -3590,7 +3601,6 @@ def OnPlotRB(event):
nameSizer.Add(wx.StaticText(ResidueRBDisplay,-1,' body type #'+
str(data['RBIds']['Residue'].index(rbid))),0,WACV)
nameSizer.Add((-1,-1),1,wx.EXPAND,1)
nameSizer.Add(G2G.HelpButton(ResidueRBDisplay,helpIndex=G2frame.dataWindow.helpKey))
return nameSizer

def rbResidues(rbid,rbData):
Expand Down Expand Up @@ -3751,13 +3761,11 @@ def OnCycleXYZ(event):
%%* The "Center RB?" button will shift the origin of the
rigid body to be the midpoint of all atoms in the body (not mass weighted).
'''
hlp = G2G.HelpButton(ResidueRBDisplay,refHelpInfo,wrap=400)
refAtmSizer.Add(hlp,0,wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL,2)
refAtmSizer2 = None
if rbData['rbRef'][3] or rbData['useCount']:
refAtmSizer.Add(wx.StaticText(ResidueRBDisplay,-1,
'Orientation reference non-H atoms A-B-C: %s, %s, %s'%(atNames[rbRef[0]], \
atNames[rbRef[1]],atNames[rbRef[2]])),0)
atNames[rbRef[1]],atNames[rbRef[2]])),0,WACV)
else:
refAtmSizer.Add(wx.StaticText(ResidueRBDisplay,-1,
'Orientation reference non-H atoms A-B-C: '),0,WACV)
Expand Down Expand Up @@ -3787,6 +3795,8 @@ def OnCycleXYZ(event):
HDbut.Bind(wx.EVT_BUTTON,OnHDswitch)
Indx[HDbut.GetId()] = resGrid
refAtmSizer2.Add(HDbut,0,WACV)
hlp = G2G.HelpButton(ResidueRBDisplay,refHelpInfo,wrap=400)
refAtmSizer.Add(hlp,0,wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL,2)

mainSizer = wx.BoxSizer(wx.VERTICAL)
mainSizer.Add(refAtmSizer,0,wx.EXPAND)
Expand Down Expand Up @@ -3983,8 +3993,18 @@ def SetStatusLine(text):
Indx = {}
resList = []
plotDefaults = {'oldxy':[0.,0.],'Quaternion':[0.,0.,0.,1.],'cameraPos':30.,'viewDir':[0,0,1],}
topSizer = G2frame.dataWindow.topBox
topSizer.Clear(True)
parent = G2frame.dataWindow.topPanel
lbl= "Define/edit rigid bodies here before adding them to phase(s)"
topSizer.Add(wx.StaticText(parent,label=lbl),0,WACV)
topSizer.Add((-1,-1),1,wx.EXPAND)
topSizer.Add(G2G.HelpButton(parent,helpIndex=G2frame.dataWindow.helpKey))
wx.CallAfter(G2frame.dataWindow.SetDataSize)
mainSizer = wx.BoxSizer(wx.VERTICAL)
G2frame.dataWindow.SetSizer(mainSizer)
G2frame.rbBook = G2G.GSNoteBook(parent=G2frame.dataWindow)
G2frame.dataWindow.GetSizer().Add(G2frame.rbBook,1,wx.ALL|wx.EXPAND)
mainSizer.Add(G2frame.rbBook,1,wx.ALL|wx.EXPAND)
VectorRB = wx.ScrolledWindow(G2frame.rbBook)
VectorRBDisplay = wx.Panel(VectorRB)
G2frame.rbBook.AddPage(VectorRB,'Vector rigid bodies')
Expand Down
24 changes: 22 additions & 2 deletions GSASII/GSASIIctrlGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,23 @@ class G2TreeCtrl(wx.TreeCtrl):
'''
def __init__(self,parent=None,*args,**kwargs):
super(self.__class__,self).__init__(parent=parent,*args,**kwargs)
fontIncr = GSASIIpath.GetConfigValue('FontSize_incr')
self.font = None
self.G2frame = parent.GetTopLevelParent()
self.root = self.AddRoot('Loaded Data: ')
if fontIncr is not None and fontIncr != 0:
self.font = wx.Font(self.GetFont())
self.font.SetPointSize(self.font.PointSize+fontIncr)
self.SetItemFont(self.root, self.font)
self.SelectionChanged = None
self.textlist = None

def AppendItem(self, parent, text, image=-1, selImage=-1, data=None):
'override the standard method so font size can be set'
item = super(self.__class__,self).AppendItem(parent, text, image, selImage, data)
if self.font: self.SetItemFont(item, self.font)
return item

def _getTreeItemsList(self,item):
'''Get the full tree hierarchy from a reference to a tree item.
Note that this effectively hard-codes phase and histogram names in the
Expand Down Expand Up @@ -605,7 +617,10 @@ def _GetStringValue(self,event):
wx.CallAfter(self._SaveStringValue)

def _SaveStringValue(self):
val = self.GetValue().strip()
try:
val = self.GetValue().strip()
except RuntimeError: # ignore if control has been deleted
return
# always store the result
if self.CIFinput and '2' in platform.python_version_tuple()[0]: # Py2/CIF make results ASCII
self.result[self.key] = val.encode('ascii','replace')
Expand Down Expand Up @@ -5788,7 +5803,12 @@ def __init__(self,parent,msg='',helpIndex='',wrap=None):
if sys.platform == "darwin":
wx.Button.__init__(self,parent,wx.ID_HELP)
else:
wx.Button.__init__(self,parent,wx.ID_ANY,'?',style=wx.BU_EXACTFIT)
wx.Button.__init__(self,parent,wx.ID_ANY,' ? ',style=wx.BU_EXACTFIT)
self.SetBackgroundColour('yellow')
self.SetForegroundColour('black')
f = wx.Font(self.GetFont()).Bold()
f.SetPointSize(f.PointSize+4)
self.SetFont(f)
self.Bind(wx.EVT_BUTTON,self._onPress)
if wrap:
self.msg=StripIndents(msg,True)
Expand Down
Loading