Changeset 4809 for trunk/GSASIIphsGUI.py


Ignore:
Timestamp:
Feb 10, 2021 3:49:46 PM (10 months ago)
Author:
toby
Message:

display more Residue rigid body info; better docs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r4803 r4809  
    8989acosd = lambda x: 180.*np.arccos(x)/np.pi
    9090atan2d = lambda x,y: 180.*np.arctan2(y,x)/np.pi
     91
     92# previous rigid body selections
     93prevResId = None
     94prevVecId = None
    9195
    9296if '2' in platform.python_version_tuple()[0]:
     
    98069810        Note that the page is a ScrolledWindow, not a Grid
    98079811        '''
     9812        resVarLookup = []
    98089813        def OnThermSel(event):       #needs to be seen by VecRbSizer!
    98099814            Obj = event.GetEventObject()
     
    99559960            return rbSizer
    99569961                         
    9957         def ResrbSizer(RBObj):
    9958            
     9962        def ResrbSizer(RBObj,resIndx):
     9963            '''Displays details for selected rigid body'''
    99599964            def OnTorsionRef(event):
    99609965                Obj = event.GetEventObject()
     
    1000510010                topLine.Add(wx.StaticText(RigidBodies,-1,
    1000610011                    '   Rigid body {} axis is aligned along oriention vector'.format(lbl)),0,WACV)
     10012            varname = str(data['pId'])+'::RBRxxx:'+resVarLookup[resIndx]
     10013            topLine.Add(wx.StaticText(RigidBodies,-1,
     10014                    '  (variables '+varname+')'),0,WACV)
    1000710015            resrbSizer.Add(topLine)
    1000810016            resrbSizer.Add(LocationSizer(RBObj,'Residue'))
     
    1007310081       
    1007410082        def OnVecSelect(event):
    10075             rbId = select.GetSelection()
    10076             wx.CallLater(100,RepaintRBInfo,'Vector',rbId)
     10083            global prevVecId
     10084            prevVecId = select.GetSelection()
     10085            wx.CallLater(100,RepaintRBInfo,'Vector',prevVecId)
    1007710086           
    1007810087        def OnResSelect(event):
    10079             rbId = resSelect.GetSelection()
    10080             wx.CallLater(100,RepaintRBInfo,'Residue',rbId)
     10088            global prevResId
     10089            prevResId = resSelect.GetSelection()
     10090            wx.CallLater(100,RepaintRBInfo,'Residue',prevResId)
    1008110091           
    10082         def RepaintRBInfo(rbType,rbId,Scroll=0):
     10092        def RepaintRBInfo(rbType,rbIndx,Scroll=0):
    1008310093            oldFocus = wx.Window.FindFocus()
    1008410094            if 'phoenix' in wx.version():
     
    1008710097                G2frame.bottomSizer.DeleteWindows()
    1008810098            Indx.clear()
    10089             rbObj = data['RBModels'][rbType][rbId]
     10099            rbObj = data['RBModels'][rbType][rbIndx]
    1009010100            data['Drawing']['viewPoint'][0] = rbObj['Orig'][0]
    1009110101            Quad = rbObj['Orient'][0]
    1009210102            data['Drawing']['Quaternion'] = G2mth.invQ(Quad)
    10093             G2frame.bottomSizer =  ResrbSizer(rbObj)
     10103            G2frame.bottomSizer =  ResrbSizer(rbObj,rbIndx)
    1009410104            mainSizer.Add(G2frame.bottomSizer)
    1009510105            mainSizer.Layout()
     
    1013210142            mainSizer.Add((5,5),0)
    1013310143            RBnames = []
    10134             for RBObj in data['RBModels']['Residue']:
    10135                 RBnames.append(RBObj['RBname']+RBObj['numChain'])
    10136             if resId is None:
     10144            resVarLookup = []
     10145            for irb,RBObj in enumerate(data['RBModels']['Residue']):
     10146                name = RBObj['RBname']+RBObj['numChain']
     10147                RBnames.append(name)
     10148                jrb = RBData['RBIds']['Residue'].index(RBObj['RBId'])
     10149                resVarLookup.append(str(irb)+':'+str(jrb)) # var name suffix following G2strMath.ApplyRBModels()
     10150            if prevResId is not None:
     10151                resId = prevResId
     10152            try:
     10153                rbName = RBnames[resId]
     10154            except TypeError:
    1013710155                resId = 0
    10138             rbName = RBnames[resId]
     10156                rbName = RBnames[resId]
    1013910157            rbObj = data['RBModels']['Residue'][resId]
    1014010158            data['Drawing']['viewPoint'][0] = rbObj['Orig'][0]
     
    1014610164            mainSizer.Add(resSelect,0)
    1014710165            G2frame.bottomSizer = wx.BoxSizer(wx.VERTICAL)
    10148             G2frame.bottomSizer.Add(ResrbSizer(rbObj))
     10166            G2frame.bottomSizer.Add(ResrbSizer(rbObj,resId))
    1014910167            mainSizer.Add(G2frame.bottomSizer)
    1015010168            G2plt.PlotStructure(G2frame,data)
     
    1015810176            for RBObj in data['RBModels']['Vector']:
    1015910177                RBnames.append(RBObj['RBname'])
    10160             if vecId is None:
     10178            if prevVecId is not None:
     10179                vecId = prevVecId
     10180            try:
     10181                rbName = RBnames[vecId]
     10182            except TypeError:
    1016110183                vecId = 0
    10162             rbName = RBnames[vecId]
     10184                rbName = RBnames[vecId]
    1016310185            rbObj = data['RBModels']['Vector'][vecId]
    1016410186            data['Drawing']['viewPoint'][0] = rbObj['Orig'][0]
Note: See TracChangeset for help on using the changeset viewer.