Changeset 2745


Ignore:
Timestamp:
Mar 6, 2017 2:12:32 PM (6 years ago)
Author:
vondreele
Message:

fixes to SetPhaseWindow? so scroll is over entire range of grids & windows have useful min size
fix to OnAtQPick in rigid body selection to handle parallel/antiparallel RBs & target atoms

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIddataGUI.py

    r2741 r2745  
    10121012                      0,WACV|wx.TOP,10)
    10131013       
    1014     G2phsGUI.SetPhaseWindow(G2frame.dataFrame,DData,mainSizer,Scroll)
     1014    G2phsGUI.SetPhaseWindow(G2frame.dataFrame,DData,mainSizer,Scroll=Scroll)
  • trunk/GSASIIphsGUI.py

    r2737 r2745  
    6767atan2d = lambda x,y: 180.*np.arctan2(y,x)/np.pi
    6868
    69 def SetPhaseWindow(mainFrame,phasePage,mainSizer=None,Size=None,Scroll=0):
     69def SetPhaseWindow(mainFrame,phasePage,mainSizer=None,size=None,Scroll=0):
    7070    if not mainSizer is None:
    7171        phasePage.SetSizer(mainSizer)
    7272        Size = mainSizer.GetMinSize()
     73    else:
     74        Size = phasePage.GetBestSize()
    7375    Size[0] += 40
    74     Size[1] = min(Size[1]+ 150,500)
    7576    phasePage.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1)
    7677    phasePage.Scroll(0,Scroll)
    77     Size[1] = min(500,Size[1])
    78     mainFrame.setSizePosLeft(Size)
     78    if size is None:
     79        Size[1] = min(Size[1]+ 150,500)
     80#        Size[1] = min(500,Size[1])
     81        mainFrame.setSizePosLeft(Size)
     82    else:
     83        size[1] = min(500,size[1])
     84        mainFrame.setSizePosLeft(size)
    7985   
    8086def FindBondsDraw(data):   
     
    13591365            mainSizer.Add(MCSASizer())
    13601366        G2frame.dataFrame.SetStatusText('')
    1361         SetPhaseWindow(G2frame.dataFrame,General,mainSizer,Scroll)
     1367        SetPhaseWindow(G2frame.dataFrame,General,mainSizer,Scroll=Scroll)
    13621368       
    13631369    def OnTransform(event):
     
    17841790                            Atoms.SetCellStyle(row,c,VERY_LIGHT_GREY,True)
    17851791            Atoms.AutoSizeColumns(False)
    1786             SetPhaseWindow(G2frame.dataFrame,Atoms,Size=[700,300])
     1792            SetPhaseWindow(G2frame.dataFrame,Atoms,size=[700,300])
    17871793
    17881794        # FillAtomsGrid executable code starts here
     
    42054211           if colLabels[c] not in ['Style','Label','Color']:
    42064212                drawAtoms.SetColAttr(c,attr)
    4207         SetPhaseWindow(G2frame.dataFrame,drawAtoms,Size=[600,300])
     4213        SetPhaseWindow(G2frame.dataFrame,drawAtoms,size=[600,300])
    42084214
    42094215        FindBondsDraw(data)
     
    62306236                data['testRBObj']['AtNames'] = AtNames
    62316237                data['testRBObj']['rbObj'] = {'Orig':[[0,0,0],False],
    6232                     'Orient':[[0.,0.,0.,1.],' '],'Ids':[],'RBId':rbId,'Torsions':[],
     6238                    'Orient':[[0.,0.,0.,0.],' '],'Ids':[],'RBId':rbId,'Torsions':[],
    62336239                    'numChain':'','RBname':RBData[rbType][rbId]['RBname']}
    62346240                data['testRBObj']['torAtms'] = []               
     
    62956301                VBC = np.inner(Amat,np.array(atomData[atInd[2]][cx:cx+3]-Orig))
    62966302                VCC = np.cross(VAR,VAC)
    6297                 QuatA = G2mth.makeQuat(VAR,VAC,VCC)[0]
    6298                 VAR = G2mth.prodQVQ(QuatA,VAR)
    6299                 VBR = G2mth.prodQVQ(QuatA,VBR)
    6300                 QuatB = G2mth.makeQuat(VBR,VBC,VAR)[0]
    6301                 QuatC = G2mth.prodQQ(QuatB,QuatA)
     6303                if nl.norm(VCC) > 1e-7:
     6304                    QuatA = G2mth.makeQuat(VAR,VAC,VCC)[0]
     6305                    VAR = G2mth.prodQVQ(QuatA,VAR)
     6306                    VBR = G2mth.prodQVQ(QuatA,VBR)
     6307                    QuatB = G2mth.makeQuat(VBR,VBC,VAR)[0]
     6308                    QuatC = G2mth.prodQQ(QuatB,QuatA)
     6309                else:                               #parallel/antiparallel
     6310                    if np.dot(VAR,VAC)/(nl.norm(VAR)*nl.norm(VAC)) > 1e-7:  #no rotation
     6311                        QuatC = G2mth.AVdeg2Q(0.,[0.,0.,1.])
     6312                    else:
     6313                        QuatC = G2mth.AVdeg2Q(180.,VBR+VBC)
    63026314                data['testRBObj']['rbObj']['Orient'] = [QuatC,' ']
    63036315                for x,item in zip(QuatC,Osizers):
     
    72377249            G2frame.PawleyRefl.SetMargins(0,0)
    72387250            G2frame.PawleyRefl.AutoSizeColumns(False)
    7239             SetPhaseWindow(G2frame.dataFrame,G2frame.PawleyRefl,Size=[450,300])
     7251            SetPhaseWindow(G2frame.dataFrame,G2frame.PawleyRefl,size=[450,300])
    72407252                   
    72417253    def OnPawleySet(event):
     
    75387550            MapPeaks.SetMargins(0,0)
    75397551            MapPeaks.AutoSizeColumns(False)
    7540             SetPhaseWindow(G2frame.dataFrame,MapPeaks,Size=[440,300])
     7552            SetPhaseWindow(G2frame.dataFrame,MapPeaks,size=[440,300])
    75417553                   
    75427554    def OnPeaksMove(event):
Note: See TracChangeset for help on using the changeset viewer.