Changeset 5352 for trunk/GSASIIctrlGUI.py
- Timestamp:
- Oct 20, 2022 9:56:41 PM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIctrlGUI.py
r5341 r5352 6023 6023 return BlockSelector(ChoiceList,ParentFrame,title, 6024 6024 size,header) 6025 6026 def XformMatrix(panel,Trans,Uvec,Vvec,OnLeave=None,OnLeaveArgs={}): 6027 '''Display a transformation matrix and two vectors''' 6028 Trmat = wx.FlexGridSizer(4,6,0,0) 6029 Trmat.Add((10,0),0) 6030 Trmat.Add(wx.StaticText(panel,label=' M'),wx.ALIGN_CENTER) 6031 Trmat.Add((10,0),0) 6032 Trmat.Add((10,0),0) 6033 Trmat.Add(wx.StaticText(panel,label=' U'),wx.ALIGN_CENTER) 6034 Trmat.Add(wx.StaticText(panel,label=' V'),wx.ALIGN_CENTER) 6035 6036 for iy,line in enumerate(Trans): 6037 for ix,val in enumerate(line): 6038 item = ValidatedTxtCtrl(panel,Trans[iy],ix,nDig=(10,3),size=(65,25), 6039 OnLeave=OnLeave,OnLeaveArgs=OnLeaveArgs) 6040 Trmat.Add(item) 6041 Trmat.Add((25,0),0) 6042 vec = ValidatedTxtCtrl(panel,Uvec,iy,nDig=(10,3),size=(65,25), 6043 OnLeave=OnLeave,OnLeaveArgs=OnLeaveArgs) 6044 Trmat.Add(vec) 6045 vec = ValidatedTxtCtrl(panel,Vvec,iy,nDig=(10,3),size=(65,25), 6046 OnLeave=OnLeave,OnLeaveArgs=OnLeaveArgs) 6047 Trmat.Add(vec) 6048 return Trmat 6049 6050 def showUniqueCell(frame,cellSizer,row,cell,SGData=None, 6051 editAllowed=False,OnCellChange=None): 6052 '''function to put cell values into a GridBagSizer. 6053 First column (#0) is reserved for labels etc. 6054 if editAllowed is True, values are placed in a wx.TextCtrl and if needed 6055 two rows are used in the table. 6056 ''' 6057 cellGUIlist = [ 6058 [['m3','m3m'],[" Unit cell: a = "],["{:.5f}"],[0]], 6059 [['3R','3mR'],[" a = ",u" \u03B1 = "],["{:.5f}","{:.3f}"],[0,3]], 6060 [['3','3m1','31m','6/m','6/mmm','4/m','4/mmm'],[" a = "," c = "], 6061 ["{:.5f}","{:.5f}"],[0,2]], 6062 [['mmm'],[" a = "," b = "," c = "],["{:.5f}","{:.5f}","{:.5f}"], 6063 [0,1,2]], 6064 [['2/m'+'a'],[" a = "," b = "," c = ",u" \u03B1 = "], 6065 ["{:.5f}","{:.5f}","{:.5f}","{:.3f}"],[0,1,2,3]], 6066 [['2/m'+'b'],[" a = "," b = "," c = ",u" \u03B2 = "], 6067 ["{:.5f}","{:.5f}","{:.5f}","{:.3f}"],[0,1,2,4]], 6068 [['2/m'+'c'],[" a = "," b = "," c = ",u" \u03B3 = "], 6069 ["{:.5f}","{:.5f}","{:.5f}","{:.3f}"],[0,1,2,5]], 6070 [['-1'],[" a = "," b = "," c = ",u" \u03B1 = ",u" \u03B2 = ",u" \u03B3 = "], 6071 ["{:.5f}","{:.5f}","{:.5f}","{:.3f}","{:.3f}","{:.3f}"],[0,1,2,3,4,5]] 6072 ] 6073 VERY_LIGHT_GREY = wx.Colour(235,235,235) 6074 cellList = [] 6075 if SGData is None: 6076 laue = '-1' 6077 else: 6078 laue = SGData['SGLaue'] 6079 if laue == '2/m': laue += SGData['SGUniq'] 6080 for cellGUI in cellGUIlist: 6081 if laue in cellGUI[0]: 6082 useGUI = cellGUI 6083 break 6084 for txt,fmt,indx in zip(*useGUI[1:]): 6085 col = 1+2*indx 6086 cellrow = row 6087 if editAllowed and indx > 2: 6088 cellrow = row + 1 6089 col = 1+2*(indx-3) 6090 cellSizer.Add(wx.StaticText(frame,label=txt),(cellrow,col)) 6091 if editAllowed: 6092 Fmt = (10,5) 6093 if '.3' in fmt: Fmt = (10,3) 6094 cellVal = ValidatedTxtCtrl(frame,cell,indx, 6095 xmin=0.1,xmax=500.,nDig=Fmt,OnLeave=OnCellChange) 6096 cellSizer.Add(cellVal,(cellrow,col+1)) 6097 cellList.append(cellVal.GetId()) 6098 else: 6099 cellSizer.Add(wx.StaticText(frame,label=fmt.format(cell[indx])),(cellrow,col+1)) 6100 #volume 6101 volCol = 13 6102 if editAllowed: 6103 volCol = 8 6104 cellSizer.Add(wx.StaticText(frame,label=' Vol = '),(row,volCol)) 6105 if editAllowed: 6106 volVal = wx.TextCtrl(frame,value=('{:.2f}'.format(cell[6])),style=wx.TE_READONLY) 6107 volVal.SetBackgroundColour(VERY_LIGHT_GREY) 6108 cellSizer.Add(volVal,(row,volCol+1)) 6109 else: 6110 cellSizer.Add(wx.StaticText(frame,label='{:.2f}'.format(cell[6])),(row,volCol+1)) 6111 return cellrow,cellList 6112 6025 6113 6026 6114 ################################################################################
Note: See TracChangeset
for help on using the changeset viewer.