Changeset 2875
- Timestamp:
- Jun 25, 2017 2:52:51 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIctrls.py
r2872 r2875 2724 2724 else: 2725 2725 return '.' 2726 ################################################################################ 2727 class SGMessageBox(wx.Dialog): 2728 ''' Special version of MessageBox that displays space group & super space group text 2729 in two blocks 2730 ''' 2731 def __init__(self,parent,title,text,table,): 2732 wx.Dialog.__init__(self,parent,wx.ID_ANY,title,pos=wx.DefaultPosition, 2733 style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) 2734 self.text = text 2735 self.table = table 2736 self.panel = wx.Panel(self) 2737 mainSizer = wx.BoxSizer(wx.VERTICAL) 2738 mainSizer.Add((0,10)) 2739 for line in text: 2740 mainSizer.Add(wx.StaticText(self.panel,label=' %s '%(line)),0,WACV) 2741 ncol = self.table[0].count(',')+1 2742 tableSizer = wx.FlexGridSizer(0,2*ncol+3,0,0) 2743 for j,item in enumerate(self.table): 2744 num,flds = item.split(')') 2745 tableSizer.Add(wx.StaticText(self.panel,label=' %s '%(num+')')),0,WACV|wx.ALIGN_LEFT) 2746 flds = flds.replace(' ','').split(',') 2747 for i,fld in enumerate(flds): 2748 if i < ncol-1: 2749 tableSizer.Add(wx.StaticText(self.panel,label='%s, '%(fld)),0,WACV|wx.ALIGN_RIGHT) 2750 else: 2751 tableSizer.Add(wx.StaticText(self.panel,label='%s'%(fld)),0,WACV|wx.ALIGN_RIGHT) 2752 if not j%2: 2753 tableSizer.Add((20,0)) 2754 mainSizer.Add(tableSizer,0,wx.ALIGN_LEFT) 2755 btnsizer = wx.StdDialogButtonSizer() 2756 OKbtn = wx.Button(self.panel, wx.ID_OK) 2757 OKbtn.Bind(wx.EVT_BUTTON, self.OnOk) 2758 OKbtn.SetDefault() 2759 btnsizer.AddButton(OKbtn) 2760 btnsizer.Realize() 2761 mainSizer.Add((0,10)) 2762 mainSizer.Add(btnsizer,0,wx.ALIGN_CENTER) 2763 self.panel.SetSizer(mainSizer) 2764 self.panel.Fit() 2765 self.Fit() 2766 size = self.GetSize() 2767 self.SetSize([size[0]+20,size[1]]) 2768 2769 def Show(self): 2770 '''Use this method after creating the dialog to post it 2771 ''' 2772 self.CenterOnParent() 2773 self.ShowModal() 2774 return 2775 2776 def OnOk(self,event): 2777 parent = self.GetParent() 2778 parent.Raise() 2779 self.EndModal(wx.ID_OK) 2726 2780 2727 2781 ################################################################################ -
trunk/GSASIIgrid.py
r2870 r2875 175 175 'P->I','I->P','P->F','F->P','H->R','R->H','R->O','O->R','abc*','setting 1->2'] #don't put any new ones after the setting one! 176 176 177 # Should SGMessageBox, SymOpDialog, DisAglDialog be moved?178 179 177 ################################################################################ 180 178 #### GSAS-II class definitions 181 179 ################################################################################ 182 180 183 class SGMessageBox(wx.Dialog): 184 ''' Special version of MessageBox that displays space group & super space group text 185 in two blocks 186 ''' 187 def __init__(self,parent,title,text,table,): 188 wx.Dialog.__init__(self,parent,wx.ID_ANY,title,pos=wx.DefaultPosition, 189 style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) 190 self.text = text 191 self.table = table 192 self.panel = wx.Panel(self) 193 mainSizer = wx.BoxSizer(wx.VERTICAL) 194 mainSizer.Add((0,10)) 195 for line in text: 196 mainSizer.Add(wx.StaticText(self.panel,label=' %s '%(line)),0,WACV) 197 ncol = self.table[0].count(',')+1 198 tableSizer = wx.FlexGridSizer(0,2*ncol+3,0,0) 199 for j,item in enumerate(self.table): 200 num,flds = item.split(')') 201 tableSizer.Add(wx.StaticText(self.panel,label=' %s '%(num+')')),0,WACV|wx.ALIGN_LEFT) 202 flds = flds.replace(' ','').split(',') 203 for i,fld in enumerate(flds): 204 if i < ncol-1: 205 tableSizer.Add(wx.StaticText(self.panel,label='%s, '%(fld)),0,WACV|wx.ALIGN_RIGHT) 206 else: 207 tableSizer.Add(wx.StaticText(self.panel,label='%s'%(fld)),0,WACV|wx.ALIGN_RIGHT) 208 if not j%2: 209 tableSizer.Add((20,0)) 210 mainSizer.Add(tableSizer,0,wx.ALIGN_LEFT) 211 btnsizer = wx.StdDialogButtonSizer() 212 OKbtn = wx.Button(self.panel, wx.ID_OK) 213 OKbtn.Bind(wx.EVT_BUTTON, self.OnOk) 214 OKbtn.SetDefault() 215 btnsizer.AddButton(OKbtn) 216 btnsizer.Realize() 217 mainSizer.Add((0,10)) 218 mainSizer.Add(btnsizer,0,wx.ALIGN_CENTER) 219 self.panel.SetSizer(mainSizer) 220 self.panel.Fit() 221 self.Fit() 222 size = self.GetSize() 223 self.SetSize([size[0]+20,size[1]]) 224 225 def Show(self): 226 '''Use this method after creating the dialog to post it 227 ''' 228 self.ShowModal() 229 return 230 231 def OnOk(self,event): 232 parent = self.GetParent() 233 parent.Raise() 234 self.EndModal(wx.ID_OK) 181 # Should SymOpDialog, DisAglDialog etc. be moved to GSASIIctrls? 235 182 236 183 class SGMagSpinBox(wx.Dialog): … … 580 527 SGTxt.SetValue(self.Phase['General']['SGData']['SpGrp']) 581 528 msg = 'Space Group Information' 582 SGMessageBox(self.panel,msg,text,table).Show()529 G2G.SGMessageBox(self.panel,msg,text,table).Show() 583 530 if self.Phase['General']['Type'] == 'magnetic': 584 531 Nops = len(SGData['SGOps'])*len(SGData['SGCen']) -
trunk/GSASIIphsGUI.py
r2873 r2875 451 451 used (not recommended when alpha >> 120 or << 60, due to correlation.) 452 452 453 For standard settings of space groups, space group numbers (1-230) can alternately 454 be entered. 455 453 456 GSAS-II will accept non-standard settings of space groups. For example, space 454 457 group "P -1" can be set to include face centering, using symbol "F -1" and "P 1 1 21/a" … … 459 462 ''' 460 463 dlg = G2G.SingleStringDialog(General,'Get Space Group', 461 ' Input the space group with spaces between axial fields \n (e.g. p 21/c, P 63/m m c, P 4/m m m ',464 ' Input the space group with spaces between axial fields \n (e.g. p 21/c, P 63/m m c, P 4/m m m) or enter a space\n group number between 1 and 230.', 462 465 value=generalData['SGData']['SpGrp'],help=helptext) 463 466 if not dlg.Show(): … … 465 468 return 466 469 else: 467 Flds = dlg.GetValue().split() 468 dlg.Destroy() 469 #get rid of extra spaces between fields first 470 for fld in Flds: fld = fld.strip() 471 SpcGp = ' '.join(Flds) 470 try: 471 # has a space group number been input? 472 spcnum = int(dlg.GetValue()) 473 if 1 <= spcnum <= 230: 474 SpcGp = G2spc.spgbyNum[spcnum] 475 else: 476 msg = 'Space Group Error' 477 Style = wx.ICON_EXCLAMATION 478 wx.MessageBox('Invalid space group number',caption=msg,style=Style) 479 return 480 except: 481 #get rid of extra spaces between fields first 482 Flds = dlg.GetValue().split() 483 for fld in Flds: fld = fld.strip() 484 SpcGp = ' '.join(Flds) 485 finally: 486 dlg.Destroy() 472 487 # try a lookup on the user-supplied name 473 488 SpGrpNorm = G2spc.StandardizeSpcName(SpcGp) … … 488 503 SGTxt.SetLabel(generalData['SGData']['SpGrp']) 489 504 msg = 'Space Group Information' 490 G2 gd.SGMessageBox(General,msg,text,table).Show()505 G2G.SGMessageBox(General,msg,text,table).Show() 491 506 if generalData['Type'] == 'magnetic': 492 507 Nops = len(SGData['SGOps'])*len(SGData['SGCen']) … … 891 906 generalData['SuperSg'] = SSymbol 892 907 msg = 'Superspace Group Information' 893 G2 gd.SGMessageBox(General,msg,text,table).Show()908 G2G.SGMessageBox(General,msg,text,table).Show() 894 909 else: 895 910 text = [E+'\nSuperspace Group set to previous'] -
trunk/GSASIIspc.py
r2809 r2875 2855 2855 return '' 2856 2856 2857 2857 spgbyNum = [] 2858 '''Space groups indexed by number''' 2859 spgbyNum = [None, 2860 'P 1','P -1', #1-2 2861 'P 2','P 21','C 2','P m','P c','C m','C c','P 2/m','P 21/m', 2862 'C 2/m','P 2/c','P 21/c','C 2/c', #3-15 2863 'P 2 2 2','P 2 2 21','P 21 21 2','P 21 21 21', 2864 'C 2 2 21','C 2 2 2','F 2 2 2','I 2 2 2','I 21 21 21', 2865 'P m m 2','P m c 21','P c c 2','P m a 2','P c a 21', 2866 'P n c 2','P m n 21','P b a 2','P n a 21','P n n 2', 2867 'C m m 2','C m c 21','C c c 2', 2868 'A m m 2','A b m 2','A m a 2','A b a 2', 2869 'F m m 2','F d d 2','I m m 2','I b a 2','I m a 2', 2870 'P m m m','P n n n','P c c m','P b a n', 2871 'P m m a','P n n a','P m n a','P c c a','P b a m','P c c n', 2872 'P b c m','P n n m','P m m n','P b c n','P b c a','P n m a', 2873 'C m c m','C m c a','C m m m','C c c m','C m m a','C c c a', 2874 'F m m m', 'F d d d', 2875 'I m m m','I b a m','I b c a','I m m a', #16-74 2876 'P 4','P 41','P 42','P 43', 2877 'I 4','I 41', 2878 'P -4','I -4','P 4/m','P 42/m','P 4/n','P 42/n', 2879 'I 4/m','I 41/a', 2880 'P 4 2 2','P 4 21 2','P 41 2 2','P 41 21 2','P 42 2 2', 2881 'P 42 21 2','P 43 2 2','P 43 21 2', 2882 'I 4 2 2','I 41 2 2', 2883 'P 4 m m','P 4 b m','P 42 c m','P 42 n m','P 4 c c','P 4 n c', 2884 'P 42 m c','P 42 b c', 2885 'I 4 m m','I 4 c m','I 41 m d','I 41 c d', 2886 'P -4 2 m','P -4 2 c','P -4 21 m','P -4 21 c','P -4 m 2', 2887 'P -4 c 2','P -4 b 2','P -4 n 2', 2888 'I -4 m 2','I -4 c 2','I -4 2 m','I -4 2 d', 2889 'P 4/m m m','P 4/m c c','P 4/n b m','P 4/n n c','P 4/m b m', 2890 'P 4/m n c','P 4/n m m','P 4/n c c','P 42/m m c','P 42/m c m', 2891 'P 42/n b c','P 42/n n m','P 42/m b c','P 42/m n m','P 42/n m c', 2892 'P 42/n c m', 2893 'I 4/m m m','I 4/m c m','I 41/a m d','I 41/a c d', 2894 'P 3','P 31','P 32','R 3','P -3','R -3', 2895 'P 3 1 2','P 3 2 1','P 31 1 2','P 31 2 1','P 32 1 2','P 32 2 1', 2896 'R 3 2', 2897 'P 3 m 1','P 3 1 m','P 3 c 1','P 3 1 c', 2898 'R 3 m','R 3 c', 2899 'P -3 1 m','P -3 1 c','P -3 m 1','P -3 c 1', 2900 'R -3 m','R -3 c', #75-167 2901 'P 6','P 61', 2902 'P 65','P 62','P 64','P 63','P -6','P 6/m','P 63/m','P 6 2 2', 2903 'P 61 2 2','P 65 2 2','P 62 2 2','P 64 2 2','P 63 2 2','P 6 m m', 2904 'P 6 c c','P 63 c m','P 63 m c','P -6 m 2','P -6 c 2','P -6 2 m', 2905 'P -6 2 c','P 6/m m m','P 6/m c c','P 63/m c m','P 63/m m c', #168-194 2906 'P 2 3','F 2 3','I 2 3','P 21 3','I 21 3','P m 3','P n 3', 2907 'F m -3','F d -3','I m -3', 2908 'P a -3','I a -3','P 4 3 2','P 42 3 2','F 4 3 2','F 41 3 2', 2909 'I 4 3 2','P 43 3 2','P 41 3 2','I 41 3 2','P -4 3 m', 2910 'F -4 3 m','I -4 3 m','P -4 3 n','F -4 3 c','I -4 3 d', 2911 'P m -3 m','P n -3 n','P m -3 n','P n -3 m', 2912 'F m -3 m','F m -3 c','F d -3 m','F d -3 c', 2913 'I m -3 m','I a -3 d',] #195-230 2914 2858 2915 spglist = {} 2859 2916 '''A dictionary of space groups as ordered and named in the pre-2002 International -
trunk/testSSymbols.py
r2133 r2875 4 4 import GSASIIspc as G2spc 5 5 import GSASIIgrid as G2gd 6 import GSASIIctrls as G2G 6 7 import numpy as np 7 8 import copy … … 55 56 Data['SuperSg'] = SSymbol 56 57 msg = 'Superspace Group Information' 57 G2 gd.SGMessageBox(self,msg,text,table).Show()58 G2G.SGMessageBox(self,msg,text,table).Show() 58 59 else: 59 60 msg = 'Superspace Group Error for'+SSymbol … … 85 86 SGTxt.SetValue(Data['SGData']['SpGrp']) 86 87 msg = 'Space Group Information' 87 G2 gd.SGMessageBox(self,msg,text,table).Show()88 G2G.SGMessageBox(self,msg,text,table).Show() 88 89 SSChoice = G2spc.ssdict.get(Data['SGData']['SpGrp'],['',]) 89 90 Data['SuperSg'] = SSChoice[0] … … 98 99 Data['SuperSg'] = SSymbol 99 100 msg = 'Superspace Group Information' 100 G2 gd.SGMessageBox(self,msg,text,table).Show()101 G2G.SGMessageBox(self,msg,text,table).Show() 101 102 print 'Super spacegroup operators for '+SSGData['SSpGrp'] 102 103 for Op in SSGData['SSGOps']:
Note: See TracChangeset
for help on using the changeset viewer.