예제 #1
0
	def OnRun(self):
		hexFile = intelHex.readHex(self.filename)
		wx.CallAfter(self.updateLabel, "Connecting to machine...")
		programmer = stk500v2.Stk500v2()
		programmer.progressCallback = self.OnProgress
		if self.port == 'AUTO':
			for self.port in machineCom.serialList():
				try:
					programmer.connect(self.port)
					break
				except ispBase.IspError:
					pass
		else:
			try:
				programmer.connect(self.port)
			except ispBase.IspError:
				pass
				
		if programmer.isConnected():
			wx.CallAfter(self.updateLabel, "Uploading firmware...")
			try:
				programmer.programChip(hexFile)
				wx.CallAfter(self.updateLabel, "Done!\nInstalled firmware: %s" % (os.path.basename(self.filename)))
			except ispBase.IspError as e:
				wx.CallAfter(self.updateLabel, "Failed to write firmware.\n" + str(e))
				
			programmer.close()
			wx.CallAfter(self.okButton.Enable)
			return
		wx.MessageBox('Failed to find machine for firmware upgrade\nIs your machine connected to the PC?', 'Firmware update', wx.OK | wx.ICON_ERROR)
		wx.CallAfter(self.Close)
예제 #2
0
	def OnRun(self):
		wx.CallAfter(self.updateLabel, _("Reading firmware..."))
		hexFile = intelHex.readHex(self.filename)
		wx.CallAfter(self.updateLabel, _("Connecting to machine..."))
		programmer = stk500v2.Stk500v2()
		programmer.progressCallback = self.OnProgress
		if self.port == 'AUTO':
			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:
						programmer.connect(self.port)
						break
					except ispBase.IspError:
						programmer.close()
				time.sleep(1)
				if not self:
					#Window destroyed
					return
		else:
			try:
				programmer.connect(self.port)
			except ispBase.IspError:
				programmer.close()
			if not self:
				#Window destroyed
				return

		self.cancelButton.Disable()
		self.okButton.SetLabel(_('Ok'))

		if not programmer.isConnected():
			self.show_connect_dialog = True
			wx.CallAfter(self.Close)
			return


		if self._machine_type == 'ultimaker':
			if programmer.hasChecksumFunction():
				wx.CallAfter(self.updateLabel, _("Failed to install firmware:\nThis firmware is not compatible with this machine.\nTrying to install UMO firmware on an UM2 or UMO+?"))
				programmer.close()
				wx.CallAfter(self.okButton.Enable)
				return
		if self._machine_type == 'ultimaker_plus' or self._machine_type == 'ultimaker2':
			if not programmer.hasChecksumFunction():
				wx.CallAfter(self.updateLabel, _("Failed to install firmware:\nThis firmware is not compatible with this machine.\nTrying to install UM2 or UMO+ firmware on an UMO?"))
				programmer.close()
				wx.CallAfter(self.okButton.Enable)
				return

		wx.CallAfter(self.updateLabel, _("Uploading firmware..."))
		try:
			programmer.programChip(hexFile)
			self.success = True
			wx.CallAfter(self.updateLabel, _("Done!"))
		except ispBase.IspError as e:
			wx.CallAfter(self.updateLabel, _("Failed to write firmware.\n") + str(e))

		programmer.close()
		wx.CallAfter(self.okButton.Enable)
    def OnRun(self):
        wx.CallAfter(self.updateLabel, _("Reading firmware..."))
        hexFile = intelHex.readHex(self.filename)
        wx.CallAfter(self.updateLabel, _("Connecting to machine..."))
        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."))
            while not programmer.isConnected():
                for self.port in machineCom.serialList(True):
                    try:
                        programmer.connect(self.port)
                        break
                    except ispBase.IspError:
                        programmer.close()
                time.sleep(1)
                if not self:
                    #Window destroyed
                    return
        else:
            try:
                programmer.connect(self.port)
            except ispBase.IspError:
                programmer.close()

        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)
            wx.CallAfter(self.Close)
            return

        if self._default_firmware:
            if self._machine_type == 'BCN3DSigma':
                if programmer.hasChecksumFunction():
                    wx.CallAfter(self.updateLabel, _("Failed to install firmware:\nThis firmware is not compatible with this machine.\nTrying to install UMO firmware on an UM2 or UMO+?"))
                    programmer.close()
                    wx.CallAfter(self.okButton.Enable)
                    return
            if self._machine_type == 'ultimaker' or self._machine_type == 'ultimaker2':
                if not programmer.hasChecksumFunction():
                    wx.CallAfter(self.updateLabel, _("Failed to install firmware:\nThis firmware is not compatible with this machine.\nTrying to install UM2 or UMO+ firmware on an UMO?"))
                    programmer.close()
                    wx.CallAfter(self.okButton.Enable)
                    return

        wx.CallAfter(self.updateLabel, _("Uploading firmware..."))
        try:
            programmer.programChip(hexFile)
            wx.CallAfter(self.updateLabel, _("Done!\nInstalled firmware: %s") % (os.path.basename(self.filename)))
        except ispBase.IspError as e:
            wx.CallAfter(self.showError, e)

        programmer.close()
        wx.CallAfter(self.okButton.Enable)
예제 #4
0
	def OnRun(self):
		wx.CallAfter(self.updateLabel, _("Reading firmware..."))
		hexFile = intelHex.readHex(self.filename)
		wx.CallAfter(self.updateLabel, _("Connecting to machine..."))
		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."))
			while not programmer.isConnected():
				for self.port in machineCom.serialList(True):
					try:
						programmer.connect(self.port)
						break
					except ispBase.IspError:
						programmer.close()
				time.sleep(1)
				if not self:
					#Window destroyed
					return
		else:
			try:
				programmer.connect(self.port)
			except ispBase.IspError:
				programmer.close()

		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)
			wx.CallAfter(self.Close)
			return

		if self._machine_type == 'ultimaker':
			if programmer.hasChecksumFunction():
				wx.CallAfter(self.updateLabel, _("Failed to install firmware:\nThis firmware is not compatible with this machine.\nTrying to install UMO firmware on an UM2 or UMO+?"))
				programmer.close()
				wx.CallAfter(self.okButton.Enable)
				return
		if self._machine_type == 'ultimaker_plus' or self._machine_type == 'ultimaker2':
			if not programmer.hasChecksumFunction():
				wx.CallAfter(self.updateLabel, _("Failed to install firmware:\nThis firmware is not compatible with this machine.\nTrying to install UM2 or UMO+ firmware on an UMO?"))
				programmer.close()
				wx.CallAfter(self.okButton.Enable)
				return

		wx.CallAfter(self.updateLabel, _("Uploading firmware..."))
		try:
			programmer.programChip(hexFile)
			self.success = True
			wx.CallAfter(self.updateLabel, _("Done!\nInstalled firmware: %s") % (os.path.basename(self.filename)))
		except ispBase.IspError as e:
			wx.CallAfter(self.updateLabel, _("Failed to write firmware.\n") + str(e))

		programmer.close()
		wx.CallAfter(self.okButton.Enable)
예제 #5
0
    def OnInstall(self):
        wx.CallAfter(self.okButton.Disable)
        wx.CallAfter(self.updateLabel, _("Reading firmware..."))
        hexFile = intelHex.readHex(self.filename)
        wx.CallAfter(self.updateLabel, _("Connecting to machine..."))
        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."
                  ))
            while not programmer.isConnected():
                for self.port in machineCom.serialList(True):
                    try:
                        programmer.connect(self.port)
                        break
                    except ispBase.IspError:
                        pass
                time.sleep(1)
                if not self:
                    #Window destroyed
                    return
        else:
            try:
                programmer.connect(self.port)
            except ispBase.IspError:
                pass

        if not programmer.isConnected():
            wx.CallAfter(self.updateLabel,
                         _("Failed to connect to programmer.\n"))
            return

        wx.CallAfter(self.updateLabel, _("Uploading firmware..."))
        try:
            programmer.programChip(hexFile)
            wx.CallAfter(
                self.updateLabel,
                _("Done!\nInstalled firmware: %s") %
                (os.path.basename(self.filename)))
        except ispBase.IspError as e:
            wx.CallAfter(self.updateLabel,
                         _("Failed to write firmware.\n") + str(e))

        programmer.close()
        wx.CallAfter(self.okButton.Enable)
예제 #6
0
    def OnRun(self):
        wx.CallAfter(self.updateLabel, _("Reading firmware..."))
        hexFile = intelHex.readHex(self.filename)
        wx.CallAfter(self.updateLabel, _("Connecting to machine..."))
        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."))
            while not programmer.isConnected():
                for self.port in machineCom.serialList(True):
                    try:
                        programmer.connect(self.port)
                        break
                    except ispBase.IspError:
                        pass
                time.sleep(1)
                if not self:
                    # Window destroyed
                    return
        else:
            try:
                programmer.connect(self.port)
            except ispBase.IspError:
                pass

        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,
            )
            wx.CallAfter(self.Close)
            return

        wx.CallAfter(self.updateLabel, _("Uploading firmware..."))
        try:
            programmer.programChip(hexFile)
            wx.CallAfter(self.updateLabel, _("Done!\nInstalled firmware: %s") % (os.path.basename(self.filename)))
        except ispBase.IspError as e:
            wx.CallAfter(self.updateLabel, _("Failed to write firmware.\n") + str(e))

        programmer.close()
        wx.CallAfter(self.okButton.Enable)
예제 #7
0
	def OnInstall(self):
		wx.CallAfter(self.okButton.Disable)
		wx.CallAfter(self.updateLabel, _("Reading firmware..."))
		hexFile = intelHex.readHex(self.filename)
		wx.CallAfter(self.updateLabel, _("Connecting to machine..."))
		programmer = stk500v2.Stk500v2()
		programmer.progressCallback = self.OnProgress
		if self.port == 'AUTO':
			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:
						programmer.connect(self.port)
						break
					except ispBase.IspError:
						pass
				time.sleep(1)
				if not self:
					#Window destroyed
					return
		else:
			try:
				programmer.connect(self.port)
			except ispBase.IspError:
				pass

		if not programmer.isConnected():
			wx.CallAfter(self.updateLabel, _("Failed to connect to programmer.\n"))
			return

		wx.CallAfter(self.updateLabel, _("Uploading firmware..."))
		try:
			programmer.programChip(hexFile)
			wx.CallAfter(self.updateLabel, _("Done!\nInstalled firmware: %s") % (os.path.basename(self.filename)))
		except ispBase.IspError as e:
			wx.CallAfter(self.updateLabel, _("Failed to write firmware.\n") + str(e))

		programmer.close()
		wx.CallAfter(self.okButton.Enable)
예제 #8
0
    def OnRun(self):
        wx.CallAfter(self.updateLabel, "Reading firmware...")
        hexFile = intelHex.readHex(self.filename)
        wx.CallAfter(self.updateLabel, "Connecting to machine...")
        programmer = stk500v2.Stk500v2()
        programmer.progressCallback = self.OnProgress
        if self.port == 'AUTO':
            for self.port in machineCom.serialList(True):
                try:
                    programmer.connect(self.port)
                    break
                except ispBase.IspError:
                    pass
        else:
            try:
                programmer.connect(self.port)
            except ispBase.IspError:
                pass

        if programmer.isConnected():
            wx.CallAfter(self.updateLabel, "Uploading firmware...")
            try:
                programmer.programChip(hexFile)
                wx.CallAfter(
                    self.updateLabel, "Done!\nInstalled firmware: %s" %
                    (os.path.basename(self.filename)))
            except ispBase.IspError as e:
                wx.CallAfter(self.updateLabel,
                             "Failed to write firmware.\n" + str(e))

            programmer.close()
            wx.CallAfter(self.okButton.Enable)
            return
        wx.MessageBox(
            'Failed to find machine for firmware upgrade\nIs your machine connected to the PC?',
            'Firmware update', wx.OK | wx.ICON_ERROR)
        wx.CallAfter(self.Close)
예제 #9
0
    def OnRun(self):
        wx.CallAfter(self.updateLabel, _("Reading firmware..."))
        hexFile = intelHex.readHex(self.filename)
        wx.CallAfter(self.updateLabel, _("Connecting to machine..."))
        programmer = stk500v2.Stk500v2()
        programmer.progressCallback = self.OnProgress
        if self.port == 'AUTO':
            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:
                        programmer.connect(self.port)
                        break
                    except ispBase.IspError:
                        programmer.close()
                time.sleep(1)
                if not self:
                    #Window destroyed
                    return
        else:
            try:
                programmer.connect(self.port)
            except ispBase.IspError:
                programmer.close()
            if not self:
                #Window destroyed
                return

        self.cancelButton.Disable()
        self.okButton.SetLabel(_('Ok'))

        if not programmer.isConnected():
            self.show_connect_dialog = True
            wx.CallAfter(self.Close)
            return

        if self._machine_type == 'ultimaker':
            if programmer.hasChecksumFunction():
                wx.CallAfter(
                    self.updateLabel,
                    _("Failed to install firmware:\nThis firmware is not compatible with this machine.\nTrying to install UMO firmware on an UM2 or UMO+?"
                      ))
                programmer.close()
                wx.CallAfter(self.okButton.Enable)
                return
        if self._machine_type == 'ultimaker_plus' or self._machine_type == 'ultimaker2':
            if not programmer.hasChecksumFunction():
                wx.CallAfter(
                    self.updateLabel,
                    _("Failed to install firmware:\nThis firmware is not compatible with this machine.\nTrying to install UM2 or UMO+ firmware on an UMO?"
                      ))
                programmer.close()
                wx.CallAfter(self.okButton.Enable)
                return

        wx.CallAfter(self.updateLabel, _("Uploading firmware..."))
        try:
            programmer.programChip(hexFile)
            self.success = True
            wx.CallAfter(self.updateLabel, _("Done!"))
        except ispBase.IspError as e:
            wx.CallAfter(self.updateLabel,
                         _("Failed to write firmware.\n") + str(e))

        programmer.close()
        wx.CallAfter(self.okButton.Enable)