Changeset 4511


Ignore:
Timestamp:
Jun 27, 2020 2:46:20 PM (16 months ago)
Author:
toby
Message:

fix rename, make sure hist is not used

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r4503 r4511  
    593593        item = parent.Append(wx.ID_ANY,'Delete phase entries','')
    594594        self.Bind(wx.EVT_MENU, self.OnDeletePhase, id=item.GetId())
    595         item = parent.Append(wx.ID_ANY,'Rename tree entry',
     595        item = parent.Append(wx.ID_ANY,'Rename data entry',
    596596                'Rename the selected data tree item (PWDR, HKLF or IMG)')
    597597        self.Bind(wx.EVT_MENU, self.OnRenameData, id=item.GetId())
     
    39413941       
    39423942    def OnRenameData(self,event):
    3943         'Renames an existing phase. Called by Data/Rename Phase menu'
     3943        '''Renames an existing histogram. Called by Data/Rename Phase menu.
     3944        Must be used before a histogram is used in a phase.
     3945        '''
    39443946        name = self.GPXtree.GetItemText(self.PickId)     
     3947        Histograms,Phases = self.GetUsedHistogramsAndPhasesfromTree()
     3948        if name in Histograms:
     3949            G2G.G2MessageBox(self,
     3950                'Histogram is used. You must remove it from all phases before it can be renamed',
     3951                'Rename not allowed')
     3952            return
    39453953        if 'PWDR' in name or 'HKLF' in name or 'IMG' in name:
    39463954            if 'Bank' in name:
     
    39533961                names = [name,'']
    39543962            dataType = names[0][:names[0].index(' ')+1]                 #includes the ' '
    3955             dlg = wx.TextEntryDialog(self,'Data name: '+name,'Change data name',
    3956                 defaultValue=names[0][names[0].index(' ')+1:])
    3957             try:
    3958                 if dlg.ShowModal() == wx.ID_OK:
    3959                     name = dataType+dlg.GetValue()+names[1]
    3960                     self.GPXtree.SetItemText(self.PickId,name)
    3961                     if 'PWDR' in name:
    3962                         self.GPXtree.GetItemPyData(self.PickId)[2] = name
    3963             finally:
    3964                 dlg.Destroy()
     3963            dlg = G2G.SingleStringDialog(self,'Change tree name',
     3964                    'Data name: '+name,names[0][names[0].index(' ')+1:])
     3965            #if dlg.ShowModal() == wx.ID_OK:
     3966            if dlg.Show():
     3967                name = dataType+dlg.GetValue().strip()+names[1]
     3968                self.GPXtree.SetItemText(self.PickId,name)
     3969                if 'PWDR' in name:
     3970                    self.GPXtree.GetItemPyData(self.PickId)[2] = name
     3971            dlg.Destroy()
    39653972       
    39663973    def GetFileList(self,fileType,skip=None):        #potentially useful?
Note: See TracChangeset for help on using the changeset viewer.