X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=Cura%2Fgui%2FfirmwareInstall.py;h=722a293be798b78fd98f04d7eb1d443eba229d7c;hb=730e8f2c1c8dfc9498a1b416cc398606f60940c3;hp=8d1158e968fbe5032d0be7a769ef20fe87d5760c;hpb=87588dd663c148f42b2156f8ff5b492f09ce1df3;p=cura.git diff --git a/Cura/gui/firmwareInstall.py b/Cura/gui/firmwareInstall.py index 8d1158e9..722a293b 100644 --- a/Cura/gui/firmwareInstall.py +++ b/Cura/gui/firmwareInstall.py @@ -39,7 +39,8 @@ def getDefaultFirmware(machineIndex = None): 'lulzbot_TAZ_4_FlexyDuallyV1': "Taz4-5-Dual-or-FlexyDually-Budaschnozzle-2015Q1.hex", 'lulzbot_TAZ_5_FlexyDuallyV1': "Taz4-5-Dual-or-FlexyDually-Budaschnozzle-2015Q1.hex", 'lulzbot_TAZ_4_FlexyDuallyV2': "Taz4-5-FlexyDually-LBHexagon-2015Q3.hex", - 'lulzbot_TAZ_5_FlexyDuallyV2': "Taz4-5-FlexyDually-LBHexagon-2015Q3.hex" + 'lulzbot_TAZ_5_FlexyDuallyV2': "Taz4-5-FlexyDually-LBHexagon-2015Q3.hex", + 'lulzbot_TAZ_6_SingleTilapia': "Taz6-Single-Tilapia-2015-Q4.hex" } machine_type = profile.getMachineSetting('machine_type', machineIndex) extruders = profile.getMachineSettingFloat('extruder_amount', machineIndex) @@ -116,6 +117,7 @@ class InstallFirmwareDialog(wx.Dialog): self.Layout() self.Fit() self.success = False + self.show_connect_dialog = False def Run(self): if self.filename is None: @@ -127,6 +129,11 @@ class InstallFirmwareDialog(wx.Dialog): 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): @@ -136,7 +143,7 @@ class InstallFirmwareDialog(wx.Dialog): programmer = stk500v2.Stk500v2() programmer.progressCallback = self.OnProgress if self.port == 'AUTO': - wx.CallAfter(self.updateLabel, _("Please connect the printer to\nyour computer with the USB cable.")) + wx.CallAfter(self.updateLabel, _("Please connect the printer to your\ncomputer with a USB cable and power it on.")) while not programmer.isConnected(): for self.port in machineCom.serialList(True): try: @@ -153,10 +160,12 @@ class InstallFirmwareDialog(wx.Dialog): 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 @@ -186,7 +195,7 @@ class InstallFirmwareDialog(wx.Dialog): def updateLabel(self, text): self.progressLabel.SetLabel(text) - #self.Layout() + self.Layout() def OnProgress(self, value, max): if self: @@ -305,7 +314,7 @@ class AutoUpdateFirmware(wx.Dialog): programmer = stk500v2.Stk500v2() programmer.progressCallback = self.OnProgress if self.port == 'AUTO': - wx.CallAfter(self.updateLabel, _("Please connect the printer to\nyour computer with the USB cable.")) + wx.CallAfter(self.updateLabel, _("Please connect the printer to your\ncomputer with a USB cable and power it on.")) while not programmer.isConnected(): for self.port in machineCom.serialList(True): try: @@ -339,7 +348,7 @@ class AutoUpdateFirmware(wx.Dialog): def updateLabel(self, text): self.progressLabel.SetLabel(text) - #self.Layout() + self.Layout() def OnProgress(self, value, max): wx.CallAfter(self.progressGauge.SetRange, max)