Changeset 3356


Ignore:
Timestamp:
Apr 24, 2018 2:34:13 PM (4 years ago)
Author:
vondreele
Message:

remove commented out SetTitle? & SetLabel? for data window from various places. Title is now gpx file name.
reconfigure restraints to show phase name subentries in tree - selection done from tree.
import phase, add phase & delete phase all handle restraints in new scheme
use of restraints unaffected as restraint data layout unchanged

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIconstrGUI.py

    r3355 r3356  
    11221122       
    11231123    G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.ConstraintMenu)
    1124     #G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Constraints')
    1125     #G2frame.SetTitle('Constraints')
    11261124    SetStatusLine('')
    11271125   
     
    21452143
    21462144    G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RigidBodyMenu)
    2147     #G2frame.SetTitle('Rigid bodies')
    21482145    SetStatusLine('')
    21492146    UpdateVectorRB()
  • trunk/GSASIIdataGUI.py

    r3355 r3356  
    885885            psub = self.GPXtree.AppendItem(parent=sub,text=PhaseName)
    886886            self.GPXtree.SetItemPyData(psub,rd.Phase)
     887            wx.CallAfter(self.GPXtree.SelectItem,psub) # should call SelectDataTreeItem
     888#            self.GPXtree.SelectItem(psub)
    887889            try:
    888890                rd.MPhase['General']['Name'] = G2obj.MakeUniqueLabel(PhaseName+' mag',phaseNameList)
     
    891893                psub = self.GPXtree.AppendItem(parent=sub,text=PhaseName)
    892894                self.GPXtree.SetItemPyData(psub,rd.MPhase)
     895#                self.GPXtree.SelectItem(psub)
     896                wx.CallAfter(self.GPXtree.SelectItem,psub) # should call SelectDataTreeItem
    893897            except (AttributeError,TypeError):
    894898                pass
     
    897901            self.GPXtree.Expand(psub)
    898902            self.PickIdText = None
    899             wx.CallAfter(self.GPXtree.SelectItem,psub) # should call SelectDataTreeItem
    900             #wx.CallAfter(SelectDataTreeItem,self,psub) #bring up new phase General tab
    901903
    902904            if rd.Constraints:
     
    28942896                if item.IsOk(): self.GPXtree.SelectItem(item)
    28952897                   
    2896 #     def SetTitle(self,text,location=0):
    2897 #         '''Override the standard method with a call that puts text into
    2898 #         either the top box on the tree or the label on the frame.
    2899 
    2900 #         :param str text: text to be displayed
    2901 #         :param int location: if 0 (default) labels go into the the Frame;
    2902 #           if 1, labels go into the G2frame.treeTitle control, which is above the
    2903 #           data Tree.
    2904 #         '''
    2905 #         if location == 1:
    2906 # #            self.treeTitle.SetLabel(text)
    2907 #             pass
    2908 #         elif not location:
    2909 #             wx.Frame.SetTitle(self,text)
    2910 #         else:
    2911 #             print(u'unexpected SetTitle option: '+str(location)+", "+
    2912 #                   text)     
    2913 #     def SetLabel(self,text,location=0):
    2914 #         'implement unfortunate synonym. with luck no longer used'
    2915 #         self.SetTitle(text,location=0)
    2916 
    29172898    def OnColMetaTest(self,event):
    29182899        'Test the .par/.*lbls pair for contents'
     
    34223403            PhaseName = dlg.GetValue()
    34233404        dlg.Destroy()
     3405        if not GetGPXtreeItemId(self,self.root,'Restraints'):
     3406            subr = self.GPXtree.AppendItem(parent=self.root,text='Restraints')
     3407            self.GPXtree.SetItemPyData(subr,{PhaseName:{}})
     3408        else:
     3409            subr = GetGPXtreeItemId(self,self.root,'Restraints')
     3410            self.GPXtree.GetItemPyData(subr).update({PhaseName:{}})
     3411        self.GPXtree.AppendItem(parent=subr,text=PhaseName)
    34243412        sub = self.GPXtree.AppendItem(parent=sub,text=PhaseName)
    34253413        E,SGData = G2spc.SpcGroup('P 1')
     
    34393427        else:
    34403428            return
     3429        if GetGPXtreeItemId(self,self.root,'Restraints'):
     3430            subr = GetGPXtreeItemId(self,self.root,'Restraints')
     3431        else:
     3432            subr = 0
    34413433        if sub:
    34423434            item, cookie = self.GPXtree.GetFirstChild(sub)
     
    34693461                                    if item in refList:
    34703462                                        del(refList[item])
    3471 #                            self.GPXtree.SetItemPyData(Id,refList)
    34723463                        elif 'HKLF' in name:
    34733464                            data = self.GPXtree.GetItemPyData(item)
    34743465                            data[0] = {}
    3475 #                            self.GPXtree.SetItemPyData(item,data)
    34763466                           
    34773467                        item, cookie = self.GPXtree.GetNextChild(self.root, cookie)
    34783468            finally:
    34793469                dlg.Destroy()
     3470        if subr:        #remove restraints for deleted phase
     3471            DelList = [itm[1] for itm in DelList]
     3472            item, cookie = self.GPXtree.GetFirstChild(subr)
     3473            while item:
     3474                name = self.GPXtree.GetItemText(item)
     3475                if name in DelList:
     3476                    self.GPXtree.Delete(item)
     3477                item, cookie = self.GPXtree.GetNextChild(subr, cookie)               
    34803478               
    34813479    def OnRenameData(self,event):
     
    47174715
    47184716        # Restraints
    4719         G2G.Define_wxId('wxID_RESTRAINTADD', 'wxID_RESTSELPHASE', 'wxID_RESTDELETE', 'wxID_RESRCHANGEVAL',
     4717        G2G.Define_wxId('wxID_RESTRAINTADD', 'wxID_RESTDELETE', 'wxID_RESRCHANGEVAL',
    47204718            'wxID_RESTCHANGEESD', 'wxID_AARESTRAINTADD', 'wxID_AARESTRAINTPLOT',)
    47214719        self.RestraintTab = wx.Menu(title='')
    47224720        self.RestraintEdit = wx.Menu(title='')
    4723         self.RestraintEdit.Append(G2G.wxID_RESTSELPHASE,'Select phase','Select phase')
    47244721        self.RestraintEdit.Append(G2G.wxID_RESTRAINTADD,'Add restraints','Add restraints')
    47254722        self.RestraintEdit.Enable(G2G.wxID_RESTRAINTADD,True)    #gets disabled if macromolecule phase
     
    54015398            text.AppendText('\n')
    54025399                   
    5403     #G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Notebook')
    5404     #G2frame.SetTitle('Notebook')
    54055400    text = wx.TextCtrl(G2frame.dataWindow,wx.ID_ANY,
    54065401            style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER | wx.TE_DONTWRAP)
     
    54195414def UpdateComments(G2frame,data):                   
    54205415
    5421     #G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Comments')
    5422     #G2frame.SetTitle('Comments')
    54235416    lines = ""
    54245417    for line in data:
     
    56245617        G2frame.GetStatusBar().SetStatusText('',1)
    56255618    G2frame.dataWindow.ClearData()
    5626     #G2frame.dataWindow.SetupScrolling()
    5627     #G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Controls')
    5628     #G2frame.SetTitle('Controls')
    56295619    SetDataMenuBar(G2frame,G2frame.dataWindow.ControlsMenu)
    56305620    mainSizer = wx.BoxSizer(wx.VERTICAL)
     
    66536643
    66546644    SetDataMenuBar(G2frame,G2frame.dataWindow.SequentialMenu)
    6655     #G2frame.dataWindow.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Sequential refinement results')
    6656     #G2frame.SetTitle('Sequential refinement results')
    66576645    G2frame.Bind(wx.EVT_MENU, OnSelectUse, id=G2G.wxID_SELECTUSE)
    66586646    G2frame.Bind(wx.EVT_MENU, OnRenameSelSeq, id=G2G.wxID_RENAMESEQSEL)
     
    72787266    # Start of UpdatePWHKPlot
    72797267    data = G2frame.GPXtree.GetItemPyData(item)
    7280     #G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+G2frame.GPXtree.GetItemText(item))
    7281     #G2frame.SetTitle(G2frame.GPXtree.GetItemText(item))
    72827268#patches
    72837269    if not data:
     
    73147300    wtSizer = wx.BoxSizer(wx.HORIZONTAL)
    73157301    wtSizer.Add(wx.StaticText(G2frame.dataWindow,-1,' Weight factor: '),0,WACV)
    7316     wtval = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data[0],'wtFactor',nDig=(10,3),min=1.e-9)
    7317     wtSizer.Add(wtval,0,WACV)
     7302    wtSizer.Add(G2G.ValidatedTxtCtrl(G2frame.dataWindow,data[0],'wtFactor',nDig=(10,3),min=1.e-9),0,WACV)
    73187303#    if kind == 'PWDR':         #possible future compression feature; NB above patch as well
    73197304#        wtSizer.Add(wx.StaticText(G2frame.dataWindow,-1,' Compression factor: '),0,WACV)
     
    73287313    wtSizer.Add(wx.StaticText(G2frame.dataWindow,-1,' Histogram label: '),0,WACV)
    73297314    if 'histTitle' not in data[0]: data[0]['histTitle'] = ''
    7330     wtval = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data[0],'histTitle',typeHint=str,notBlank=False,
    7331                                  size=(300,-1))
    7332     wtSizer.Add(wtval,1,WACV)
    7333     mainSizer.Add(wtSizer,0,WACV|wx.EXPAND,1)
     7315    wtSizer.Add(G2G.ValidatedTxtCtrl(G2frame.dataWindow,data[0],'histTitle',typeHint=str,
     7316        notBlank=False,size=(300,-1)),1,WACV)
     7317    mainSizer.Add(wtSizer,0,WACV)
    73347318    if data[0].get('Dummy',False):
    73357319        simSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    76337617            data = G2frame.GPXtree.GetItemPyData(item)
    76347618            G2cnstG.UpdateRigidBodies(G2frame,data)
    7635         elif G2frame.GPXtree.GetItemText(item) == 'Restraints':
    7636             data = G2frame.GPXtree.GetItemPyData(item)
    7637             Phases = G2frame.GetPhaseData()
    7638             phaseName = ''
    7639             if Phases:
    7640                 phaseName = list(Phases.keys())[0]
    7641             G2restG.UpdateRestraints(G2frame,data,Phases,phaseName)
    76427619        elif G2frame.GPXtree.GetItemText(item).startswith('IMG '):
    76437620            G2frame.Image = item
    7644             #G2frame.SetTitle('Image Data')
    76457621            data = G2frame.GPXtree.GetItemPyData(GetGPXtreeItemId(
    76467622                G2frame,item,'Image Controls'))
     
    76787654            G2frame.dataWindow.GetSizer().Add(
    76797655                wx.StaticText(G2frame.dataWindow,wx.ID_ANY,'Select one phase to see its parameters'))
     7656        elif G2frame.GPXtree.GetItemText(item) == 'Restraints':
     7657            data = G2frame.GPXtree.GetItemPyData(item)
     7658#patch - put phases in restraint tree
     7659            names = G2frame.GetPhaseNames()
     7660            for name in names:
     7661                if not GetGPXtreeItemId(G2frame,item,name):
     7662                    G2frame.GPXtree.AppendItem(parent=item,text=name)
     7663                if name not in data:
     7664                    data[name] = {}
     7665#end patch           
     7666            G2frame.dataWindow.GetSizer().Add(
     7667                wx.StaticText(G2frame.dataWindow,wx.ID_ANY,'Select one phase to see its restraints'))
    76807668    ############################################################################
    76817669    # process second-level entries in tree           
     
    77017689        data = G2frame.GPXtree.GetItemPyData(item)
    77027690        G2phG.UpdatePhaseData(G2frame,item,data)
     7691    elif G2frame.GPXtree.GetItemText(parentID) == 'Restraints':
     7692        data = G2frame.GPXtree.GetItemPyData(parentID)
     7693        phaseName = G2frame.GPXtree.GetItemText(item)
     7694        if phaseName not in data:
     7695            data[phaseName] = {}
     7696        G2restG.UpdateRestraints(G2frame,data[phaseName],phaseName)
    77037697    elif G2frame.GPXtree.GetItemText(item) == 'Comments':
    77047698        SetDataMenuBar(G2frame,G2frame.dataWindow.DataCommentsMenu)
     
    77077701        UpdateComments(G2frame,data)
    77087702    elif G2frame.GPXtree.GetItemText(item) == 'Image Controls':
    7709         #G2frame.SetTitle('Image Controls')
    77107703        G2frame.Image = G2frame.GPXtree.GetItemParent(item)
    77117704        masks = G2frame.GPXtree.GetItemPyData(
     
    77167709        G2plt.PlotImage(G2frame,newPlot=False)
    77177710    elif G2frame.GPXtree.GetItemText(item) == 'Masks':
    7718         #G2frame.SetTitle('Masks')
    77197711        G2frame.Image = G2frame.GPXtree.GetItemParent(item)
    77207712        masks = G2frame.GPXtree.GetItemPyData(item)
     
    77257717        G2plt.PlotImage(G2frame,newPlot=False)
    77267718    elif G2frame.GPXtree.GetItemText(item) == 'Stress/Strain':
    7727         #G2frame.SetTitle('Stress/Strain')
    77287719        G2frame.Image = G2frame.GPXtree.GetItemParent(item)
    77297720        data = G2frame.GPXtree.GetItemPyData(
  • trunk/GSASIIphsGUI.py

    r3355 r3356  
    13641364                    generalData['Name'] = newName
    13651365                    G2frame.G2plotNB.Rename(oldName,generalData['Name'])
    1366                     #G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Phase Data for '+generalData['Name'])
    1367                     #G2frame.SetTitle('Phase Data for '+generalData['Name'])                   
    13681366                    G2frame.GPXtree.SetItemText(Item,generalData['Name'])
    13691367                    # change phase name key in Reflection Lists for each histogram
     
    91949192    PhaseName = G2frame.GPXtree.GetItemText(Item)
    91959193    G2gd.SetDataMenuBar(G2frame)
    9196     #G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Phase Data for '+PhaseName)
    9197     #G2frame.SetTitle('Phase Data for '+PhaseName)
    91989194    # Bob: why do this differently in debug mode? Is this code to test if tabs can be moved around? #TODO - yup, flaky tho.
    91999195#    if GSASIIpath.GetConfigValue('debug'):
  • trunk/GSASIIplot.py

    r3355 r3356  
    27052705                    Ifin = np.searchsorted(X,limits[1][1])
    27062706                    Plot1.set_yscale("linear")                                                 
    2707                     DZ = (xye[1]-xye[3])*np.sqrt(xye[2])
     2707                    wtFactor = Pattern[0]['wtFactor']
     2708                    DZ = (xye[1]-xye[3])*np.sqrt(wtFactor*xye[2])
    27082709                    DifLine = Plot1.plot(X[Ibeg:Ifin],DZ[Ibeg:Ifin],colors[3],picker=1.,label='_diff')                    #(Io-Ic)/sig(Io)
    27092710                    Plot1.axhline(0.,color='k')
     
    36453646        ContourY = []
    36463647        Nseq = 0
     3648       
    36473649    for N,Pattern in enumerate(PlotList):
    36483650        xye = Pattern[1]
  • trunk/GSASIIpwdGUI.py

    r3355 r3356  
    930930    G2frame.PeakTable = G2G.Table(data['peaks'],rowLabels=rowLabels,colLabels=colLabels,types=Types)
    931931    #G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Peak List')
    932     #G2frame.SetTitle('Peak List')
    933932    G2frame.dataWindow.currentGrids = []
    934933    reflGrid = G2G.GSGrid(parent=G2frame.dataWindow)
     
    14471446    G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.LimitMenu)
    14481447    #G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Limits')
    1449     #G2frame.SetTitle('Limits')
    14501448    G2frame.Bind(wx.EVT_MENU,OnLimitCopy,id=G2G.wxID_LIMITCOPY)
    14511449    G2frame.Bind(wx.EVT_MENU,OnAddExcl,id=G2G.wxID_ADDEXCLREGION)
     
    17831781    def MakeParameterWindow():
    17841782        'Displays the Instrument parameters in the dataWindow frame'
    1785         #G2frame.SetTitle('Instrument Parameters')
    17861783        G2frame.dataWindow.ClearData()
    17871784        mainSizer = G2frame.dataWindow.GetSizer()
     
    24302427    G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.SampleMenu)
    24312428    #G2frame.SetLabel(G2frame.GetLabel().split('||')[0]+' || '+'Sample Parameters')
    2432     #G2frame.SetTitle('Sample Parameters')
    24332429    G2frame.Bind(wx.EVT_MENU, OnSetScale, id=G2G.wxID_SETSCALE)
    24342430    G2frame.Bind(wx.EVT_MENU, OnSampleCopy, id=G2G.wxID_SAMPLECOPY)
     
    27012697    G2frame.GPXtree.SetItemPyData(IndexId,data)
    27022698    G2frame.IndexPeaksTable = G2G.Table(data[0],rowLabels=rowLabels,colLabels=colLabels,types=Types)
    2703     #G2frame.SetTitle('Index Peak List')
    27042699    G2frame.dataWindow.currentGrids = []
    27052700    G2frame.indxPeaks = G2G.GSGrid(parent=G2frame.dataWindow)               
     
    32273222            dlg.Destroy()
    32283223           
    3229     #G2frame.SetTitle('Unit cells')
    32303224    G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.IndexMenu)
    32313225    G2frame.Bind(wx.EVT_MENU, OnIndexPeaks, id=G2G.wxID_INDEXPEAKS)
     
    36073601            return          #deleted phase?
    36083602        G2frame.RefList = phaseName
    3609         #G2frame.SetTitle('Reflection List for '+phaseName)
    36103603        if HKLF:
    36113604            G2frame.GetStatusBar().SetStatusText('abs(DF)/sig > 10 red; > 3 yellow; flag:>0 twin no., 0 sp.gp absent, -1 user rejected, -2 Rfree',1)
     
    40444037    wave = G2mth.getWave(Inst)
    40454038    G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.SubstanceMenu)
    4046     #G2frame.SetTitle('Substances')
    40474039    G2frame.Bind(wx.EVT_MENU, OnLoadSubstance, id=G2G.wxID_LOADSUBSTANCE)   
    40484040    G2frame.Bind(wx.EVT_MENU, OnReloadSubstances, id=G2G.wxID_RELOADSUBSTANCES)   
     
    46944686    G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.ModelMenu)
    46954687    G2frame.dataWindow.ClearData()
    4696     #G2frame.SetTitle('Modelling')
    46974688    G2frame.Bind(wx.EVT_MENU, OnCopyModel, id=G2G.wxID_MODELCOPY)
    46984689    G2frame.Bind(wx.EVT_MENU, OnCopyFlags, id=G2G.wxID_MODELCOPYFLAGS)
     
    52695260    Inst = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))[0]
    52705261    G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.REFDModelMenu)
    5271     #G2frame.SetTitle('Modelling')
    52725262    G2frame.dataWindow.ClearData()
    52735263    G2frame.Bind(wx.EVT_MENU, OnCopyModel, id=G2G.wxID_MODELCOPY)
  • trunk/GSASIIrestrGUI.py

    r3355 r3356  
    5353    return rows
    5454       
    55 def UpdateRestraints(G2frame,data,Phases,phaseName):
     55def UpdateRestraints(G2frame,data,phaseName):
    5656    '''Respond to selection of the Restraints item on the
    5757    data tree
    5858    '''
    59     global Pages
    60     def OnSelectPhase(event):
    61         pageName = Pages[G2frame.restrBook.GetSelection()]
    62         dlg = wx.SingleChoiceDialog(G2frame,'Select','Phase',list(Phases.keys()))
    63         try:
    64             if dlg.ShowModal() == wx.ID_OK:
    65                 phaseName = list(Phases.keys())[dlg.GetSelection()]
    66                 UpdateRestraints(G2frame,data,Phases,phaseName)
    67                 newPage = G2frame.restrBook.FindPage(pageName)
    68                 G2frame.restrBook.SetSelection(newPage)
    69         finally:
    70             dlg.Destroy()
     59#    global Pages
    7160   
    7261    def getMacroFile(macName):
     
    827816
    828817        wtBox = wx.BoxSizer(wx.HORIZONTAL)
    829         wtBox.Add(wx.StaticText(wind,-1,'Restraint weight factor: '),0,WACV)
     818        wtBox.Add(wx.StaticText(wind,-1,'Phase '+phaseName+' Restraint weight factor: '),0,WACV)
    830819        wtfactor = G2G.ValidatedTxtCtrl(wind,restData,'wtFactor',nDig=(10,2),typeHint=float)
    831820        wtBox.Add(wtfactor,0,WACV)
     
    19181907
    19191908    # UpdateRestraints execution starts here
    1920     if not Phases:
    1921         print ('There are no phases to form restraints')
    1922         return
    1923     if not len(Phases):
    1924         print ('There are no phases to form restraints')
    1925         return
    1926     phasedata = Phases[phaseName]
    1927     if phaseName not in data:
    1928         data[phaseName] = {}
    1929     restrData = data[phaseName]
     1909    phasedata = G2frame.GetPhaseData()[phaseName]
     1910    restrData = data
    19301911    if 'Bond' not in restrData:
    19311912        restrData['Bond'] = {'wtFactor':1.0,'Range':1.1,'Bonds':[],'Use':True}
     
    19691950    ramaName = 'All'
    19701951    G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.RestraintMenu)   
    1971     G2frame.dataWindow.RestraintEdit.Enable(G2G.wxID_RESTSELPHASE,False)
    1972     if len(Phases) > 1:
    1973         G2frame.dataWindow.RestraintEdit.Enable(G2G.wxID_RESTSELPHASE,True)
    1974         G2frame.Bind(wx.EVT_MENU, OnSelectPhase, id=G2G.wxID_RESTSELPHASE)
    19751952    G2frame.Bind(wx.EVT_MENU, OnAddRestraint, id=G2G.wxID_RESTRAINTADD)
    19761953    if 'macro' in phasedata['General']['Type']:
     
    19801957   
    19811958    # GUI defined here
    1982     #G2frame.SetTitle('restraints for '+phaseName)
    1983     #G2frame.restrBook = G2G.GSNoteBook(parent=G2frame.dataWindow,size=G2frame.dataWindow.GetClientSize())
    19841959    G2frame.restrBook = G2G.GSNoteBook(parent=G2frame.dataWindow)
    19851960    G2frame.dataWindow.GetSizer().Add(G2frame.restrBook,1,wx.ALL|wx.EXPAND,1)
Note: See TracChangeset for help on using the changeset viewer.