Configtool: also allow to abort builds.
Usually the complete or fail within a few seconds, but one never knows and consistency with cancel-ability of uploads is good.
This commit is contained in:
parent
61c1ba182f
commit
9a10e70e36
|
|
@ -104,6 +104,7 @@ class Build(wx.Dialog):
|
||||||
self.f_cpu = f_cpu
|
self.f_cpu = f_cpu
|
||||||
self.cpu = cpu
|
self.cpu = cpu
|
||||||
self.Bind(wx.EVT_CLOSE, self.onExit)
|
self.Bind(wx.EVT_CLOSE, self.onExit)
|
||||||
|
self.cancelPending = False
|
||||||
|
|
||||||
hsz = wx.BoxSizer(wx.HORIZONTAL)
|
hsz = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
hsz.AddSpacer((10, 10))
|
hsz.AddSpacer((10, 10))
|
||||||
|
|
@ -140,9 +141,9 @@ class Build(wx.Dialog):
|
||||||
self.active = False
|
self.active = False
|
||||||
else:
|
else:
|
||||||
self.Bind(EVT_SCRIPT_UPDATE, self.compileUpdate)
|
self.Bind(EVT_SCRIPT_UPDATE, self.compileUpdate)
|
||||||
t = ScriptThread(self, self.script)
|
self.t = ScriptThread(self, self.script)
|
||||||
self.active = True
|
self.active = True
|
||||||
t.Start()
|
self.t.Start()
|
||||||
|
|
||||||
def link(self):
|
def link(self):
|
||||||
self.generateLinkScript()
|
self.generateLinkScript()
|
||||||
|
|
@ -230,9 +231,15 @@ class Build(wx.Dialog):
|
||||||
|
|
||||||
if evt.state == SCRIPT_RUNNING:
|
if evt.state == SCRIPT_RUNNING:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if evt.state == SCRIPT_CANCELLED:
|
if evt.state == SCRIPT_CANCELLED:
|
||||||
self.log.AppendText("Compile terminated abnormally.\n\n")
|
|
||||||
self.active = False
|
self.active = False
|
||||||
|
|
||||||
|
if self.cancelPending:
|
||||||
|
self.EndModal(wx.ID_OK)
|
||||||
|
|
||||||
|
self.log.AppendText("Build terminated abnormally.\n")
|
||||||
|
|
||||||
if evt.state == SCRIPT_FINISHED:
|
if evt.state == SCRIPT_FINISHED:
|
||||||
self.log.AppendText("Compile completed normally.\n\n")
|
self.log.AppendText("Compile completed normally.\n\n")
|
||||||
self.link()
|
self.link()
|
||||||
|
|
@ -295,6 +302,16 @@ class Build(wx.Dialog):
|
||||||
|
|
||||||
def onExit(self, evt):
|
def onExit(self, evt):
|
||||||
if self.active:
|
if self.active:
|
||||||
|
dlg = wx.MessageDialog(self, "Are you sure you want to cancel building?",
|
||||||
|
"Build active",
|
||||||
|
wx.YES_NO | wx.NO_DEFAULT | wx.ICON_INFORMATION)
|
||||||
|
rc = dlg.ShowModal()
|
||||||
|
dlg.Destroy()
|
||||||
|
|
||||||
|
if rc == wx.ID_YES:
|
||||||
|
self.cancelPending = True
|
||||||
|
self.log.AppendText("Cancelling...\n")
|
||||||
|
self.t.Stop()
|
||||||
return
|
return
|
||||||
|
|
||||||
self.EndModal(wx.ID_OK)
|
self.EndModal(wx.ID_OK)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue