Changeset 5250 for trunk


Ignore:
Timestamp:
Mar 24, 2022 10:07:33 PM (3 years ago)
Author:
toby
Message:

fixes for wx4.1; cleanup for Rigid Body GUI

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/GSASIIconstrGUI.py

    r5239 r5250  
    20272027            pass
    20282028        elif 'Residue' in G2frame.rbBook.GetPageText(page):
    2029             ImportResidueRB()
    2030            
     2029            try:
     2030                ImportResidueRB()
     2031            except Exception as msg:
     2032                print('Error reading .xyz file\n  Error msg:',msg)
     2033                if GSASIIpath.GetConfigValue('debug'):
     2034                    import traceback
     2035                    print (traceback.format_exc())
     2036                   
    20312037    def OnSaveRigidBody(event):
    20322038        page = G2frame.rbBook.GetSelection()
     
    31233129                Indx[delRB.GetId()] = rbid
    31243130                nameSizer.Add(delRB,0,WACV)
     3131            nameSizer.Add((-1,-1),1,wx.EXPAND,1)
     3132            nameSizer.Add(G2G.HelpButton(VectorRBDisplay,helpIndex=G2frame.dataWindow.helpKey))
    31253133            return nameSizer
    31263134           
     
    31873195            magSizer = wx.BoxSizer(wx.HORIZONTAL)
    31883196            magSizer.Add(wx.StaticText(VectorRBDisplay,-1,'Translation magnitude: '),0,WACV)
    3189             magValue = wx.TextCtrl(VectorRBDisplay,-1,'%8.4f'%(rbData['VectMag'][imag]))
     3197            magValue = wx.TextCtrl(VectorRBDisplay,-1,'%8.4f'%(rbData['VectMag'][imag]),
     3198                                       style=wx.TE_PROCESS_ENTER)
    31903199            Indx[magValue.GetId()] = [rbid,imag]
    31913200            magValue.Bind(wx.EVT_TEXT_ENTER,OnRBVectorMag)
     
    33253334        SetStatusLine(' You may use e.g. "c60" or "s60" for a vector entry')
    33263335        FillRefChoice(resRBsel,rbData)
    3327         VectorRBSizer.Add(rbNameSizer(resRBsel,rbData),0)
     3336        VectorRBSizer.Add(rbNameSizer(resRBsel,rbData),0,wx.EXPAND)
    33283337        VectorRBSizer.Add(rbRefAtmSizer(resRBsel,rbData),0)
    33293338        XYZ = np.array([[0.,0.,0.] for Ty in rbData['rbTypes']])
     
    34243433            nameSizer.Add(wx.StaticText(ResidueRBDisplay,-1,'  body type #'+
    34253434                                        str(data['RBIds']['Residue'].index(rbid))),0,WACV)
     3435            nameSizer.Add((-1,-1),1,wx.EXPAND,1)
     3436            nameSizer.Add(G2G.HelpButton(ResidueRBDisplay,helpIndex=G2frame.dataWindow.helpKey))
    34263437            return nameSizer
    34273438           
     
    35493560            atNames = rbData['atNames']
    35503561            rbRef = rbData['rbRef']
     3562            refHelpInfo = '''
     3563* The "Orientation Reference" control defines the Cartesian
     3564axes for rigid bodies with the three atoms, A, B and C.
     3565The vector from B to A defines the x-axis and the y axis is placed
     3566in the plane defined by B to A and C to A. A,B,C must not be collinear.
     3567 
     3568%%* The origin is at A unless the "Center RB?" button is pressed.
     3569
     3570%%* The 'Cycle XYZ' button will permute the rigid body XYZ coordinates so
     3571XYZ --> ZXY. Repeat if needed.
     3572
     3573%%* The "Center RB?" button will shift the origin of the
     3574rigid body to be the midpoint of all atoms in the body (not mass weighted).
     3575'''
     3576            hlp = G2G.HelpButton(ResidueRBDisplay,refHelpInfo,wrap=400)
     3577            refAtmSizer.Add(hlp,0,wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL,2)
     3578            refAtmSizer2 = None
    35513579            if rbData['rbRef'][3] or rbData['useCount']:
    35523580                refAtmSizer.Add(wx.StaticText(ResidueRBDisplay,-1,
     
    35663594                    refObj[i] = refSel
    35673595                    refAtmSizer.Add(refSel,0,WACV)
     3596                refAtmSizer.Add((50,-1))   # moves the help button out a bit
    35683597                RefObjs.append(refObj)
     3598                refAtmSizer2 = wx.BoxSizer(wx.HORIZONTAL)
    35693599                cycleXYZ = wx.Button(ResidueRBDisplay,label=' Cycle XYZ?')
    35703600                cycleXYZ.Bind(wx.EVT_BUTTON,OnCycleXYZ)
    35713601                Indx[cycleXYZ.GetId()] = resGrid
    3572                 refAtmSizer.Add(cycleXYZ,0,WACV)
     3602                refAtmSizer2.Add(cycleXYZ,0,WACV)
    35733603                if 'molCent' not in rbData: rbData['molCent'] = False           #patch
    35743604                molcent = wx.Button(ResidueRBDisplay,label=' Center RB?')
    35753605                molcent.Bind(wx.EVT_BUTTON,OnMolCent)
    35763606                Indx[molcent.GetId()] = resGrid
    3577                 refAtmSizer.Add(molcent,0,WACV)
    3578                 refHelpInfo = '''
    3579 * The "Orientation Reference" control defines the Cartesian
    3580 axes for rigid bodies with the three atoms, A, B and C.
    3581 The vector from B to A defines the x-axis and the y axis is placed
    3582 in the plane defined by B to A and C to A. A,B,C must not be collinear.
    3583  
    3584 %%* The origin is at A unless the "Center RB?" button is pressed.
    3585 
    3586 %%* The 'Cycle XYZ' button will permute the rigid body XYZ coordinates so
    3587 XYZ --> ZXY. Repeat if needed.
    3588 
    3589 %%* The "Center RB?" button will shift the origin of the
    3590 rigid body to be the midpoint of all atoms in the body (not mass weighted).
    3591 '''
    3592                 hlp = G2G.HelpButton(ResidueRBDisplay,refHelpInfo,wrap=400)
    3593                 refAtmSizer.Add(hlp,0,wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL,2)
     3607                refAtmSizer2.Add(molcent,0,WACV)
    35943608           
    35953609            mainSizer = wx.BoxSizer(wx.VERTICAL)
    3596             mainSizer.Add(refAtmSizer)
     3610            mainSizer.Add(refAtmSizer,0,wx.EXPAND)
     3611            if refAtmSizer2: mainSizer.Add(refAtmSizer2)
    35973612            mainSizer.Add(vecSizer)
    35983613            return mainSizer
     
    37453760        rbData = data['Residue'][resRBsel]
    37463761        FillRefChoice(resRBsel,rbData)
    3747         ResidueRBSizer.Add(rbNameSizer(resRBsel,rbData),0)
     3762        ResidueRBSizer.Add(rbNameSizer(resRBsel,rbData),0,wx.EXPAND)
    37483763        ResidueRBSizer.Add(rbResidues(resRBsel,rbData),0)
    37493764        if len(rbData['rbSeq']):
     
    37703785        Size[1] = max(Size[1],450) + 20
    37713786        ResidueRB.SetSize(Size)
    3772         ResidueRB.SetScrollbars(10,10,int(Size[0]/10-4),int(Size[1]/10-1))
     3787        #ResidueRB.SetScrollbars(10,10,int(Size[0]/10-4),int(Size[1]/10-1)) # dataframe already scrolls
    37733788        G2frame.dataWindow.SendSizeEvent()
    37743789       
  • TabularUnified trunk/GSASIIphsGUI.py

    r5248 r5250  
    24332433            if len(Map['RefList']) and not generalData['Modulated']:
    24342434                if all(['PWDR' in map for map in Map['RefList']]):
    2435                     Dysno = wx.CheckBox(General,-1,label=' Use Dysnomia (Max. Ent. Method)?')
     2435                    Dysno = wx.CheckBox(General,-1,label=' Use Dysnomia?')
    24362436                    Dysno.SetValue(generalData['doDysnomia'])
    24372437                    Dysno.Bind(wx.EVT_CHECKBOX,OnDysnomia)
    24382438                    line2Sizer.Add(Dysno,0,WACV)
     2439                    hlpText = '''Dysnomia uses the maximum entropy method
     2440                    to compute intensities for unobserved reflections.
     2441                    '''
     2442                    hlp = G2G.HelpButton(General,hlpText)
     2443                    line2Sizer.Add(hlp,0,WACV)
    24392444            mapSizer.Add(line2Sizer,0)
    24402445            return mapSizer
     
    35293534                Atoms.SetReadOnly(row,colSS,True)                         #site sym
    35303535                Atoms.SetReadOnly(row,colSS+1,True)                       #Mult
     3536            oldSizer = AtomList.GetSizer()
     3537            if oldSizer: oldSizer.Clear()  # get rid of the old sizer, if repeated call
    35313538            Atoms.AutoSizeColumns(False)
    35323539            mainSizer = wx.BoxSizer(wx.VERTICAL)
     
    89218928#### UpdateDrawAtoms executable code starts here
    89228929        G2frame.GetStatusBar().SetStatusText('',1)
     8930        oldSizer = drawAtomsList.GetSizer()
     8931        if oldSizer:
     8932            oldSizer.Clear()  # get rid of the old sizer, if repeated call
    89238933        generalData = data['General']
    89248934        SetupDrawingData()
     
    1329213302        # FillPawleyReflectionsGrid executable starts here
    1329313303        G2frame.GetStatusBar().SetStatusText('To delete a Pawley reflection: select row & press Delete',1)                       
     13304        oldSizer = PawleyRefList.GetSizer()
     13305        if oldSizer: oldSizer.Clear()
    1329413306        generalData = data['General']
    1329513307        PawleyPeaks = data['Pawley ref']
     
    1364613658        # beginning of FillMapPeaksGrid()
    1364713659        G2frame.GetStatusBar().SetStatusText('',1)
     13660        oldSizer = MapPeakList.GetSizer()
     13661        if oldSizer: oldSizer.Clear()
    1364813662        if 'Map Peaks' in data:
    1364913663            mainSizer = wx.BoxSizer(wx.VERTICAL)
  • TabularUnified trunk/GSASIIplot.py

    r5247 r5250  
    93299329        page = getSelection()
    93309330        if page:
    9331             if G2frame.phaseDisplay.GetPageText(page) == 'Draw Atoms':
    9332                 G2frame.phaseDisplay.GetPage(page).GetChildren()[0].ClearSelection()      #this is the Atoms grid in Draw Atoms
    9333             elif G2frame.phaseDisplay.GetPageText(page) == 'Map peaks':
    9334                 G2frame.phaseDisplay.GetPage(page).GetChildren()[0].ClearSelection()      #this is the Atoms grid in Atoms
    9335             elif G2frame.phaseDisplay.GetPageText(page) == 'Atoms':
    9336                 G2frame.phaseDisplay.GetPage(page).GetChildren()[0].ClearSelection()      #this is the Atoms grid in Atoms
    9337                
     9331            if G2frame.phaseDisplay.GetPageText(page) in (
     9332                    'Draw Atoms','Map peaks','Atoms'):
     9333                for widget in G2frame.phaseDisplay.GetPage(page).GetChildren():
     9334                    try:
     9335                        widget.ClearSelection()      # this is a grid
     9336                        break
     9337                    except AttributeError:
     9338                        pass               
    93389339                   
    93399340    def SetSelectedAtoms(ind,Add=False):
    93409341        page = getSelection()
    93419342        if page:
    9342             if G2frame.phaseDisplay.GetPageText(page) == 'Draw Atoms':
    9343                 G2frame.phaseDisplay.GetPage(page).GetChildren()[0].SelectRow(ind,Add)      #this is the Atoms grid in Draw Atoms
    9344             elif G2frame.phaseDisplay.GetPageText(page) == 'Map peaks':
    9345                 G2frame.phaseDisplay.GetPage(page).GetChildren()[0].SelectRow(ind,Add)                 
    9346             elif G2frame.phaseDisplay.GetPageText(page) == 'Atoms':
    9347                 Id = drawAtoms[ind][-3]
    9348                 for i,atom in enumerate(atomData):
    9349                     if atom[-1] == Id:
    9350                         G2frame.phaseDisplay.GetPage(page).GetChildren()[0].SelectRow(i,Add)      #this is the Atoms grid in Atoms
     9343            if G2frame.phaseDisplay.GetPageText(page) in (
     9344                    'Draw Atoms','Map peaks','Atoms'):
     9345                for widget in G2frame.phaseDisplay.GetPage(page).GetChildren():
     9346                    if hasattr(widget,'GetSelectedRows'): break
     9347                else:
     9348                    return
     9349                if G2frame.phaseDisplay.GetPageText(page) == 'Atoms':
     9350                    Id = drawAtoms[ind][-3]
     9351                    for i,atom in enumerate(atomData):
     9352                        if atom[-1] == Id:
     9353                            widget.SelectRow(i,Add)      #this is the Atoms grid in Atoms
     9354                else:
     9355                    widget.SelectRow(ind,Add)      # this is a grid
    93519356                 
    93529357    def GetSelectedAtoms():
     
    93549359        Ind = []
    93559360        if page:
    9356             if G2frame.phaseDisplay.GetPageText(page) == 'Draw Atoms':
    9357                 Ind = G2frame.phaseDisplay.GetPage(page).GetChildren()[0].GetSelectedRows()      #this is the Atoms grid in Draw Atoms
    9358             elif G2frame.phaseDisplay.GetPageText(page) == 'Map peaks':
    9359                 Ind = G2frame.phaseDisplay.GetPage(page).GetChildren()[0].GetSelectedRows()
    9360             elif G2frame.phaseDisplay.GetPageText(page) == 'Atoms':
    9361                 Ind = G2frame.phaseDisplay.GetPage(page).GetChildren()[0].GetSelectedRows()      #this is the Atoms grid in Atoms
     9361            if G2frame.phaseDisplay.GetPageText(page) in (
     9362                    'Draw Atoms','Map peaks','Atoms'):
     9363                for widget in G2frame.phaseDisplay.GetPage(page).GetChildren():
     9364                    try:
     9365                        Ind = widget.GetSelectedRows()      # this is a grid
     9366                        break
     9367                    except AttributeError:
     9368                        pass
    93629369            elif G2frame.phaseDisplay.GetPageText(page) == 'RB Models':
    93639370                if 'testRBObj' not in data: return []
  • TabularUnified trunk/help/gsasII-phase.html

    r5249 r5250  
    51705170<p class=MsoListParagraphCxSpMiddle style='margin-left:1.0in;mso-add-space:
    51715171auto;text-indent:-.25in;mso-list:l9 level1 lfo14;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><a
    5172 name=Pawley><![if !supportLists]><span style='mso-fareast-font-family:"Times New Roman"'><span
     5172name="Phase-Pawley_reflections"><![if !supportLists]><span style='mso-fareast-font-family:"Times New Roman"'><span
    51735173style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    51745174</span></span></span><![endif]>Select the </a><span class=SpellE><span
     
    57655765</span></div>
    57665766
    5767 <p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"'><!-- hhmts start -->Last
    5768 modified: Tue Jan 25 09:29:56 CST 2022 <!-- hhmts end --><o:p></o:p></span></p>
     5767<p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"'><!-- hhmts start -->Last modified: Thu Mar 24 16:28:36 CDT 2022 <!-- hhmts end --><o:p></o:p></span></p>
    57695768
    57705769</div>
Note: See TracChangeset for help on using the changeset viewer.