Changeset 4360 for trunk


Ignore:
Timestamp:
Mar 11, 2020 11:30:30 AM (3 years ago)
Author:
toby
Message:

change load-gpx dialog to match exit and start new project

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r4352 r4360  
    39043904        '''
    39053905        def SaveOld():
     3906            '''See if we should save current project and continue
     3907            to read another.
     3908            returns True if the project load should continue
     3909            '''
    39063910            if self.dataWindow:
    39073911                self.dataWindow.ClearData()
    3908             dlg = wx.MessageDialog(
    3909                 self,
    3910                 'Do you want to overwrite the current project? '+
    3911                 'Any unsaved changes in current project will be lost. Press OK to continue.',
    3912                 'Overwrite?',  wx.OK | wx.CANCEL)
     3912            dlg = wx.MessageDialog(self,
     3913                    'Do you want to save and replace the current project?\n(Use No to read without saving or Cancel to continue with current project)',
     3914                    'Save & Overwrite?',
     3915                    wx.YES|wx.NO|wx.CANCEL)
    39133916            try:
    39143917                result = dlg.ShowModal()
    3915                 if result == wx.ID_OK:
    3916                     #if GSASIIpath.GetConfigValue('debug'): print('DBG: Starting cleanup')
    3917                     self.GPXtree.DeleteChildren(self.root)
    3918                     #if GSASIIpath.GetConfigValue('debug'): print('DBG: DeleteChildren done')
    3919                     self.GSASprojectfile = ''
    3920                     self.HKL = []
    3921                     if self.G2plotNB.plotList:
    3922                         self.G2plotNB.clear()
    3923                     #if GSASIIpath.GetConfigValue('debug'): print('DBG: cleanup done')
    39243918            finally:
    39253919                dlg.Destroy()
    3926             return result
     3920            if result == wx.ID_NO:
     3921                result = True
     3922            elif result == wx.ID_CANCEL:
     3923                return False
     3924            else:
     3925                if not self.OnFileSave(None): return False
     3926            self.GPXtree.DeleteChildren(self.root)
     3927            self.GSASprojectfile = ''
     3928            self.HKL = []
     3929            if self.G2plotNB.plotList:
     3930                self.G2plotNB.clear()
     3931            return True
    39273932       
    39283933        def GetGPX():
     
    39433948           
    39443949        self.EnablePlot = False
    3945         result = wx.ID_OK
    39463950        if self.GPXtree.GetChildrenCount(self.root,False):
    3947             result = SaveOld()
    3948         if result != wx.ID_OK: return
     3951            if not SaveOld(): return
    39493952
    39503953        if not filename:
     
    40214024        the project.
    40224025        '''
    4023         dlg = wx.MessageDialog(self, 'Save current project?', ' ', wx.YES | wx.NO | wx.CANCEL)
     4026        dlg = wx.MessageDialog(self,
     4027                    'Do you want to save the current project and start with an empty one?\n(Use No to clear without saving or Cancel to continue with current project)',
     4028                    'Save & Clear?',
     4029                    wx.YES | wx.NO | wx.CANCEL)
    40244030        try:
    40254031            result = dlg.ShowModal()
Note: See TracChangeset for help on using the changeset viewer.