Changeset 3418 for trunk/GSASIIphsGUI.py
- Timestamp:
- Jun 2, 2018 7:42:33 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r3406 r3418 70 70 ################################################################################ 71 71 #### phase class definitions 72 ################################################################################73 class SGMagSpinBox(wx.Dialog):74 ''' Special version of MessageBox that displays magnetic spin text75 '''76 def __init__(self,parent,title,text,table,Cents,names,spins,ifGray):77 wx.Dialog.__init__(self,parent,wx.ID_ANY,title,pos=wx.DefaultPosition,78 style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,size=wx.Size(420,350))79 self.text = text80 self.table = table81 self.names = names82 Nnames = len(self.names)83 self.spins = spins84 self.ifGray = ifGray85 self.PrintTable = [' Magnetic symmetry operations for %s:'%self.text[0].split(':')[1],]86 self.panel = wxscroll.ScrolledPanel(self)87 mainSizer = wx.BoxSizer(wx.VERTICAL)88 mainSizer.Add((0,10))89 cents = [0,]90 if len(Cents) > 1:91 cents = self.text[-1].split(';')92 lentable = len(self.table)93 for line in self.text:94 mainSizer.Add(wx.StaticText(self.panel,label=' %s '%(line)),0,WACV)95 if 'equivalent' in line:96 break97 ncol = self.table[0].count(',')+298 nBlk = 099 nG = 1100 if self.ifGray:101 nG = 2102 for ng in range(nG):103 for ic,cent in enumerate(cents):104 Cent = np.array(Cents[ic])105 if ic:106 if cent: cent = cent.strip(' (').strip(')+\n')107 label = ' for (%s)+'%(cent)108 if ng or self.spins[nBlk*lentable] < 0: #test for gray operators109 label += "1'"110 mainSizer.Add(wx.StaticText(self.panel,label=label),0,WACV)111 tableSizer = wx.FlexGridSizer(0,2*ncol+3,0,0)112 j = 0113 for item in self.table:114 flds = item.split(')')[1]115 tableSizer.Add(wx.StaticText(self.panel,label=' (%2d) '%(j+1)),0,WACV)116 flds = flds.replace(' ','').split(',')117 for i,fld in enumerate(flds):118 if i < ncol-1:119 text = wx.StaticText(self.panel,label='%s, '%(fld))120 tableSizer.Add(text,0,WACV)121 else:122 text = wx.StaticText(self.panel,label='%s '%(fld))123 tableSizer.Add(text,0,WACV)124 text = wx.StaticText(self.panel,label=' (%s) '%(self.names[j%Nnames]))125 try:126 if self.spins[j+nBlk*lentable] < 0:127 text.SetForegroundColour('Red')128 item += ',-1'129 else:130 item += ',+1'131 except IndexError:132 print(self.spins,j,ic,lentable,self.names[j%Nnames])133 item += ',+1'134 M,T,S = G2spc.MagText2MTS(item.split(')')[1].replace(' ',''),CIF=False)135 T = (T+Cent)%1.136 item = G2spc.MT2text([M,T],reverse=True)137 if S > 0:138 item += ',+1'139 else:140 item += ',-1'141 self.PrintTable.append(item.replace(' ','').lower())142 tableSizer.Add(text,0,WACV)143 if not j%2:144 tableSizer.Add((20,0))145 j += 1146 nBlk += 1147 mainSizer.Add(tableSizer,0,WACV)148 149 150 def OnPrintOps(event):151 for item in self.PrintTable:152 print(item)153 154 btnsizer = wx.StdDialogButtonSizer()155 printBtn = wx.Button(self.panel,label='Print Ops')156 printBtn.Bind(wx.EVT_BUTTON, OnPrintOps)157 btnsizer.Add(printBtn)158 OKbtn = wx.Button(self.panel, wx.ID_OK)159 OKbtn.SetDefault()160 btnsizer.AddButton(OKbtn)161 btnsizer.Realize()162 OKbtn.SetFocus()163 mainSizer.Add((0,10))164 mainSizer.Add(btnsizer,0)165 166 self.panel.SetSizer(mainSizer)167 self.panel.SetAutoLayout(True)168 self.panel.SetScrollRate(10,10)169 self.panel.SendSizeEvent()170 171 172 def Show(self):173 '''Use this method after creating the dialog to post it174 '''175 self.ShowModal()176 return177 178 179 72 ################################################################################ 180 73 class SymOpDialog(wx.Dialog): … … 1873 1766 text[0] += " 1'" 1874 1767 text[3] += "1'" 1875 SGMagSpinBox(General,msg,text,table,SGData['SGCen'],OprNames,1768 G2G.SGMagSpinBox(General,msg,text,table,SGData['SGCen'],OprNames, 1876 1769 SGData['SpnFlp'],SGData['SGGray']& (not SGData['SGFixed'])).Show() 1877 1770
Note: See TracChangeset
for help on using the changeset viewer.