self.Layout()
self.Fit()
self.success = False
+ self.show_connect_error_dialog = False
def Run(self):
if self.filename is None:
self.thread.start()
self.ShowModal()
+ # Creating a MessageBox in a separate thread while main thread is locked inside a ShowModal
+ # will cause Python to crash with X errors. So we need to show the dialog here instead
+ if self.show_connect_dialog:
+ wx.MessageBox(_("Failed to find machine for firmware upgrade\nIs your machine connected to the PC?"),
+ _("Firmware update"), wx.OK | wx.ICON_ERROR)
return self.success
def OnRun(self):
programmer.connect(self.port)
except ispBase.IspError:
programmer.close()
+ if not self:
+ #Window destroyed
+ return
if not programmer.isConnected():
- wx.MessageBox(_("Failed to find machine for firmware upgrade\nIs your machine connected to the PC?"),
- _("Firmware update"), wx.OK | wx.ICON_ERROR)
+ self.show_connect_dialog = True
wx.CallAfter(self.Close)
return