Changeset 2593


Ignore:
Timestamp:
Dec 17, 2016 9:24:00 PM (5 years ago)
Author:
toby
Message:

Add Pawley settings menu item; open Phases and selected data tree item on GPX open

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2586 r2593  
    32203220       
    32213221        Id = 0
     3222        phaseId = None
    32223223        G2IO.ProjFileOpen(self)
    32233224        self.PatternTree.SetItemText(self.root,'Loaded Data: '+self.GSASprojectfile)
     
    32293230            if name[:4] in ['PWDR','HKLF','IMG ','PDF ','SASD',]:
    32303231                Id = item
     3232            elif name == "Phases":
     3233                phaseId = item
    32313234            elif name == 'Controls':
    32323235                data = self.PatternTree.GetItemPyData(item)
     
    32383241            self.EnablePlot = True
    32393242            self.PatternTree.SelectItem(Id)
     3243            self.PatternTree.Expand(Id)
     3244        elif phaseId:
     3245            self.PatternTree.SelectItem(phaseId)
     3246        if phaseId:
     3247            self.PatternTree.Expand(phaseId)
    32403248        self.CheckNotebook()
    32413249        if self.dirname: os.chdir(self.dirname)           # to get Mac/Linux to change directory!
  • trunk/GSASIIgrid.py

    r2579 r2593  
    9090
    9191[ wxID_PAWLEYLOAD, wxID_PAWLEYESTIMATE, wxID_PAWLEYUPDATE, wxID_PAWLEYSELALL, wxID_PAWLEYSELNONE,
    92   wxID_PAWLEYSELTOGGLE,
    93 ] = [wx.NewId() for item in range(6)]
     92  wxID_PAWLEYSELTOGGLE, wxID_PAWLEYSET,
     93] = [wx.NewId() for item in range(7)]
    9494
    9595[ wxID_IMCALIBRATE,wxID_IMRECALIBRATE,wxID_IMINTEGRATE, wxID_IMCLEARCALIB,wxID_IMRECALIBALL, 
     
    24322432        self.PawleyEdit = wx.Menu(title='')
    24332433        self.PawleyMenu.Append(menu=self.PawleyEdit,title='Operations')
     2434        self.PawleyEdit.Append(id=wxID_PAWLEYSET, kind=wx.ITEM_NORMAL,text='Pawley settings',
     2435            help='Change Pawley refinement settings')
    24342436        self.PawleyEdit.Append(id=wxID_PAWLEYLOAD, kind=wx.ITEM_NORMAL,text='Pawley create',
    24352437            help='Initialize Pawley reflection list')
  • trunk/GSASIIphsGUI.py

    r2588 r2593  
    2626import wx.lib.scrolledpanel as wxscroll
    2727import matplotlib as mpl
     28import math
    2829import copy
    2930import time
     
    72117212            G2frame.dataFrame.setSizePosLeft([450,300])
    72127213                   
     7214    def OnPawleySet(event):
     7215        '''Set Pawley parameters and optionally recompute
     7216        '''
     7217        #GSASIIpath.IPyBreak()
     7218       
     7219        def DisablePawleyOpts(*args):
     7220            pawlVal.Enable(generalData['doPawley'])
     7221            pawlNegWt.Enable(generalData['doPawley'])
     7222        generalData = data['General']
     7223        startDmin = generalData['Pawley dmin']
     7224        General = wx.Dialog(G2frame.dataFrame,wx.ID_ANY,'Set Pawley Parameters',
     7225                        style=wx.DEFAULT_DIALOG_STYLE)
     7226        mainSizer = wx.BoxSizer(wx.VERTICAL)
     7227        mainSizer.Add(wx.StaticText(General,wx.ID_ANY,
     7228                                    'Set Pawley Extraction Parameters for phase '+
     7229                                    generalData.get('Name','?')))
     7230        mainSizer.Add([5,10])
     7231        pawleySizer = wx.BoxSizer(wx.HORIZONTAL)
     7232        pawleySizer.Add(wx.StaticText(General,label=' Do Pawley refinement?: '),0,WACV)
     7233        pawlRef = G2G.G2CheckBox(General,'',generalData,'doPawley',
     7234                             DisablePawleyOpts)
     7235        pawleySizer.Add(pawlRef,0,WACV)
     7236        mainSizer.Add(pawleySizer)
     7237        pawleySizer = wx.BoxSizer(wx.HORIZONTAL)
     7238        pawleySizer.Add(wx.StaticText(General,label=' Pawley dmin: '),0,WACV)
     7239        def d2Q(*a,**kw):
     7240            temp['Qmax'] = 2 * math.pi / generalData['Pawley dmin']
     7241            pawlQVal.SetValue(temp['Qmax'])
     7242        pawlVal = G2G.ValidatedTxtCtrl(General,generalData,'Pawley dmin',
     7243               min=0.25,max=20.,nDig=(10,5),typeHint=float,OnLeave=d2Q)
     7244        pawleySizer.Add(pawlVal,0,WACV)
     7245        pawleySizer.Add(wx.StaticText(General,label='   Qmax: '),0,WACV)
     7246        temp = {'Qmax':2 * math.pi / generalData['Pawley dmin']}
     7247        def Q2D(*args,**kw):
     7248            generalData['Pawley dmin'] = 2 * math.pi / temp['Qmax']
     7249            pawlVal.SetValue(generalData['Pawley dmin'])       
     7250        pawlQVal = G2G.ValidatedTxtCtrl(General,temp,'Qmax',
     7251               min=0.314,max=25.,nDig=(10,5),typeHint=float,OnLeave=Q2D)
     7252        pawleySizer.Add(pawlQVal,0,WACV)
     7253        mainSizer.Add(pawleySizer)
     7254        pawleySizer = wx.BoxSizer(wx.HORIZONTAL)
     7255        pawleySizer.Add(wx.StaticText(General,label=' Pawley neg. wt.: '),0,WACV)
     7256        pawlNegWt = G2G.ValidatedTxtCtrl(General,generalData,'Pawley neg wt',
     7257                    min=0.,max=1.,nDig=(10,4),typeHint=float)
     7258        pawleySizer.Add(pawlNegWt,0,WACV)
     7259        mainSizer.Add(pawleySizer)
     7260
     7261        # make OK button
     7262        def OnOK(event): General.EndModal(wx.ID_OK)
     7263        mainSizer.Add([5,5])
     7264        btnsizer = wx.StdDialogButtonSizer()
     7265        btn = wx.Button(General, wx.ID_OK)
     7266        btn.Bind(wx.EVT_BUTTON, OnOK)
     7267        btn.SetDefault()
     7268        btnsizer.AddButton(btn)
     7269        btn = wx.Button(General, wx.ID_CANCEL)
     7270        btnsizer.AddButton(btn)
     7271        btnsizer.Realize()
     7272        mainSizer.Add(btnsizer, 0, wx.ALIGN_CENTER|wx.ALL, 5)
     7273
     7274        General.SetSizer(mainSizer)
     7275        mainSizer.Fit(General)
     7276        res = General.ShowModal()
     7277        General.Destroy()
     7278
     7279        if generalData['doPawley'] and res == wx.ID_OK and startDmin != generalData['Pawley dmin']:
     7280            dlg = wx.MessageDialog(G2frame,'Do you want to initialize the Pawley reflections with the new Dmin value?','Initialize Pawley?',
     7281                wx.YES_NO | wx.ICON_QUESTION)
     7282            try:
     7283                result = dlg.ShowModal()
     7284                if result == wx.ID_NO:
     7285                    return
     7286            finally:
     7287                dlg.Destroy()
     7288            OnPawleyLoad(event)
     7289           
    72137290    def OnPawleyLoad(event):
    72147291        generalData = data['General']
     
    79798056        # Pawley reflections
    79808057        FillSelectPageMenu(TabSelectionIdDict, G2frame.dataFrame.PawleyMenu)
     8058        G2frame.dataFrame.Bind(wx.EVT_MENU, OnPawleySet, id=G2gd.wxID_PAWLEYSET)
    79818059        G2frame.dataFrame.Bind(wx.EVT_MENU, OnPawleyLoad, id=G2gd.wxID_PAWLEYLOAD)
    79828060        G2frame.dataFrame.Bind(wx.EVT_MENU, OnPawleyEstimate, id=G2gd.wxID_PAWLEYESTIMATE)
Note: See TracChangeset for help on using the changeset viewer.