 Timestamp:
 Nov 5, 2020 1:59:07 PM (2 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIplot.py
r4649 r4650 348 348 self.canvas = wx.glcanvas.GLCanvas(self,1,attribList=attribs,**kwargs) 349 349 GL.glEnable(GL.GL_NORMALIZE) 350 #GSASIIpath.IPyBreak()351 350 # create GL context 352 351 i,j= wx.__version__.split('.')[0:2] … … 8111 8110 def OnKey(event): #on key UP!! 8112 8111 keyBox = False 8112 NPkey = False 8113 8113 try: 8114 8114 keyCode = event.GetKeyCode() … … 8119 8119 keyBox = True 8120 8120 key = str(event.key).upper() 8121 indx = drawingData['selectedAtoms'] 8122 cx,ct = drawingData['atomPtrs'][:2] 8121 # indx = drawingData['selectedAtoms'] 8123 8122 if key in ['C']: 8124 8123 drawingData['viewPoint'] = [np.array([.5,.5,.5]),[0,0]] … … 8134 8133 SetViewDirText(drawingData['viewDir']) 8135 8134 G2frame.G2plotNB.status.SetStatusText('New quaternion: %.2f+, %.2fi+ ,%.2fj+, %.2fk'%(Q[0],Q[1],Q[2],Q[3]),1) 8136 elif key in ['N']: 8137 drawAtoms = drawingData['Atoms'] 8138 if not len(drawAtoms): #no atoms 8135 elif key in ['N','P',]: 8136 if G2frame.phaseDisplay.GetPageText(getSelection()) == 'Map peaks': 8137 cx = 1 8138 ct = 0 8139 atoms = data.get('Map Peaks',[]) 8140 elif G2frame.phaseDisplay.GetPageText(getSelection()) == 'Draw Atoms': 8141 cx,ct = drawingData['atomPtrs'][:2] 8142 atoms = drawingData['Atoms'] 8143 elif G2frame.phaseDisplay.GetPageText(getSelection()) == 'Atoms': 8144 cx,ct = data['General']['AtomPtrs'][:2] 8145 atoms = data['Atoms'] 8146 else: 8147 return 8148 if not len(atoms): #no atoms 8139 8149 return 8140 8150 pI = drawingData['viewPoint'][1] 8141 8151 if not len(pI): 8142 8152 pI = [0,0] 8143 if indx: 8144 try: 8145 pI[0] = indx[pI[1]] 8146 Tx,Ty,Tz = drawAtoms[pI[0]][cx:cx+3] 8147 except IndexError: 8148 pI = [0,0] 8149 Tx,Ty,Tz = drawAtoms[pI[0]][cx:cx+3] 8153 if key in ['N',]: 8150 8154 pI[1] += 1 8151 pI[1] %= len(indx)8152 txt = ' in selection'8153 8155 else: 8154 pI[0] += 1 8155 pI[0] %= len(drawAtoms) 8156 Tx,Ty,Tz = drawAtoms[pI[0]][cx:cx+3] 8157 txt = '' 8156 pI[1] = 1 8157 pI[1] %= len(atoms) 8158 Tx,Ty,Tz = atoms[pI[1]][cx:cx+3] 8159 txt = '' 8160 SetSelectedAtoms(pI[1]) 8158 8161 drawingData['viewPoint'] = [np.array([Tx,Ty,Tz]),pI] 8159 8162 SetViewPointText(drawingData['viewPoint'][0]) 8160 G2frame.G2plotNB.status.SetStatusText('View point at atom '+drawAtoms[pI[0]][ct1]+txt,1) 8163 if ct: G2frame.G2plotNB.status.SetStatusText('View point at atom '+atoms[pI[0]][ct1]+txt,1) 8164 NPkey = True 8161 8165 8162 8166 elif key in ['K'] and generalData['Map']['MapType']: … … 8173 8177 dlg.Destroy() 8174 8178 8175 elif key in ['P']:8176 drawAtoms = drawingData['Atoms']8177 if not len(drawAtoms): #no atoms8178 return8179 pI = drawingData['viewPoint'][1]8180 if not len(pI):8181 pI = [0,0]8182 if indx:8183 try:8184 pI[0] = indx[pI[1]]8185 Tx,Ty,Tz = drawAtoms[pI[0]][cx:cx+3]8186 except IndexError:8187 pI = [0,0]8188 Tx,Ty,Tz = drawAtoms[pI[0]][cx:cx+3]8189 pI[1] = 18190 pI[1] %= len(indx)8191 txt = ' in selection'8192 else:8193 pI[0] = 18194 pI[0] %= len(drawAtoms)8195 Tx,Ty,Tz = drawAtoms[pI[0]][cx:cx+3]8196 txt = ''8197 drawingData['viewPoint'] = [np.array([Tx,Ty,Tz]),pI]8198 SetViewPointText(drawingData['viewPoint'][0])8199 G2frame.G2plotNB.status.SetStatusText('View point at atom '+drawAtoms[pI[0]][ct1]+txt,1)8200 8179 elif key in ['U','D','L','R'] and mapData['Flip'] == True: 8201 8180 dirDict = {'U':[0,1],'D':[0,1],'L':[1,0],'R':[1,0]} … … 8248 8227 OnKeyPressed(event) 8249 8228 return 8250 Draw('key up' )8229 Draw('key up',NPkey=NPkey) 8251 8230 8252 8231 def OnKeyPressed(event): #On key down for repeating operation  used to change tau... … … 9162 9141 RenderBonds(ax,ay,az,bondData[i],bondR,Color[i]) 9163 9142 9164 def Draw(caller='',Fade=[] ):9143 def Draw(caller='',Fade=[],NPkey=False): 9165 9144 vdWRadii = generalData['vdWRadii'] 9166 9145 mapData = generalData['Map'] … … 9267 9246 else: 9268 9247 bndColor = atColor 9269 if iat in Ind and G2frame.phaseDisplay.GetPageText(getSelection()) != 'Map peaks':9248 if iat in Ind and (G2frame.phaseDisplay.GetPageText(getSelection()) != 'Map peaks') and not NPkey: 9270 9249 atColor = np.array(Gr)/255. 9271 9250 bndColor = atColor … … 9762 9741 9763 9742 def Draw(caller=''): 9764 #useful debug?9765 # if caller:9766 # print caller9767 # end of useful debug9768 9743 cPos = defaults['cameraPos'] 9769 9744 VS = np.array(Page.canvas.GetSize())
Note: See TracChangeset
for help on using the changeset viewer.