Changeset 2276


Ignore:
Timestamp:
May 16, 2016 3:22:10 PM (8 years ago)
Author:
vondreele
Message:

show plotted layer names on plot status bar

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r2272 r2276  
    27982798                Xi,c =  event.GetRow(),event.GetCol()
    27992799                if Xi >= 0 and c == 5:   #plot column
    2800                     Obj.SetCellValue(Xi,5,'')
    28012800                    G2plt.PlotLayers(G2frame,Layers,[Yi,Xi,],plotDefaults)
    28022801                else:
  • trunk/GSASIIplot.py

    r2272 r2276  
    59815981        Radii = []
    59825982        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':
    59855985                Radii[-1] = 0.5
    59865986        Radii = np.array(Radii)
     
    60076007                layer = Names.index(Layers['Layers'][layer]['SameAs'])
    60086008            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']]
    60106010            XYZ = np.array([atom[2:5] for atom in Layers['Layers'][layer]['Atoms']])
    60116011            if '-1' in Layers['Layers'][layer]['Symm']:
     
    60846084            im = im.transpose(Im.FLIP_TOP_BOTTOM)
    60856085            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
    60886091
    60896092    def OnPlotKeyPress(event):
    60906093        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()
    60946101        dx = 0.
    60956102        dy = 0.
     
    60996106            Draw('labels')
    61006107            return
     6108        elif keyCode =='F' and len(laySeq) == 2:
     6109            Page.fade = not Page.fade
    61016110        if len(laySeq) != 2:
    61026111            return
     
    61426151                SetRotation(newxy)
    61436152                Q = defaults['Quaternion']
    6144                 G2frame.G2plotNB.status.SetStatusText('New quaternion: %.2f+, %.2fi+ ,%.2fj+, %.2fk'%(Q[0],Q[1],Q[2],Q[3]),1)
    61456153            elif event.RightIsDown():
    61466154                SetTranslation(newxy)
     
    61496157                SetRotationZ(newxy)
    61506158                Q = defaults['Quaternion']
    6151                 G2frame.G2plotNB.status.SetStatusText('New quaternion: %.2f+, %.2fi+ ,%.2fj+, %.2fk'%(Q[0],Q[1],Q[2],Q[3]),1)
    61526159            Draw('move')
    61536160       
     
    61556162        defaults['cameraPos'] += event.GetWheelRotation()/24
    61566163        defaults['cameraPos'] = max(10,min(500,defaults['cameraPos']))
    6157         G2frame.G2plotNB.status.SetStatusText('New camera distance: %.2f'%(defaults['cameraPos']),1)
    61586164        Draw('wheel')
    61596165       
     
    63206326        glTranslate(-Tx,-Ty,-Tz)
    63216327        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
    63236333        glShadeModel(GL_SMOOTH)
    63246334        for iat,atom in enumerate(XYZ):
    63256335            x,y,z = atom
    6326             CL = AtInfo[AtTypes[iat]]['Color']
     6336            CL = AtInfo[AtTypes[iat][0]]['Color']
    63276337            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)
    63306342            if Page.labels:
    63316343                RenderLabel(x,y,z,'  '+AtNames[iat],matRot)
     
    63496361        Page.views = False
    63506362        Page.labels = False
     6363        Page.fade = False
    63516364        view = False
    63526365        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']
    63546369    Page.keyPress = OnPlotKeyPress
    63556370    G2frame.G2plotNB.RaisePageNoRefresh(Page)
     
    63576372    cb = wx.ComboBox(G2frame.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY,choices=choice)
    63586373    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)
    63636376    Page.canvas.Bind(wx.EVT_MOUSEWHEEL, OnMouseWheel)
    63646377    Page.canvas.Bind(wx.EVT_LEFT_DOWN, OnMouseDown)
Note: See TracChangeset for help on using the changeset viewer.