Changeset 4412


Ignore:
Timestamp:
Apr 24, 2020 5:32:58 PM (18 months ago)
Author:
toby
Message:

update tree item display after delete data tree entry

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r4410 r4412  
    592592        item = parent.Append(wx.ID_ANY,'Add new phase','')
    593593        self.Bind(wx.EVT_MENU, self.OnAddPhase, id=item.GetId())
    594         item = parent.Append(wx.ID_ANY,'Delete phase','')
     594        item = parent.Append(wx.ID_ANY,'Delete phase entries','')
    595595        self.Bind(wx.EVT_MENU, self.OnDeletePhase, id=item.GetId())
    596         item = parent.Append(wx.ID_ANY,'Rename tree item','Rename the selected data tree item (PWDR, HKLF or IMG)')
     596        item = parent.Append(wx.ID_ANY,'Rename tree entry',
     597                'Rename the selected data tree item (PWDR, HKLF or IMG)')
    597598        self.Bind(wx.EVT_MENU, self.OnRenameData, id=item.GetId())
    598         item = parent.Append(wx.ID_ANY,'Delete tree items','Delete selected data items from data tree')
     599        item = parent.Append(wx.ID_ANY,'Delete data entries',
     600                'Delete selected data items from data tree')
    599601        self.Bind(wx.EVT_MENU, self.OnDataDelete, id=item.GetId())
    600602        item = parent.Append(wx.ID_ANY,'Delete plots','Delete selected plots')
     
    39023904            for lbl in self.G2plotNB.plotList:
    39033905                self.G2plotNB.Delete(lbl)
    3904         if subr:        #remove restraints for deleted phase
     3906        if subr and DelList:     #remove restraints for deleted phase
    39053907            DelList = [itm[1] for itm in DelList]
    39063908            item, cookie = self.GPXtree.GetFirstChild(subr)
     
    39123914                item, cookie = self.GPXtree.GetNextChild(subr, cookie)
    39133915        # force redisplay of current tree item if it was not deleted
     3916        self.PickId = 0
     3917        self.PatternId = 0
    39143918        self.PickIdText = None
    39153919        SelectDataTreeItem(self,selItem)
     
    39693973        nItems = {'PWDR':0,'SASD':0,'REFD':0,'IMG':0,'HKLF':0,'PDF':0}
    39703974        PDFnames = []
     3975        selItem = self.GPXtree.GetSelection()
    39713976        Histograms,Phases = self.GetUsedHistogramsAndPhasesfromTree()
    39723977        if not self.GPXtree.GetCount():
     
    40334038                for item in DelItemList:
    40344039                    self.GPXtree.Delete(item)
    4035                 self.PickId = 0
    4036                 self.PickIdText = None
    4037                 self.PatternId = 0
    4038                 if nItems['PWDR']:
    4039                     wx.CallAfter(G2plt.PlotPatterns,self,True)
    4040                 else:
    4041                     self.G2plotNB.Delete('Powder Patterns')
    4042                 if not nItems['IMG']:
    4043                     self.G2plotNB.Delete('2D Powder Image')
    4044                 if not nItems['HKLF']:
    4045                     self.G2plotNB.Delete('Structure Factors')
    4046                     if '3D Structure Factors' in self.G2plotNB.plotList:
    4047                         self.G2plotNB.Delete('3D Structure Factors')
     4040                    if item == selItem: selItem = self.root
     4041                if DelList:
     4042                    self.PickId = 0
     4043                    self.PickIdText = None
     4044                    self.PatternId = 0
     4045                    if nItems['PWDR']:
     4046                        wx.CallAfter(G2plt.PlotPatterns,self,True)
     4047                    else:
     4048                        self.G2plotNB.Delete('Powder Patterns')
     4049                    if not nItems['IMG']:
     4050                        self.G2plotNB.Delete('2D Powder Image')
     4051                    if not nItems['HKLF']:
     4052                        self.G2plotNB.Delete('Structure Factors')
     4053                        if '3D Structure Factors' in self.G2plotNB.plotList:
     4054                            self.G2plotNB.Delete('3D Structure Factors')
    40484055        finally:
    40494056            dlg.Destroy()
     4057        if DelList:
     4058            SelectDataTreeItem(self,selItem)
     4059            wx.CallAfter(self.GPXtree.SelectItem,selItem)
    40504060               
    40514061    def OnPlotDelete(self,event):
Note: See TracChangeset for help on using the changeset viewer.