Changeset 2276
- Timestamp:
- May 16, 2016 3:22:10 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r2272 r2276 2798 2798 Xi,c = event.GetRow(),event.GetCol() 2799 2799 if Xi >= 0 and c == 5: #plot column 2800 Obj.SetCellValue(Xi,5,'')2801 2800 G2plt.PlotLayers(G2frame,Layers,[Yi,Xi,],plotDefaults) 2802 2801 else: -
trunk/GSASIIplot.py
r2272 r2276 5981 5981 Radii = [] 5982 5982 for Atype in atTypes: 5983 Radii.append(AtInfo[Atype ]['Drad'])5984 if Atype == 'H':5983 Radii.append(AtInfo[Atype[0]]['Drad']) 5984 if Atype[0] == 'H': 5985 5985 Radii[-1] = 0.5 5986 5986 Radii = np.array(Radii) … … 6007 6007 layer = Names.index(Layers['Layers'][layer]['SameAs']) 6008 6008 atNames = [atom[0] for atom in Layers['Layers'][layer]['Atoms']] 6009 atTypes = [ atom[1] for atom in Layers['Layers'][layer]['Atoms']]6009 atTypes = [[atom[1],il] for atom in Layers['Layers'][layer]['Atoms']] 6010 6010 XYZ = np.array([atom[2:5] for atom in Layers['Layers'][layer]['Atoms']]) 6011 6011 if '-1' in Layers['Layers'][layer]['Symm']: … … 6084 6084 im = im.transpose(Im.FLIP_TOP_BOTTOM) 6085 6085 im.save(Fname,mode) 6086 cb.SetValue(' save as:') 6087 G2frame.G2plotNB.status.SetStatusText('Drawing saved to: '+Fname,1) 6086 print ' Drawing saved to: '+Fname 6087 elif mode[0] in ['L','F']: 6088 event.key = cb.GetValue()[0] 6089 wx.CallAfter(OnPlotKeyPress,event) 6090 Page.canvas.SetFocus() # redirect the Focus from the button back to the plot 6088 6091 6089 6092 def OnPlotKeyPress(event): 6090 6093 global AtNames,AtTypes,XYZ,Bonds 6091 if event.GetKeyCode() > 255: 6092 return 6093 keyCode = chr(min(255,event.GetKeyCode())) 6094 try: 6095 key = event.GetKeyCode() 6096 if key > 255: 6097 key = 0 6098 keyCode = chr(key) 6099 except AttributeError: #if from OnKeyBox above 6100 keyCode = str(event.key).upper() 6094 6101 dx = 0. 6095 6102 dy = 0. … … 6099 6106 Draw('labels') 6100 6107 return 6108 elif keyCode =='F' and len(laySeq) == 2: 6109 Page.fade = not Page.fade 6101 6110 if len(laySeq) != 2: 6102 6111 return … … 6142 6151 SetRotation(newxy) 6143 6152 Q = defaults['Quaternion'] 6144 G2frame.G2plotNB.status.SetStatusText('New quaternion: %.2f+, %.2fi+ ,%.2fj+, %.2fk'%(Q[0],Q[1],Q[2],Q[3]),1)6145 6153 elif event.RightIsDown(): 6146 6154 SetTranslation(newxy) … … 6149 6157 SetRotationZ(newxy) 6150 6158 Q = defaults['Quaternion'] 6151 G2frame.G2plotNB.status.SetStatusText('New quaternion: %.2f+, %.2fi+ ,%.2fj+, %.2fk'%(Q[0],Q[1],Q[2],Q[3]),1)6152 6159 Draw('move') 6153 6160 … … 6155 6162 defaults['cameraPos'] += event.GetWheelRotation()/24 6156 6163 defaults['cameraPos'] = max(10,min(500,defaults['cameraPos'])) 6157 G2frame.G2plotNB.status.SetStatusText('New camera distance: %.2f'%(defaults['cameraPos']),1)6158 6164 Draw('wheel') 6159 6165 … … 6320 6326 glTranslate(-Tx,-Ty,-Tz) 6321 6327 RenderUnitVectors(0.,0.,0.) 6322 radius = 0.5 6328 bondRad = 0.1 6329 atomRad = 0.5 6330 if Page.labels: 6331 bondRad = 0.05 6332 atomRad = 0.2 6323 6333 glShadeModel(GL_SMOOTH) 6324 6334 for iat,atom in enumerate(XYZ): 6325 6335 x,y,z = atom 6326 CL = AtInfo[AtTypes[iat] ]['Color']6336 CL = AtInfo[AtTypes[iat][0]]['Color'] 6327 6337 color = np.array(CL)/255. 6328 RenderSphere(x,y,z,radius,color) 6329 RenderBonds(x,y,z,Bonds[iat],0.10,color) 6338 if len(laySeq) == 2 and AtTypes[iat][1] and Page.fade: 6339 color *= .5 6340 RenderSphere(x,y,z,atomRad,color) 6341 RenderBonds(x,y,z,Bonds[iat],bondRad,color) 6330 6342 if Page.labels: 6331 6343 RenderLabel(x,y,z,' '+AtNames[iat],matRot) … … 6349 6361 Page.views = False 6350 6362 Page.labels = False 6363 Page.fade = False 6351 6364 view = False 6352 6365 altDown = False 6353 choice = [' save as:','jpeg','tiff','bmp'] 6366 choice = [' save as:','jpeg','tiff','bmp','use keys for:','L - toggle labels'] 6367 if len(laySeq) == 2: 6368 choice += ['F - toggle fade','X/shift-X move Dx','Y/shift-Y move Dy','Z/shift-Z move Dz'] 6354 6369 Page.keyPress = OnPlotKeyPress 6355 6370 G2frame.G2plotNB.RaisePageNoRefresh(Page) … … 6357 6372 cb = wx.ComboBox(G2frame.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY,choices=choice) 6358 6373 cb.Bind(wx.EVT_COMBOBOX, OnKeyBox) 6359 if len(laySeq) == 2: 6360 G2frame.G2plotNB.status.SetStatusText('Shift layer +/-XYZ key: X/shift-X, Y/shift-Y, Z/shift-Z; key: L - toggle atom labels',1) 6361 else: 6362 G2frame.G2plotNB.status.SetStatusText('L - toggle atom labels',1) 6374 text = [str(Layers['Layers'][seq]['Name']) for seq in laySeq] 6375 G2frame.G2plotNB.status.SetStatusText(' Layers plotted: '+str(text).replace("'",'')[1:-1],1) 6363 6376 Page.canvas.Bind(wx.EVT_MOUSEWHEEL, OnMouseWheel) 6364 6377 Page.canvas.Bind(wx.EVT_LEFT_DOWN, OnMouseDown)
Note: See TracChangeset
for help on using the changeset viewer.