Changeset 1605 for trunk/GSASII.py


Ignore:
Timestamp:
Dec 12, 2014 10:44:02 AM (7 years ago)
Author:
toby
Message:

add code to prevent blank phase names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1601 r1605  
    567567        newPhaseList = []
    568568        for rd in rdlist:
     569            PhaseName = ''
    569570            dlg = wx.TextEntryDialog( # allow editing of phase name
    570                 self, 'Enter the name for the new phase',
    571                 'Edit phase name', rd.Phase['General']['Name'],
    572                 style=wx.OK)
    573             dlg.CenterOnParent()
    574             if dlg.ShowModal() == wx.ID_OK:
    575                 rd.Phase['General']['Name'] = dlg.GetValue()
     571                                    self, 'Enter the name for the new phase',
     572                                    'Edit phase name', rd.Phase['General']['Name'],
     573                                    style=wx.OK)
     574            while PhaseName == '':
     575                dlg.CenterOnParent()
     576                if dlg.ShowModal() == wx.ID_OK:
     577                    PhaseName = dlg.GetValue().strip()
     578                else:
     579                    dlg.Destroy()
     580                    return
    576581            dlg.Destroy()
    577582            # make new phase names unique
    578             rd.Phase['General']['Name'] = G2obj.MakeUniqueLabel(rd.Phase['General']['Name'],phaseNameList)
    579             PhaseName = rd.Phase['General']['Name']
     583            rd.Phase['General']['Name'] = G2obj.MakeUniqueLabel(PhaseName,phaseNameList)
     584            PhaseName = rd.Phase['General']['Name'][:]
    580585            newPhaseList.append(PhaseName)
    581586            print 'Read phase '+str(PhaseName)+' from file '+str(self.lastimport)
Note: See TracChangeset for help on using the changeset viewer.