Changeset 2304


Ignore:
Timestamp:
Jun 2, 2016 12:43:45 PM (7 years ago)
Author:
vondreele
Message:

add Cancel to image integration ProgressDialog? - will do a Pause in AutoIntegrate?

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2297 r2304  
    23112311        self.oldImagefile = '' # the name of the last image file read
    23122312        self.oldImageTag = None # the name of the tag for multi-image files
     2313        self.PauseIntegration = False
    23132314        self.ImageZ = []
    23142315        self.Integrate = 0
  • trunk/GSASIIimage.py

    r2302 r2304  
    962962    Nup += 1
    963963    if dlg:
    964         dlg.Update(Nup)
     964        pause = dlg.Update(Nup)
    965965    times[4] += time.time()-t0
    966966    print 'Step times: \n apply masks  %8.3fs xy->th,azm   %8.3fs fill map     %8.3fs \
     
    969969    print 'Integration complete'
    970970    if returnN:     #As requested by Steven Weigand
    971         return H0,H1,H2,NST
     971        return H0,H1,H2,NST,not pause[0]
    972972    else:
    973         return H0,H1,H2
     973        return H0,H1,H2,not pause[0]
    974974   
    975975def MakeStrStaRing(ring,Image,Controls):
  • trunk/GSASIIimgGUI.py

    r2303 r2304  
    204204        nYBlks = (Ny-1)/blkSize+1
    205205        Nup = nXBlks*nYBlks*3+1     #exact count expected so AUTO_HIDE works!
    206         pdlg = wx.ProgressDialog("Elapsed time","2D image integration",Nup,
    207             style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE)
     206        if IntegrateOnly:
     207            pdlg = wx.ProgressDialog("Elapsed time","2D image integration\nCancel to pause",
     208                Nup,style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_CAN_ABORT)           
     209        else:
     210            pdlg = wx.ProgressDialog("Elapsed time","2D image integration",Nup,
     211                style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE)
    208212        try:
    209213            sumImg = GetImageZ(G2frame,data)
     
    215219            G2frame.PatternTree.Expand(Id)
    216220        finally:
    217             pdlg.Destroy()
     221            if pdlg:
     222                pdlg.Destroy()
    218223        for item in G2frame.MakePDF: item.Enable(True)
     224        G2frame.PauseIntegration = G2frame.Integrate[-1]
    219225       
    220226    def OnIntegrateAll(event):
     
    246252                    finally:
    247253                        dlgp.Destroy()
     254                    if G2frame.Integrate[-1]:       #Cancel from progress bar?
     255                        break
    248256                else:
    249257                    G2frame.EnablePlot = True
     
    20182026            self.Pause = False
    20192027            # change button label
    2020             if btnstart.GetLabel() != 'Pause':
    2021                 btnstart.SetLabel('Pause')
     2028            if self.btnstart.GetLabel() != 'Pause':
     2029                self.btnstart.SetLabel('Pause')
    20222030                if self.timer.IsRunning(): self.timer.Stop()
    20232031                self.PreventReEntryTimer = False
     
    20272035                self.Status.SetStatusText('Press Pause to delay integration or Reset to prepare to reintegrate all images')
    20282036            else:
    2029                 btnstart.SetLabel('Resume')
     2037                self.btnstart.SetLabel('Resume')
    20302038                if self.timer.IsRunning(): self.timer.Stop()
    20312039                print('\nPausing autointegration\n')
     
    20382046            all images can be reintegrated.
    20392047            '''
    2040             btnstart.SetLabel('Restart')
     2048            self.btnstart.SetLabel('Restart')
    20412049            self.Status.SetStatusText('Press Restart to reload and re-integrate images matching filter')
    20422050            if self.timer.IsRunning(): self.timer.Stop()
     
    22142222        sizer = wx.BoxSizer(wx.HORIZONTAL)
    22152223        sizer.Add((20,-1))
    2216         btnstart = wx.Button(mnpnl,  wx.ID_ANY, "Start")
    2217         btnstart.Bind(wx.EVT_BUTTON, OnStart)
    2218         sizer.Add(btnstart)
     2224        self.btnstart = wx.Button(mnpnl,  wx.ID_ANY, "Start")
     2225        self.btnstart.Bind(wx.EVT_BUTTON, OnStart)
     2226        sizer.Add(self.btnstart)
    22192227        btnstop = wx.Button(mnpnl,  wx.ID_ANY, "Reset")
    22202228        btnstop.Bind(wx.EVT_BUTTON, OnReset)
     
    24752483                self.ShowMatchingFiles(self.params['filter'])
    24762484                wx.Yield()
    2477             if self.Pause: return
     2485                self.Pause = G2frame.PauseIntegration
     2486            if self.Pause:
     2487                self.btnstart.SetLabel('Resume')
     2488                if self.timer.IsRunning(): self.timer.Stop()
     2489                print('\nPausing autointegration\n')
     2490                self.Status.SetStatusText('Press Resume to continue integration or Reset to prepare to reintegrate all images')
     2491                return
    24782492       
    24792493        if GSASIIpath.GetConfigValue('debug'):
Note: See TracChangeset for help on using the changeset viewer.