def getFirmwareHardware(self):
        ver = self._version

        if profile.getMachineSetting('machine_type') != 'BCN3DSigma' and profile.getMachineSetting('machine_type') != 'BCN3DPlus' and profile.getMachineSetting('machine_type') != 'BCN3DR':
            wx.MessageBox(_("I am sorry, but Cura does not process firmware updates for your machine configuration."), _("Firmware update"), wx.OK | wx.ICON_ERROR)
            return
        elif profile.getMachineSetting('machine_type') == 'BCN3DSigma' or profile.getMachineSetting('machine_type') == 'BCN3DPlus' or profile.getMachineSetting('machine_type') == 'BCN3DR':
            myVersion = version.getLatestFHVersion(ver)

            if myVersion == None:
                return

            if version.downloadLatestFHVersion != None:
                dlg=wx.FileDialog(None, _("Open firmware to upload"), os.getcwd(), style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
                dlg.SetWildcard("HEX file (*.hex)|*.hex;*.HEX")
                if dlg.ShowModal() == wx.ID_OK:
                    filename = dlg.GetPath()
                    dlg.Destroy()
                    if not(os.path.exists(filename)):
                        return
                    #For some reason my Ubuntu 10.10 crashes here.
                    InstallFirmware(self, filename)
                    #In case we want to delete the file after it has been installed
                    #os.chdir(os.path.expanduser('~') + '\Documents\BCN3DSigma')
                    #path = os.getcwd()
                    #shutil.rmtree(path)
                if dlg != wx.FD_OPEN:
                    os.chdir(os.path.expanduser('~') + '\Documents')
                    return
                else:
                    wx.MessageBox(_("You are running the latest version of firmware!"), _("Awesome!"), wx.ICON_INFORMATION)
	def __init__(self):
		super(newVersionDialog, self).__init__(None, title="Welcome to the new version!")

		wx.EVT_CLOSE(self, self.OnClose)

		p = wx.Panel(self)
		self.panel = p
		s = wx.BoxSizer()
		self.SetSizer(s)
		s.Add(p, flag=wx.ALL, border=15)
		s = wx.BoxSizer(wx.VERTICAL)
		p.SetSizer(s)

		title = wx.StaticText(p, -1, 'Cura - ' + version.getVersion())
		title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
		s.Add(title, flag=wx.ALIGN_CENTRE|wx.EXPAND|wx.BOTTOM, border=5)
		s.Add(wx.StaticText(p, -1, 'Welcome to the new version of Cura.'))
		s.Add(wx.StaticText(p, -1, '(This dialog is only shown once)'))
		s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10)
		s.Add(wx.StaticText(p, -1, 'New in version 15.04.2:'))
		s.Add(wx.StaticText(p, -1, '* New firmwares for the Ultimaker2, Ultimaker2go and Ultimaker2extended'))
		s.Add(wx.StaticText(p, -1, '* New and updated 3th party machine configurations'))
		s.Add(wx.StaticText(p, -1, 'New in version 15.04:'))
		s.Add(wx.StaticText(p, -1, '* Fixed a small issue where Cura sometimes failed enable the save button'))
		s.Add(wx.StaticText(p, -1, '* Added save gcode shortcut key (CTRL+G)'))
		s.Add(wx.StaticText(p, -1, '* Updated UM2, UM2go and UM2extended firmware for the new support url on errors'))
		s.Add(wx.StaticText(p, -1, '* Fixed small issue in the UM2go firmware'))

		self.hasUltimaker = None
		self.hasUltimaker2 = None
		for n in xrange(0, profile.getMachineCount()):
			if profile.getMachineSetting('machine_type', n) == 'ultimaker':
				self.hasUltimaker = n
			if profile.getMachineSetting('machine_type', n) == 'ultimaker2':
				self.hasUltimaker2 = n
		if self.hasUltimaker is not None and False:
			s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10)
			s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker Original:'))
			s.Add(wx.StaticText(p, -1, '* .'))
			button = wx.Button(p, -1, 'Install now')
			self.Bind(wx.EVT_BUTTON, self.OnUltimakerFirmware, button)
			s.Add(button, flag=wx.TOP, border=5)
		if self.hasUltimaker2 is not None and False:
			s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10)
			s.Add(wx.StaticText(p, -1, 'New firmware for your Ultimaker2:'))
			s.Add(wx.StaticText(p, -1, '* Added option to change filament when pausing during a print.'))
			s.Add(wx.StaticText(p, -1, '* Prevent temperature display jitter (thanks to TinkerGnome)'))
			s.Add(wx.StaticText(p, -1, '* Fixed problems with filenames containing an umlaut.'))
			s.Add(wx.StaticText(p, -1, '* Improved pause handling (thanks to ThinkerGnome)'))
			button = wx.Button(p, -1, 'Install now')
			self.Bind(wx.EVT_BUTTON, self.OnUltimaker2Firmware, button)
			s.Add(button, flag=wx.TOP, border=5)

		s.Add(wx.StaticLine(p), flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=10)
		button = wx.Button(p, -1, 'Ok')
		self.Bind(wx.EVT_BUTTON, self.OnOk, button)
		s.Add(button, flag=wx.TOP|wx.ALIGN_RIGHT, border=5)

		self.Fit()
		self.Centre()
Ejemplo n.º 3
0
	def __init__(self, parent, callback):
		wx.Panel.__init__(self, parent,-1)

		self.callback = callback
		self.alterationFileList = ['start.gcode', 'end.gcode']#, 'nextobject.gcode', 'replace.csv'
		if int(profile.getMachineSetting('extruder_amount')) > 1:
			self.alterationFileList += ['preSwitchExtruder.gcode', 'postSwitchExtruder.gcode']
			self.alterationFileList += ['start2.gcode', 'end2.gcode']
		if int(profile.getMachineSetting('extruder_amount')) > 2:
			self.alterationFileList += ['start3.gcode', 'end3.gcode']
		if int(profile.getMachineSetting('extruder_amount')) > 3:
			self.alterationFileList += ['start4.gcode', 'end4.gcode']
		if int(profile.getMachineSetting('extruder_amount')) > 4:
			self.alterationFileList += ['start5.gcode', 'end5.gcode']
		self.currentFile = None

		self.textArea = gcodeTextArea.GcodeTextArea(self)
		self.list = wx.ListBox(self, choices=self.alterationFileList, style=wx.LB_SINGLE)
		self.list.SetSelection(0)
		self.Bind(wx.EVT_LISTBOX, self.OnSelect, self.list)
		self.textArea.Bind(wx.EVT_KILL_FOCUS, self.OnFocusLost, self.textArea)
		self.textArea.Bind(wx.stc.EVT_STC_CHANGE, self.OnFocusLost, self.textArea)
		
		sizer = wx.GridBagSizer()
		sizer.Add(self.list, (0,0), span=(5,1), flag=wx.EXPAND)
		sizer.Add(self.textArea, (5,0), span=(5,1), flag=wx.EXPAND)
		sizer.AddGrowableCol(0)
		sizer.AddGrowableRow(0)
		sizer.AddGrowableRow(5)
		sizer.AddGrowableRow(6)
		sizer.AddGrowableRow(7)
		self.SetSizer(sizer)
		
		self.loadFile(self.alterationFileList[self.list.GetSelection()])
		self.currentFile = self.list.GetSelection()
Ejemplo n.º 4
0
    def __init__(self, parent, filename = None, port = None, machineIndex = None):
        super(UpdateFirmware, self).__init__(parent=parent, title="Firmware install for %s" % (profile.getMachineSetting('machine_name', machineIndex).title()), size=(250, 100))

        if port is None:
            port = profile.getMachineSetting('serial_port')
        if filename is None:
            filename = getDefaultFirmware(machineIndex)
            self._default_firmware = False
        self._machine_type = profile.getMachineSetting('machine_type', machineIndex)

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.progressLabel = wx.StaticText(self, -1, 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nX\nX')
        sizer.Add(self.progressLabel, 0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
        self.progressGauge = wx.Gauge(self, -1)
        sizer.Add(self.progressGauge, 0, flag=wx.EXPAND)
        self.okButton = wx.Button(self, -1, _("OK"))
        self.okButton.Disable()
        self.okButton.Bind(wx.EVT_BUTTON, self.OnOk)
        sizer.Add(self.okButton, 0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
        self.SetSizer(sizer)

        self.port = port
        self.filename = filename

        self.Layout()
        self.Fit()

        self.thread = threading.Thread(target=self.OnRun)
        self.thread.daemon = True
        self.thread.start()

        self.ShowModal()
        self.Destroy()
        return
Ejemplo n.º 5
0
	def __init__(self, parent = None, filename = None, port = None, machineIndex = None):
		super(InstallFirmwareDialog, self).__init__(parent=parent, title=_("Firmware install for %s") % (profile.getMachineName(machineIndex).title()), size=(250, 100))
		if port is None:
			port = profile.getMachineSetting('serial_port')
		if filename is None:
			filename = getDefaultFirmware(machineIndex)
		self._machine_type = profile.getMachineSetting('machine_type', machineIndex)
		if self._machine_type == 'reprap':
			wx.MessageBox(_("Cura only supports firmware updates for ATMega2560 based hardware.\nSo updating your RepRap with Cura might or might not work."), _("Firmware update"), wx.OK | wx.ICON_INFORMATION)

		sizer = wx.BoxSizer(wx.VERTICAL)

		self.progressLabel = wx.StaticText(self, -1, 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nX\nX')
		sizer.Add(self.progressLabel, 0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
		self.progressGauge = wx.Gauge(self, -1)
		sizer.Add(self.progressGauge, 0, flag=wx.EXPAND)
		self.okButton = wx.Button(self, -1, _("OK"))
		self.okButton.Disable()
		self.okButton.Bind(wx.EVT_BUTTON, self.OnOk)
		sizer.Add(self.okButton, 0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
		self.SetSizer(sizer)

		self.filename = filename
		self.port = port

		self.Layout()
		self.Fit()
		self.success = False
		self.show_connect_error_dialog = False
Ejemplo n.º 6
0
    def __init__(self,
                 parent=None,
                 filename=None,
                 port=None,
                 machineIndex=None):
        super(InstallFirmware, self).__init__(
            parent=parent,
            title="Firmware install for %s" %
            (profile.getMachineSetting('machine_name', machineIndex).title()),
            size=(250, 100))
        if port is None:
            port = profile.getMachineSetting('serial_port')
        if filename is None:
            filename = getDefaultFirmware(machineIndex)
            self._default_firmware = True
        else:
            self._default_firmware = False
        if filename is None:
            wx.MessageBox(
                _("I am sorry, but Cura does not ship with a default firmware for your machine configuration."
                  ), _("Firmware update"), wx.OK | wx.ICON_ERROR)
            self.Destroy()
            return
        self._machine_type = profile.getMachineSetting('machine_type',
                                                       machineIndex)
        if self._machine_type == 'reprap':
            wx.MessageBox(
                _("Cura only supports firmware updates for ATMega2560 based hardware.\nSo updating your RepRap with Cura might or might not work."
                  ), _("Firmware update"), wx.OK | wx.ICON_INFORMATION)

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.progressLabel = wx.StaticText(
            self, -1,
            'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nX\nX')
        sizer.Add(self.progressLabel,
                  0,
                  flag=wx.ALIGN_CENTER | wx.ALL,
                  border=5)
        self.progressGauge = wx.Gauge(self, -1)
        sizer.Add(self.progressGauge, 0, flag=wx.EXPAND)
        self.okButton = wx.Button(self, -1, _("OK"))
        self.okButton.Disable()
        self.okButton.Bind(wx.EVT_BUTTON, self.OnOk)
        sizer.Add(self.okButton, 0, flag=wx.ALIGN_CENTER | wx.ALL, border=5)
        self.SetSizer(sizer)

        self.filename = filename
        self.port = port

        self.Layout()
        self.Fit()

        self.thread = threading.Thread(target=self.OnRun)
        self.thread.daemon = True
        self.thread.start()

        self.ShowModal()
        self.Destroy()
        return
Ejemplo n.º 7
0
	def afterSplashCallback(self):
		#These imports take most of the time and thus should be done after showing the splashscreen
		import webbrowser
		from Cura.gui import mainWindow
		from Cura.gui import configWizard
		from Cura.gui import newVersionDialog
		from Cura.util import profile
		from Cura.util import resources
		from Cura.util import version

		resources.setupLocalization(profile.getPreference('language'))  # it's important to set up localization at very beginning to install _

		#If we do not have preferences yet, try to load it from a previous Cura install
		if profile.getMachineSetting('machine_type') == 'unknown':
			try:
				otherCuraInstalls = profile.getAlternativeBasePaths()
				otherCuraInstalls.sort()
				if len(otherCuraInstalls) > 0:
					profile.loadPreferences(os.path.join(otherCuraInstalls[-1], 'preferences.ini'))
					profile.loadProfile(os.path.join(otherCuraInstalls[-1], 'current_profile.ini'))
			except:
				import traceback
				print traceback.print_exc()

		#If we haven't run it before, run the configuration wizard.
		if profile.getMachineSetting('machine_type') == 'unknown':
			otherCuraInstalls = profile.getAlternativeBasePaths()
			otherCuraInstalls.sort()
			if len(otherCuraInstalls) > 0:
				profile.loadPreferences(os.path.join(otherCuraInstalls[-1], 'preferences.ini'))
				profile.loadProfile(os.path.join(otherCuraInstalls[-1], 'current_profile.ini'))
			#Check if we need to copy our examples
			exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'UltimakerRobot_support.stl'))

			self.loadFiles = [exampleFile]
			if self.splash is not None:
				self.splash.Show(False)
			configWizard.configWizard()

		if profile.getMachineSetting('machine_name') == '':
			return
		self.mainWindow = mainWindow.mainWindow()

		if self.splash is not None:
			pass
			# self.splash.Show(False)
		self.SetTopWindow(self.mainWindow)
		self.mainWindow.Show()
		self.mainWindow.OnDropFiles(self.loadFiles)


		# if profile.getPreference('last_run_version') != version.getVersion(False):
		# 	print(2)
		# 	profile.putPreference('last_run_version', version.getVersion(False))
		# 	newVersionDialog.newVersionDialog().Show()

		setFullScreenCapable(self.mainWindow)

		if sys.platform.startswith('darwin'):
			wx.CallAfter(self.StupidMacOSWorkaround)
Ejemplo n.º 8
0
	def __init__(self, parent = None, filename = None, port = None, machineIndex = None):
		super(InstallFirmwareDialog, self).__init__(parent=parent, title=_("Firmware install for %s") % (profile.getMachineName(machineIndex).title()), size=(250, 100))
		if port is None:
			port = profile.getMachineSetting('serial_port')
		if filename is None:
			filename = getDefaultFirmware(machineIndex)
		self._machine_type = profile.getMachineSetting('machine_type', machineIndex)
		if self._machine_type == 'reprap':
			wx.MessageBox(_("Cura only supports firmware updates for ATMega2560 based hardware.\nSo updating your RepRap with Cura might or might not work."), _("Firmware update"), wx.OK | wx.ICON_INFORMATION)

		sizer = wx.BoxSizer(wx.VERTICAL)

		self.progressLabel = wx.StaticText(self, -1, 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nX\nX')
		sizer.Add(self.progressLabel, 0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
		self.progressGauge = wx.Gauge(self, -1)
		sizer.Add(self.progressGauge, 0, flag=wx.EXPAND)
		self.okButton = wx.Button(self, -1, _("OK"))
		self.okButton.Disable()
		self.okButton.Bind(wx.EVT_BUTTON, self.OnOk)
		sizer.Add(self.okButton, 0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
		self.SetSizer(sizer)

		self.filename = filename
		self.port = port

		self.Layout()
		self.Fit()
		self.success = False
Ejemplo n.º 9
0
	def updateSliceMode(self):
		isSimple = profile.getPreference('startMode') == 'Simple'

		self.normalSettingsPanel.Show(not isSimple)
		self.simpleSettingsPanel.Show(isSimple)
		self.leftPane.Layout()

		# Set splitter sash position & size
		if isSimple:
			self.switchToQuickprintMenuItem.Check()
			# Save normal mode sash
			self.normalSashPos = self.splitter.GetSashPosition()

			# Change location of sash to width of quick mode pane
			(width, height) = self.simpleSettingsPanel.GetSizer().GetSize()
			self.splitter.SetSashPosition(width, True)

			# Disable sash
			self.splitter.SetSashSize(0)
		else:
			self.splitter.SetSashPosition(self.normalSashPos, True)
			# Enabled sash
			self.splitter.SetSashSize(4)
#		self.defaultFirmwareInstallMenuItem.Enable(firmwareInstall.getDefaultFirmware() is not None)
		if profile.getMachineSetting('machine_type').startswith('ultimaker2'):
			pass
		if int(profile.getMachineSetting('extruder_amount')) < 2:
			pass
		self.scene.updateProfileToControls()
		self.scene._scene.pushFree()
Ejemplo n.º 10
0
	def afterSplashCallback(self):
		#These imports take most of the time and thus should be done after showing the splashscreen
		import webbrowser
		from Cura.gui import mainWindow
		from Cura.gui import configWizard
		from Cura.util import profile
		from Cura.util import resources
		from Cura.util import version

		resources.setupLocalization(profile.getPreference('language'))  # it's important to set up localization at very beginning to install _

		#If we do not have preferences yet, try to load it from a previous Cura install
		if profile.getMachineSetting('machine_type') == 'unknown':
			try:
				otherCuraInstalls = profile.getAlternativeBasePaths()
				otherCuraInstalls.sort()
				if len(otherCuraInstalls) > 0:
					profile.loadPreferences(os.path.join(otherCuraInstalls[-1], 'preferences.ini'))
					profile.loadProfile(os.path.join(otherCuraInstalls[-1], 'current_profile.ini'))
			except:
				import traceback
				print traceback.print_exc()

		#If we haven't run it before, run the configuration wizard.
		if profile.getMachineSetting('machine_type') == 'unknown':
			if platform.system() == "Windows":
				exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'whoborn.stl'))
			else:
				#Check if we need to copy our examples
				exampleFile = os.path.expanduser('~/CuraExamples/whoborn.stl')
				if not os.path.isfile(exampleFile):
					try:
						os.makedirs(os.path.dirname(exampleFile))
					except:
						pass
					for filename in glob.glob(os.path.normpath(os.path.join(resources.resourceBasePath, 'example', '*.*'))):
						shutil.copy(filename, os.path.join(os.path.dirname(exampleFile), os.path.basename(filename)))
			self.loadFiles = [exampleFile]
			if self.splash is not None:
				self.splash.Show(False)
			configWizard.configWizard()

		# if profile.getPreference('check_for_updates') == 'True':
		# 	newVersion = version.checkForNewerVersion()
		# 	if newVersion is not None:
		# 		if self.splash is not None:
		# 			self.splash.Show(False)
		# 		if wx.MessageBox(_("A new version of Cura is available, would you like to download?"), _("New version available"), wx.YES_NO | wx.ICON_INFORMATION) == wx.YES:
		# 			webbrowser.open(newVersion)
		# 			return
		if profile.getMachineSetting('machine_name') == '':
			return
		self.mainWindow = mainWindow.mainWindow()
		if self.splash is not None:
			self.splash.Show(False)
		self.mainWindow.Show()
		self.mainWindow.OnDropFiles(self.loadFiles)

		setFullScreenCapable(self.mainWindow)
Ejemplo n.º 11
0
	def afterSplashCallback(self):
		#These imports take most of the time and thus should be done after showing the splashscreen
		import webbrowser
		from Cura.gui import mainWindow
		from Cura.gui import configWizard
		from Cura.util import profile
		from Cura.util import resources
		from Cura.util import version

		resources.setupLocalization(profile.getPreference('language'))  # it's important to set up localization at very beginning to install _

		#If we do not have preferences yet, try to load it from a previous Cura install
		if profile.getMachineSetting('machine_type') == 'unknown':
			try:
				otherCuraInstalls = profile.getAlternativeBasePaths()
				otherCuraInstalls.sort()
				if len(otherCuraInstalls) > 0:
					profile.loadPreferences(os.path.join(otherCuraInstalls[-1], 'preferences.ini'))
					profile.loadProfile(os.path.join(otherCuraInstalls[-1], 'current_profile.ini'))
			except:
				import traceback
				print traceback.print_exc()

		#If we haven't run it before, run the configuration wizard.
		if profile.getMachineSetting('machine_type') == 'unknown':
			if platform.system() == "Windows":
				exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'lugo-hand2.stl'))
			else:
				#Check if we need to copy our examples
				exampleFile = os.path.expanduser('~/CuraExamples/lugo-hand2.stl')
				if not os.path.isfile(exampleFile):
					try:
						os.makedirs(os.path.dirname(exampleFile))
					except:
						pass
					for filename in glob.glob(os.path.normpath(os.path.join(resources.resourceBasePath, 'example', '*.*'))):
						shutil.copy(filename, os.path.join(os.path.dirname(exampleFile), os.path.basename(filename)))
			self.loadFiles = [exampleFile]
			if self.splash is not None:
				self.splash.Show(False)
			configWizard.configWizard()

		if profile.getPreference('check_for_updates') == 'True':
			newVersion = version.checkForNewerVersion()
			if newVersion is not None:
				if self.splash is not None:
					self.splash.Show(False)
				if wx.MessageBox(_("A new version of Cura is available, would you like to download?"), _("New version available"), wx.YES_NO | wx.ICON_INFORMATION) == wx.YES:
					webbrowser.open(newVersion)
					return
		if profile.getMachineSetting('machine_name') == '':
			return
		self.mainWindow = mainWindow.mainWindow()
		if self.splash is not None:
			self.splash.Show(False)
		self.mainWindow.Show()
		self.mainWindow.OnDropFiles(self.loadFiles)

		setFullScreenCapable(self.mainWindow)
Ejemplo n.º 12
0
def baudrateList():
    ret = [250000, 230400, 115200, 57600, 38400, 19200, 9600]
    if profile.getMachineSetting('serial_baud_auto') != '':
        prev = int(profile.getMachineSetting('serial_baud_auto'))
        if prev in ret:
            ret.remove(prev)
            ret.insert(0, prev)
    return ret
Ejemplo n.º 13
0
	def _moveE(self, step):
		feedrate = 120
		if "lulzbot_" in profile.getMachineSetting("machine_type"):
			toolhead_name = profile.getMachineSetting("toolhead")
			toolhead_name = toolhead_name.lower()
			if "flexy" in toolhead_name:
				feedrate = 30
		self._moveXYZE("E", step, feedrate)
Ejemplo n.º 14
0
def baudrateList():
	ret = [250000, 230400, 115200, 57600, 38400, 19200, 9600]
	if profile.getMachineSetting('serial_baud_auto') != '':
		prev = int(profile.getMachineSetting('serial_baud_auto'))
		if prev in ret:
			ret.remove(prev)
			ret.insert(0, prev)
	return ret
Ejemplo n.º 15
0
	def _moveE(self, step):
		feedrate = 120
		if "lulzbot_" in profile.getMachineSetting("machine_type"):
			toolhead_name = profile.getMachineSetting("toolhead")
			toolhead_name = toolhead_name.lower()
			if "flexy" in toolhead_name:
				feedrate = 30
		self._moveXYZE("E", step, feedrate)
Ejemplo n.º 16
0
 def setupSlice(self):
     if profile.getMachineSetting('machine_type') == 'JoysmakerR1':
         setupSliceJoysmakerR1()
     elif profile.getMachineSetting('machine_type') == 'JoysmakerR2':
         setupSliceJoysmakerR2()
     elif profile.getMachineSetting('machine_type') == 'Myriwell':
         setupSliceMyriwell()
     else:
         setupSliceDefault()
Ejemplo n.º 17
0
    def updateSliceMode(self, changedMode=True):
        isSimple = profile.getPreference('startMode') == 'Simple'

        self.normalSettingsPanel.Show(not isSimple)
        self.simpleSettingsPanel.Show(isSimple)
        self.leftPane.Layout()

        for i in self.normalModeOnlyItems:
            i.Enable(not isSimple)
        if isSimple:
            self.switchToQuickprintMenuItem.Check()
        else:
            self.switchToNormalMenuItem.Check()

        # Set splitter sash position & size
        if isSimple:
            # Save normal mode sash (only if we changed mode from normal
            # to simple)
            if changedMode:
                self.normalSashPos = self.splitter.GetSashPosition()

            # Change location of sash to width of quick mode pane
            self.simpleSettingsPanel.Layout()
            self.simpleSettingsPanel.Fit()
            (width, height) = self.simpleSettingsPanel.GetSizer().GetSize()
            if width > 0:
                self.splitter.SetSashPosition(width, True)
            else:
                self.splitter.SizeWindows()

            # Disable sash
            self.splitter.SetSashSize(0)
        else:
            # Only change the sash position if we changed mode from simple
            if changedMode:
                self.splitter.SetSashPosition(self.normalSashPos, True)

            # Enabled sash
            self.splitter.SetSashSize(4)
        self.defaultFirmwareInstallMenuItem.Enable(
            firmwareInstall.getDefaultFirmware() is not None)
        if profile.getMachineSetting('machine_type').startswith('ultimaker2') or \
           profile.getMachineSetting('machine_type').startswith('lulzbot_'):
            self.bedLevelWizardMenuItem.Enable(False)
            self.headOffsetWizardMenuItem.Enable(False)
        else:
            self.bedLevelWizardMenuItem.Enable(True)
            self.headOffsetWizardMenuItem.Enable(False)
            self.oneAtATime.Enable(True)
            if profile.getPreference('oneAtATime') == 'True':
                self.oneAtATime.Check(True)
            else:
                self.allAtOnceItem.Check(True)
        if int(profile.getMachineSetting('extruder_amount')) < 2:
            self.headOffsetWizardMenuItem.Enable(False)
        self.scene.updateProfileToControls()
        self.scene._scene.pushFree()
Ejemplo n.º 18
0
 def _tcpCommunicationThread(self):
     if platform.system() == "Darwin" and hasattr(sys, 'frozen'):
         cmdList = [
             os.path.join(os.path.dirname(sys.executable), 'Cura'),
             '--tcpCommunication'
         ]
         cmdList += [
             self._portName + ':' +
             profile.getMachineSetting('tcp_ip_address')
         ]
     else:
         cmdList = [sys.executable, '-m', 'Cura.tcpCommunication']
         cmdList += [
             self._portName,
             profile.getMachineSetting('tcp_ip_address')
         ]
     if platform.system() == "Darwin":
         if platform.machine() == 'i386':
             cmdList = ['arch', '-i386'] + cmdList
     self._process = subprocess.Popen(cmdList,
                                      stdin=subprocess.PIPE,
                                      stdout=subprocess.PIPE)
     line = self._process.stdout.readline()
     while len(line) > 0:
         line = line.strip()
         line = line.split(':', 1)
         if line[0] == '':
             pass
         elif line[0] == 'log':
             self._log.append(line[1])
             if len(self._log) > 200:
                 self._log.pop(0)
         elif line[0] == 'temp':
             line = line[1].split(':')
             self._temperature = json.loads(line[0])
             self._targetTemperature = json.loads(line[1])
             self._bedTemperature = float(line[2])
             self._targetBedTemperature = float(line[3])
             self._doCallback()
         elif line[0] == 'message':
             self._doCallback(line[1])
         elif line[0] == 'state':
             line = line[1].split(':', 1)
             self._commState = int(line[0])
             self._commStateString = line[1]
             self._doCallback('')
         elif line[0] == 'progress':
             self._printProgress = int(line[1])
             self._doCallback()
         elif line[0] == 'changeZ':
             self._ZPosition = float(line[1])
             self._doCallback()
         else:
             print line
         line = self._process.stdout.readline()
     self._process = None
Ejemplo n.º 19
0
    def __init__(self, parent=None, filename=None, port=None, machineIndex=None):
        super(InstallFirmware, self).__init__(
            parent=parent,
            title="Firmware install for %s" % (profile.getMachineSetting("machine_name", machineIndex).title()),
            size=(250, 100),
        )
        if port is None:
            port = profile.getMachineSetting("serial_port")
        if filename is None:
            filename = getDefaultFirmware(machineIndex)
            self._default_firmware = True
        else:
            self._default_firmware = False
        if filename is None:
            wx.MessageBox(
                _("I am sorry, but Cura does not ship with a default firmware for your machine configuration."),
                _("Firmware update"),
                wx.OK | wx.ICON_ERROR,
            )
            self.Destroy()
            return
        self._machine_type = profile.getMachineSetting("machine_type", machineIndex)
        if self._machine_type == "reprap":
            wx.MessageBox(
                _(
                    "Cura only supports firmware updates for ATMega2560 based hardware.\nSo updating your RepRap with Cura might or might not work."
                ),
                _("Firmware update"),
                wx.OK | wx.ICON_INFORMATION,
            )

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.progressLabel = wx.StaticText(self, -1, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nX\nX")
        sizer.Add(self.progressLabel, 0, flag=wx.ALIGN_CENTER | wx.ALL, border=5)
        self.progressGauge = wx.Gauge(self, -1)
        sizer.Add(self.progressGauge, 0, flag=wx.EXPAND)
        self.okButton = wx.Button(self, -1, _("OK"))
        self.okButton.Disable()
        self.okButton.Bind(wx.EVT_BUTTON, self.OnOk)
        sizer.Add(self.okButton, 0, flag=wx.ALIGN_CENTER | wx.ALL, border=5)
        self.SetSizer(sizer)

        self.filename = filename
        self.port = port

        self.Layout()
        self.Fit()

        self.thread = threading.Thread(target=self.OnRun)
        self.thread.daemon = True
        self.thread.start()

        self.ShowModal()
        self.Destroy()
        return
Ejemplo n.º 20
0
	def updateSliceMode(self, changedMode = True):
		isSimple = profile.getPreference('startMode') == 'Simple'

		self.normalSettingsPanel.Show(not isSimple)
		self.simpleSettingsPanel.Show(isSimple)
		self.leftPane.Layout()

		for i in self.normalModeOnlyItems:
			i.Enable(not isSimple)
		if isSimple:
			self.switchToQuickprintMenuItem.Check()
		else:
			self.switchToNormalMenuItem.Check()

		# Set splitter sash position & size
		if isSimple:
			# Save normal mode sash (only if we changed mode from normal
			# to simple)
			if changedMode:
				self.normalSashPos = self.splitter.GetSashPosition()

			# Change location of sash to width of quick mode pane
			self.simpleSettingsPanel.Layout()
			self.simpleSettingsPanel.Fit()
			(width, height) = self.simpleSettingsPanel.GetSizer().GetSize()
			if width > 0:
				self.splitter.SetSashPosition(width, True)
			else:
				self.splitter.SizeWindows()

			# Disable sash
			self.splitter.SetSashSize(0)
		else:
			# Only change the sash position if we changed mode from simple
			if changedMode:
				self.splitter.SetSashPosition(self.normalSashPos, True)

			# Enabled sash
			self.splitter.SetSashSize(4)
		self.defaultFirmwareInstallMenuItem.Enable(firmwareInstall.getDefaultFirmware() is not None)
		if profile.getMachineSetting('machine_type').startswith('ultimaker2') or \
		   profile.getMachineSetting('machine_type').startswith('lulzbot_'):
			self.bedLevelWizardMenuItem.Enable(False)
			self.headOffsetWizardMenuItem.Enable(False)
		else:
			self.bedLevelWizardMenuItem.Enable(True)
			self.headOffsetWizardMenuItem.Enable(False)
			self.oneAtATime.Enable(True)
			if profile.getPreference('oneAtATime') == 'True':
				self.oneAtATime.Check(True)
			else:
				self.allAtOnceItem.Check(True)
		if int(profile.getMachineSetting('extruder_amount')) < 2:
			self.headOffsetWizardMenuItem.Enable(False)
		self.scene.updateProfileToControls()
		self.scene._scene.pushFree()
Ejemplo n.º 21
0
def machineIsConnected():
    #UltiGCode is designed for SD-Card printing, so never auto-detect the serial port.
    port = profile.getMachineSetting('serial_port')
    if port == 'AUTO':
        if profile.getMachineSetting('gcode_flavor') == 'UltiGCode':
            return False
        return len(serialList(True)) > 0
    if platform.system() == "Windows":
        return port in serialList()
    return os.path.isfile(port)
Ejemplo n.º 22
0
def machineIsConnected():
	#UltiGCode is designed for SD-Card printing, so never auto-detect the serial port.
	port = profile.getMachineSetting('serial_port')
	if port == 'AUTO':
		if profile.getMachineSetting('gcode_flavor') == 'UltiGCode':
			return False
		return len(serialList(True)) > 0
	if platform.system() == "Windows":
		return port in serialList()
	return os.path.isfile(port)
Ejemplo n.º 23
0
def baudrateList():
    """
	:return: a list of integers containing all possible baudrates at which we can communicate.
			Used for auto-baudrate detection as well as manual baudrate selection.
	"""
    ret = [250000, 230400, 115200, 57600, 38400, 19200, 9600]
    if profile.getMachineSetting('serial_baud_auto') != '':
        prev = int(profile.getMachineSetting('serial_baud_auto'))
        if prev in ret:
            ret.remove(prev)
            ret.insert(0, prev)
    return ret
Ejemplo n.º 24
0
def getDefaultFirmware(machineIndex=None):
    machine_type = profile.getMachineSetting('machine_type', machineIndex)
    extruders = profile.getMachineSettingFloat('extruder_amount', machineIndex)
    heated_bed = profile.getMachineSetting('has_heated_bed',
                                           machineIndex) == 'True'
    baudrate = 250000

    if sys.platform.startswith('linux'):
        baudrate = 115200
    if machine_type == 'BCN3DSigma':
        return resources.getPathForFirmware("MarlinBCN3DSigma.hex")

    if machine_type == 'ultimaker':
        name = 'MarlinUltimaker'
        if extruders > 2:
            return None
        if heated_bed:
            name += '-HBK'
        name += '-%d' % (baudrate)
        if extruders > 1:
            name += '-dual'
        return resources.getPathForFirmware(name + '.hex')

    if machine_type == 'ultimaker_plus':
        name = 'MarlinUltimaker-UMOP-%d' % (baudrate)
        if extruders > 2:
            return None
        if extruders > 1:
            name += '-dual'
        return resources.getPathForFirmware(name + '.hex')

    if machine_type == 'ultimaker2':
        if extruders > 2:
            return None
        if extruders > 1:
            return resources.getPathForFirmware("MarlinUltimaker2-dual.hex")
        return resources.getPathForFirmware("MarlinUltimaker2.hex")
    if machine_type == 'ultimaker2go':
        return resources.getPathForFirmware("MarlinUltimaker2go.hex")
    if machine_type == 'ultimaker2extended':
        if extruders > 2:
            return None
        if extruders > 1:
            return resources.getPathForFirmware(
                "MarlinUltimaker2extended-dual.hex")
        return resources.getPathForFirmware("MarlinUltimaker2extended.hex")
    if machine_type == 'ultimaker2+':
        return resources.getPathForFirmware("MarlinUltimaker2Plus.hex")
    if machine_type == 'ultimaker2+extended':
        return resources.getPathForFirmware("MarlinUltimaker2PlusExtended.hex")
    if machine_type == 'Witbox':
        return resources.getPathForFirmware("MarlinWitbox.hex")
    return None
Ejemplo n.º 25
0
	def checkMachineConfigurations(self):
		from Cura.util import profile
		for index in xrange(0, profile.getMachineCount()):
			machine_type = profile.getMachineSetting('machine_type', index)
			# Fix the Ultimaker2 build volume, which was wrong in previous version of Cura.
			if machine_type.startswith('ultimaker2') and not machine_type.startswith('ultimaker2go'):
				if abs(float(profile.getMachineSetting('machine_width', index)) - 230) < 10:
					profile.putMachineSetting('machine_width', '223', index)
				if abs(float(profile.getMachineSetting('machine_depth', index)) - 230) < 10:
					profile.putMachineSetting('machine_depth', '223', index)
				if abs(float(profile.getMachineSetting('machine_depth', index)) - 315) < 1:
					profile.putMachineSetting('machine_depth', '305', index)
Ejemplo n.º 26
0
	def getAvailableConnections(self):
		if profile.getMachineSetting('serial_port') == 'AUTO':
			serialList = machineCom.serialList(True)
		else:
			serialList = [profile.getMachineSetting('serial_port')]
		for port in serialList:
			if port not in self._connectionMap:
				self._connectionMap[port] = serialConnection(port)
		for key in self._connectionMap.keys():
			if key not in serialList and not self._connectionMap[key].isActiveConnectionOpen():
				self._connectionMap.pop(key)
		return self._connectionMap.values()
Ejemplo n.º 27
0
	def checkMachineConfigurations(self):
		from Cura.util import profile
		for index in xrange(0, profile.getMachineCount()):
			machine_type = profile.getMachineSetting('machine_type', index)
			# Fix the Ultimaker2 build volume, which was wrong in previous version of Cura.
			if machine_type.startswith('ultimaker2') and not machine_type.startswith('ultimaker2go'):
				if abs(float(profile.getMachineSetting('machine_width', index)) - 230) < 10:
					profile.putMachineSetting('machine_width', '223', index)
				if abs(float(profile.getMachineSetting('machine_depth', index)) - 230) < 10:
					profile.putMachineSetting('machine_depth', '223', index)
				if abs(float(profile.getMachineSetting('machine_depth', index)) - 315) < 1:
					profile.putMachineSetting('machine_depth', '305', index)
Ejemplo n.º 28
0
def baudrateList():
	"""
	:return: a list of integers containing all possible baudrates at which we can communicate.
			Used for auto-baudrate detection as well as manual baudrate selection.
	"""
	ret = [250000, 230400, 115200, 57600, 38400, 19200, 9600]
	if profile.getMachineSetting('serial_baud_auto') != '':
		prev = int(profile.getMachineSetting('serial_baud_auto'))
		if prev in ret:
			ret.remove(prev)
			ret.insert(0, prev)
	return ret
Ejemplo n.º 29
0
 def getAvailableConnections(self):
     if profile.getMachineSetting('serial_port') == 'AUTO':
         serialList = machineCom.serialList(True)
     else:
         serialList = [profile.getMachineSetting('serial_port')]
     for port in serialList:
         if port not in self._connectionMap:
             self._connectionMap[port] = serialConnection(port)
     for key in self._connectionMap.keys():
         if key not in serialList and not self._connectionMap[
                 key].isActiveConnectionOpen():
             self._connectionMap.pop(key)
     return self._connectionMap.values()
Ejemplo n.º 30
0
def getDefaultFirmware(machineIndex = None):
    machine_type = profile.getMachineSetting('machine_type', machineIndex)
    extruders = profile.getMachineSettingFloat('extruder_amount', machineIndex)
    heated_bed = profile.getMachineSetting('has_heated_bed', machineIndex) == 'True'
    baudrate = 250000

    if sys.platform.startswith('linux'):
        baudrate = 115200
    if machine_type == 'BCN3DSigma':
        return resources.getPathForFirmware("MarlinBCN3DSigma.hex")

    if machine_type == 'ultimaker':
        name = 'MarlinUltimaker'
        if extruders > 2:
            return None
        if heated_bed:
            name += '-HBK'
        name += '-%d' % (baudrate)
        if extruders > 1:
            name += '-dual'
        return resources.getPathForFirmware(name + '.hex')

    if machine_type == 'ultimaker_plus':
        name = 'MarlinUltimaker-UMOP-%d' % (baudrate)
        if extruders > 2:
            return None
        if extruders > 1:
            name += '-dual'
        return resources.getPathForFirmware(name + '.hex')

    if machine_type == 'ultimaker2':
        if extruders > 2:
            return None
        if extruders > 1:
            return resources.getPathForFirmware("MarlinUltimaker2-dual.hex")
        return resources.getPathForFirmware("MarlinUltimaker2.hex")
    if machine_type == 'ultimaker2go':
        return resources.getPathForFirmware("MarlinUltimaker2go.hex")
    if machine_type == 'ultimaker2extended':
        if extruders > 2:
            return None
        if extruders > 1:
            return resources.getPathForFirmware("MarlinUltimaker2extended-dual.hex")
        return resources.getPathForFirmware("MarlinUltimaker2extended.hex")
    if machine_type == 'ultimaker2+':
        return resources.getPathForFirmware("MarlinUltimaker2Plus.hex")
    if machine_type == 'ultimaker2+extended':
        return resources.getPathForFirmware("MarlinUltimaker2PlusExtended.hex")
    if machine_type == 'Witbox':
        return resources.getPathForFirmware("MarlinWitbox.hex")
    return None
Ejemplo n.º 31
0
	def getSettingOverrides(self):
		settings = {}
		for setting in profile.settingsList:
			if not setting.isProfile():
				continue
			settings[setting.getName()] = setting.getDefault()

		for button in self._print_profile_options:
			if button.GetValue():
				cp = configparser.ConfigParser()
				cp.read(button.filename)
				for setting in profile.settingsList:
					if setting.isProfile():
						if cp.has_option('profile', setting.getName()):
							settings[setting.getName()] = cp.get('profile', setting.getName())
		if profile.getMachineSetting('gcode_flavor') != 'UltiGCode':
			for button in self._print_material_options:
				if button.GetValue():
					cp = configparser.ConfigParser()
					cp.read(button.filename)
					for setting in profile.settingsList:
						if setting.isProfile():
							if cp.has_option('profile', setting.getName()):
								settings[setting.getName()] = cp.get('profile', setting.getName())

		if self.printSupport.GetValue():
			settings['support'] = "Exterior Only"
		return settings
Ejemplo n.º 32
0
def getDefaultFirmware():
	if profile.getMachineSetting('machine_type') == 'ultimaker':
		if profile.getMachineSetting('has_heated_bed') == 'True':
			return None
		if profile.getMachineSettingFloat('extruder_amount') > 2:
			return None
		if profile.getMachineSettingFloat('extruder_amount') > 1:
			if sys.platform.startswith('linux'):
				return resources.getPathForFirmware("MarlinUltimaker-115200-dual.hex")
			else:
				return resources.getPathForFirmware("MarlinUltimaker-250000-dual.hex")
		if sys.platform.startswith('linux'):
			return resources.getPathForFirmware("MarlinUltimaker-115200.hex")
		else:
			return resources.getPathForFirmware("MarlinUltimaker-250000.hex")
	return None
Ejemplo n.º 33
0
    def afterSplashCallback(self):
        #These imports take most of the time and thus should be done after showing the splashscreen
        from Cura.gui import configWizard
        from Cura.util import profile
        from Cura.util import resources
        # it's important to set up localization at very beginning to install
        language = profile.getPreference('language')
        resources.setupLocalization(language)

        if self.splash is not None:
            self.splash.Show(False)
            self.splash = None

        #If we haven't run it before, run the configuration wizard.
        if profile.getMachineSetting('machine_name') == '':
            configWizard.ConfigWizard()
            #Check if we need to copy our examples
            exampleFile = os.path.normpath(
                os.path.join(resources.resourceBasePath, 'example',
                             'dagoma.stl'))
            self.loadFiles = [exampleFile]

        from Cura.gui import mainWindow
        self.mainWindow = mainWindow.mainWindow()
        self.SetTopWindow(self.mainWindow)
        self.mainWindow.Show()
        self.mainWindow.OnDropFiles(self.loadFiles)

        setFullScreenCapable(self.mainWindow)

        if sys.platform.startswith('darwin'):
            from Cura.gui.util import macosFramesWorkaround as mfw
            wx.CallAfter(mfw.StupidMacOSWorkaround)
Ejemplo n.º 34
0
	def InitializeInfoPanelList(self, infoPanel):
		mainWindow = self.GetParent().GetParent().GetParent()
		settingsToDisplay = {}
		settingNames = ['layer_height', 'print_temperature', 'print_bed_temperature', 'fill_distance', 'wall_thickness']
		newValue = None
		degree_sign= u'\N{DEGREE SIGN}'
		# Check to see if heated bed and retraction are enabled; if not, remove them from display list
		if profile.getMachineSetting('has_heated_bed') == "False": settingNames.remove('print_bed_temperature')
		
		# dictionary key is set to setting name, dictionary value is set to static text object with label specific to what is set in profile at that point;
		# quality and strength panels need to override this
		for setting in settingNames:
			if setting == "fill_distance":
				fill_distance_display = str(profile.getProfileSetting(setting) + "mm")
				settingsToDisplay[setting] = wx.StaticText(infoPanel, -1, label=fill_distance_display)
			elif setting == "print_temperature": 
				print_temperature_display = str(profile.getProfileSetting(setting)) + degree_sign + "C"
				settingsToDisplay[setting] =  wx.StaticText(infoPanel, -1, label=print_temperature_display)
			elif setting == "print_bed_temperature":
				bed_temperature_display = str(profile.getProfileSetting(setting)) + degree_sign + "C"
				settingsToDisplay[setting] =  wx.StaticText(infoPanel, -1, label=bed_temperature_display)
			else:
				mm_display = str(profile.getProfileSetting(setting) + "mm")
				settingsToDisplay[setting] = wx.StaticText(infoPanel, -1, label=mm_display)
						
		self._callback()
		return settingsToDisplay
Ejemplo n.º 35
0
def serialList(forAutoDetect=False):
    baselist = []
    if platform.system() == "Windows":
        try:
            key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
                                  "HARDWARE\\DEVICEMAP\\SERIALCOMM")
            i = 0
            while True:
                values = _winreg.EnumValue(key, i)
                if not forAutoDetect or 'USBSER' in values[0]:
                    baselist += [values[1]]
                i += 1
        except:
            pass
    if forAutoDetect:
        baselist = baselist + glob.glob('/dev/ttyUSB*') + glob.glob(
            '/dev/ttyACM*') + glob.glob("/dev/cu.usb*")
        baselist = filter(lambda s: not 'Bluetooth' in s, baselist)
        prev = profile.getMachineSetting('serial_port_auto')
        if prev in baselist:
            baselist.remove(prev)
            baselist.insert(0, prev)
    else:
        baselist = baselist + glob.glob('/dev/ttyUSB*') + glob.glob(
            '/dev/ttyACM*') + glob.glob("/dev/cu.*") + glob.glob(
                "/dev/tty.usb*") + glob.glob("/dev/rfcomm*")
    if version.isDevVersion() and not forAutoDetect:
        baselist.append('VIRTUAL')
    return baselist
Ejemplo n.º 36
0
 def coolDown(self):
     cooldown_toolhead = "M104 S0"
     for i in range(0, int(profile.getMachineSetting('extruder_amount'))):
         change_toolhead = "T{}".format(i)
         self.sendCommand(change_toolhead)
         self.sendCommand(cooldown_toolhead)
     self.sendCommand("M140 S0")  #Bed
Ejemplo n.º 37
0
    def __init__(self, parent, callback):
        wx.Panel.__init__(self, parent, -1)

        self.callback = callback
        self.alterationFileList = ['start.gcode', 'end.gcode'
                                   ]  #, 'nextobject.gcode', 'replace.csv'
        if int(profile.getMachineSetting('extruder_amount')) > 1:
            self.alterationFileList += ['start2.gcode', 'end2.gcode']
        self.currentFile = None

        self.textArea = gcodeTextArea.GcodeTextArea(self)
        self.list = wx.ListBox(self,
                               choices=self.alterationFileList,
                               style=wx.LB_SINGLE)
        self.list.SetSelection(0)
        self.Bind(wx.EVT_LISTBOX, self.OnSelect, self.list)
        self.textArea.Bind(wx.EVT_KILL_FOCUS, self.OnFocusLost, self.textArea)
        self.textArea.Bind(wx.stc.EVT_STC_CHANGE, self.OnFocusLost,
                           self.textArea)

        sizer = wx.GridBagSizer()
        sizer.Add(self.list, (0, 0), span=(5, 1), flag=wx.EXPAND)
        sizer.Add(self.textArea, (5, 0), span=(5, 1), flag=wx.EXPAND)
        sizer.AddGrowableCol(0)
        sizer.AddGrowableRow(0)
        sizer.AddGrowableRow(5)
        sizer.AddGrowableRow(6)
        sizer.AddGrowableRow(7)
        self.SetSizer(sizer)

        self.loadFile(self.alterationFileList[self.list.GetSelection()])
        self.currentFile = self.list.GetSelection()
Ejemplo n.º 38
0
	def coolDown(self):
		cooldown_toolhead = "M104 S0"
		for i in range(0, int(profile.getMachineSetting('extruder_amount'))):
			change_toolhead = "T{}".format(i)
			self.sendCommand(change_toolhead)
			self.sendCommand(cooldown_toolhead)
		self.sendCommand("M140 S0") #Bed
Ejemplo n.º 39
0
	def updateMachineMenu(self):
		#Remove all items so we can rebuild the menu. Inserting items seems to cause crashes, so this is the safest way.
		for item in self.machineMenu.GetMenuItems():
			self.machineMenu.RemoveItem(item)

		#Add a menu item for each machine configuration.
		for n in xrange(0, profile.getMachineCount()):
			i = self.machineMenu.Append(n + 0x1000, profile.getMachineSetting('machine_name', n).title(), kind=wx.ITEM_RADIO)
			if n == int(profile.getPreferenceFloat('active_machine')):
				i.Check(True)
			self.Bind(wx.EVT_MENU, lambda e: self.OnSelectMachine(e.GetId() - 0x1000), i)

		self.machineMenu.AppendSeparator()
		i = self.machineMenu.Append(-1, _("Add new machine..."))
		self.Bind(wx.EVT_MENU, self.OnAddNewMachine, i)
		i = self.machineMenu.Append(-1, _("Machine settings..."))
		self.Bind(wx.EVT_MENU, self.OnMachineSettings, i)

		#Add tools for machines.
		self.machineMenu.AppendSeparator()

		self.defaultFirmwareInstallMenuItem = self.machineMenu.Append(-1, _("Install default firmware..."))
		self.Bind(wx.EVT_MENU, self.OnDefaultMarlinFirmware, self.defaultFirmwareInstallMenuItem)

		i = self.machineMenu.Append(-1, _("Install custom firmware..."))
		self.Bind(wx.EVT_MENU, self.OnCustomFirmware, i)
Ejemplo n.º 40
0
	def __init__(self, filename = None, port = None):
		super(InstallFirmware, self).__init__(parent=None, title="Firmware install", size=(250, 100))
		if port is None:
			port = profile.getMachineSetting('serial_port')
		if filename is None:
			filename = getDefaultFirmware()
		if filename is None:
			wx.MessageBox(_("I am sorry, but Cura does not ship with a default firmware for your machine configuration."), _("Firmware update"), wx.OK | wx.ICON_ERROR)
			self.Destroy()
			return

		sizer = wx.BoxSizer(wx.VERTICAL)

		self.progressLabel = wx.StaticText(self, -1, 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nX')
		sizer.Add(self.progressLabel, 0, flag=wx.ALIGN_CENTER)
		self.progressGauge = wx.Gauge(self, -1)
		sizer.Add(self.progressGauge, 0, flag=wx.EXPAND)
		self.okButton = wx.Button(self, -1, _("OK"))
		self.okButton.Disable()
		self.okButton.Bind(wx.EVT_BUTTON, self.OnOk)
		sizer.Add(self.okButton, 0, flag=wx.ALIGN_CENTER)
		self.SetSizer(sizer)

		self.filename = filename
		self.port = port

		self.Layout()
		self.Fit()

		threading.Thread(target=self.OnRun).start()

		self.ShowModal()
		self.Destroy()
		return
Ejemplo n.º 41
0
    def checkPlatform(self, obj):
        p = obj.getPosition()
        s = obj.getSize()[0:2] / 2 + self._sizeOffsets
        if p[0] - s[0] < -self._machineSize[0] / 2:
            return False
        if p[0] + s[0] > self._machineSize[0] / 2:
            return False
        if p[1] - s[1] < -self._machineSize[1] / 2:
            return False
        if p[1] + s[1] > self._machineSize[1] / 2:
            return False

        #Do clip Check for UM2.
        machine = profile.getMachineSetting('machine_type')
        if (machine == "ultimaker2"):
            #lowerRight clip check
            if p[0] - s[0] < -self._machineSize[0] / 2 + 25 and p[1] - s[
                    1] < -self._machineSize[1] / 2 + 10:
                return False
            #UpperRight
            if p[0] - s[0] < -self._machineSize[0] / 2 + 25 and p[1] + s[
                    1] > self._machineSize[1] / 2 - 10:
                return False
            #LowerLeft
            if p[0] + s[0] > self._machineSize[0] / 2 - 25 and p[1] - s[
                    1] < -self._machineSize[1] / 2 + 10:
                return False
            #UpperLeft
            if p[0] + s[0] > self._machineSize[0] / 2 - 25 and p[1] + s[
                    1] > self._machineSize[1] / 2 - 10:
                return False
        return True
Ejemplo n.º 42
0
    def __init__(self, parent, isWizard=False):
        wx.Panel.__init__(self, parent, wx.ID_ANY)

        self.name = profile.getMachineSetting('machine_name')
        printers = self.getPrinters(isWizard)

        pSizer = wx.FlexGridSizer(3, len(printers), 0, 0)
        pSizer.SetFlexibleDirection(wx.VERTICAL)
        for printer in printers:
            pSizer.Add(printer.image, flag=wx.ALIGN_CENTER)
        for printer in printers:
            pSizer.Add(printer.name, flag=wx.ALIGN_CENTER)
        for printer in printers:
            pSizer.Add(printer.description, flag=wx.ALIGN_CENTER)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(wx.StaticLine(self, -1),
                  flag=wx.EXPAND | wx.TOP | wx.BOTTOM,
                  border=5)
        sizer.Add(wx.StaticText(self, wx.ID_ANY,
                                _("Which printer do you use?")),
                  flag=wx.BOTTOM,
                  border=5)
        sizer.Add(pSizer)

        self.SetAutoLayout(True)
        self.SetSizerAndFit(sizer)
        self.Layout()
Ejemplo n.º 43
0
    def __init__(self, parent):
        super(MachineSelectPage, self).__init__(parent, _("Automatic Firmware Updater"))
        self.AddText(_("Check updates for which machine:"))

        BCN3DSigmaRadio = self.AddRadioButton("BCN3D " + u"\u03A3", style=wx.RB_GROUP)
        BCN3DSigmaRadio.Bind(wx.EVT_RADIOBUTTON, self.OnBCN3DSigmaSelect)
        if profile.getMachineSetting('machine_type') == 'BCN3DSigma':
            BCN3DSigmaRadio.SetValue(True)
        BCN3DPlusRadio = self.AddRadioButton("BCN3D +")
        BCN3DPlusRadio.Bind(wx.EVT_RADIOBUTTON, self.OnBCN3DPlusSelect)
        if profile.getMachineSetting('machine_type') == 'BCN3DPlus':
            BCN3DPlusRadio.SetValue(True)
        BCN3DRRadio = self.AddRadioButton("BCN3D R")
        BCN3DRRadio.Bind(wx.EVT_RADIOBUTTON, self.OnBCN3DRSelect)
        if profile.getMachineSetting('machine_type') == 'BCN3DR':
            BCN3DRRadio.SetValue(True)
Ejemplo n.º 44
0
def serialList(forAutoDetect=False):
	baselist=[]
	if platform.system() == "Windows":
		try:
			key=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\SERIALCOMM")
			i=0
			while True:
				values = _winreg.EnumValue(key, i)
				if not forAutoDetect or 'USBSER' in values[0]:
					baselist+=[values[1]]
				i+=1
		except:
			pass
	if forAutoDetect:
		baselist = baselist + glob.glob('/dev/ttyUSB*') + glob.glob('/dev/ttyACM*') + glob.glob("/dev/cu.usb*")
		baselist = filter(lambda s: not 'Bluetooth' in s, baselist)
		prev = profile.getMachineSetting('serial_port_auto')
		if prev in baselist:
			baselist.remove(prev)
			baselist.insert(0, prev)
	else:
		baselist = baselist + glob.glob('/dev/ttyUSB*') + glob.glob('/dev/ttyACM*') + glob.glob("/dev/cu.*") + glob.glob("/dev/tty.usb*") + glob.glob("/dev/rfcomm*")
	if version.isDevVersion() and not forAutoDetect:
		baselist.append('VIRTUAL')
	return baselist
Ejemplo n.º 45
0
    def __init__(self, parent, callback=None):
        super(normalSettingsPanel, self).__init__(parent, callback)

        #Main tabs
        self.nb = wx.Notebook(self)
        self.SetSizer(wx.BoxSizer(wx.HORIZONTAL))
        self.GetSizer().Add(self.nb, 1, wx.EXPAND)

        (left, right,
         self.printPanel) = self.CreateDynamicConfigTab(self.nb, 'Basic')
        self._addSettingsToPanels('basic', left, right)
        self.SizeLabelWidths(left, right)

        (left, right, self.advancedPanel) = self.CreateDynamicConfigTab(
            self.nb, 'Advanced')
        self._addSettingsToPanels('advanced', left, right)
        self.SizeLabelWidths(left, right)

        #Plugin page
        self.pluginPanel = pluginPanel.pluginPanel(self.nb, callback)
        self.nb.AddPage(self.pluginPanel, _("Plugins"))

        #Alteration page
        if profile.getMachineSetting('gcode_flavor') == 'UltiGCode':
            self.alterationPanel = None
        else:
            self.alterationPanel = alterationPanel.alterationPanel(
                self.nb, callback)
            self.nb.AddPage(self.alterationPanel, "Start/End-GCode")

        self.Bind(wx.EVT_SIZE, self.OnSize)

        self.nb.SetSize(self.GetSize())
        self.UpdateSize(self.printPanel)
        self.UpdateSize(self.advancedPanel)
Ejemplo n.º 46
0
    def updateMachineMenu(self):
        #Remove all items so we can rebuild the menu. Inserting items seems to cause crashes, so this is the safest way.
        for item in self.machineMenu.GetMenuItems():
            self.machineMenu.RemoveItem(item)

        #Add a menu item for each machine configuration.
        for n in xrange(0, profile.getMachineCount()):
            i = self.machineMenu.Append(n + 0x1000,
                                        profile.getMachineSetting(
                                            'machine_name', n).title(),
                                        kind=wx.ITEM_RADIO)
            if n == int(profile.getPreferenceFloat('active_machine')):
                i.Check(True)
            self.Bind(wx.EVT_MENU,
                      lambda e: self.OnSelectMachine(e.GetId() - 0x1000), i)

        self.machineMenu.AppendSeparator()

        i = self.machineMenu.Append(-1, _("Machine settings..."))
        self.Bind(wx.EVT_MENU, self.OnMachineSettings, i)

        #Add tools for machines.
        self.machineMenu.AppendSeparator()

        self.defaultFirmwareInstallMenuItem = self.machineMenu.Append(
            -1, _("Install default firmware..."))
        self.Bind(wx.EVT_MENU, self.OnDefaultMarlinFirmware,
                  self.defaultFirmwareInstallMenuItem)

        i = self.machineMenu.Append(-1, _("Install custom firmware..."))
        self.Bind(wx.EVT_MENU, self.OnCustomFirmware, i)
Ejemplo n.º 47
0
	def afterSplashCallback(self):
		#These imports take most of the time and thus should be done after showing the splashscreen
		from Cura.gui import configWizard
		from Cura.util import profile
		from Cura.util import resources
		# it's important to set up localization at very beginning to install
		language = profile.getPreference('language')
		resources.setupLocalization(language)

		if self.splash is not None:
			self.splash.Show(False)
			self.splash = None

		#If we haven't run it before, run the configuration wizard.
		if profile.getMachineSetting('machine_name') == '':
			configWizard.ConfigWizard()
			#Check if we need to copy our examples
			exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'dagoma.stl'))
			self.loadFiles = [exampleFile]

		from Cura.gui import mainWindow
		self.mainWindow = mainWindow.mainWindow()
		self.SetTopWindow(self.mainWindow)
		self.mainWindow.Show()
		self.mainWindow.OnDropFiles(self.loadFiles)

		setFullScreenCapable(self.mainWindow)

		if sys.platform.startswith('darwin'):
			from Cura.gui.util import macosFramesWorkaround as mfw
			wx.CallAfter(mfw.StupidMacOSWorkaround)
Ejemplo n.º 48
0
    def __init__(self):
        super(ConfigFirmware, self).__init__(None, -1, _("Machine Firmware Updater"))

        self.Bind(wx.wizard.EVT_WIZARD_FINISHED, self.OnCancel)
        self.Bind(wx.wizard.EVT_WIZARD_PAGE_CHANGED, self.OnPageChanged)
        self.Bind(wx.wizard.EVT_WIZARD_PAGE_CHANGING, self.OnPageChanging)
        self.Bind(wx.wizard.EVT_WIZARD_FINISHED, self.OnFinish)


        self.machineSelectPage = MachineSelectPage(self)
        self.decidetoupdatesigma = decideToUpdateSigma(self)
        self.decidetoupdateplus = decideToUpdatePlus(self)
        self.decidetoupdater = decideToUpdateR(self)
        self.disconnectprinter = disconnectPrinter(self)
        self.undocover = undoCover(self)
        self.removesdcard = removeSDCard(self)
        self.addnewfiles = addNewFiles(self)
        self.youaredone = youAreDone(self)

        if profile.getMachineSetting('machine_type') == 'BCN3DSigma':
            wx.wizard.WizardPageSimple.Chain(self.machineSelectPage, self.decidetoupdatesigma)
            wx.wizard.WizardPageSimple.Chain(self.decidetoupdatesigma, self.disconnectprinter)
            wx.wizard.WizardPageSimple.Chain(self.disconnectprinter, self.undocover)
            wx.wizard.WizardPageSimple.Chain(self.undocover, self.removesdcard)
            wx.wizard.WizardPageSimple.Chain(self.removesdcard, self.addnewfiles)
            wx.wizard.WizardPageSimple.Chain(self.addnewfiles, self.youaredone)

        self.FitToPage(self.machineSelectPage)
        self.GetPageAreaSizer().Add(self.machineSelectPage)

        self.RunWizard(self.machineSelectPage)
        self.Destroy()
Ejemplo n.º 49
0
	def checkPlatform(self, obj):
		p = obj.getPosition()
		s = obj.getSize()[0:2] / 2 + self._sizeOffsets
		if p[0] - s[0] < -self._machineSize[0] / 2:
			return False
		if p[0] + s[0] > self._machineSize[0] / 2:
			return False
		if p[1] - s[1] < -self._machineSize[1] / 2:
			return False
		if p[1] + s[1] > self._machineSize[1] / 2:
			return False

		#Do clip Check for UM2.
		machine = profile.getMachineSetting('machine_type')
		if(machine == "ultimaker2"):
			#lowerRight clip check
			if p[0] - s[0] < -self._machineSize[0] / 2 + 25 and p[1] - s[1] < -self._machineSize[1]/2 + 10:
				return False
			#UpperRight
			if p[0] - s[0] < -self._machineSize[0] / 2 + 25 and p[1] + s[1] > self._machineSize[1]/2 - 10:
				return False
			#LowerLeft
			if p[0] + s[0] > self._machineSize[0] / 2 - 25 and p[1] - s[1] < -self._machineSize[1]/2 + 10:
				return False
			#UpperLeft
			if p[0] + s[0] > self._machineSize[0] / 2 - 25 and p[1] + s[1] > self._machineSize[1]/2 - 10:
				return False
		return True
Ejemplo n.º 50
0
def serialList(forAutoDetect=False):
	"""
		Retrieve a list of serial ports found in the system.
	:param forAutoDetect: if true then only the USB serial ports are listed. Else all ports are listed.
	:return: A list of strings where each string is a serial port.
	"""
	baselist=[]
	if platform.system() == "Windows":
		try:
			key=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\SERIALCOMM")
			i=0
			while True:
				values = _winreg.EnumValue(key, i)
				if 'VCP0' in values[0] or 'USBSER' in values[0]:
					baselist+=[values[1]]
				i+=1
		except:
			pass
	if forAutoDetect:
		baselist = baselist + glob.glob('/dev/ttyUSB*') + glob.glob('/dev/ttyACM*') + glob.glob("/dev/cu.usb*")
		baselist = filter(lambda s: not 'Bluetooth' in s, baselist)
		prev = profile.getMachineSetting('serial_port_auto')
		if prev in baselist:
			baselist.remove(prev)
			baselist.insert(0, prev)
	else:
		baselist = baselist + glob.glob('/dev/ttyUSB*') + glob.glob('/dev/ttyACM*') + glob.glob("/dev/cu.*") + glob.glob("/dev/tty.usb*") + glob.glob("/dev/rfcomm*") + glob.glob('/dev/serial/by-id/*')
	if version.isDevVersion() and not forAutoDetect:
		baselist.append('VIRTUAL')
	return baselist
Ejemplo n.º 51
0
    def __init__(self, parent):
        super(MachineSelectPage, self).__init__(parent, _("Automatic Firmware Updater"))
        self.AddText(_("Check updates for which machine:\n"))

        BCN3DSigmaRadio = self.AddRadioButton("BCN3D Sigma")
        BCN3DSigmaRadio.Bind(wx.EVT_RADIOBUTTON, self.OnBCN3DSigmaSelect)
        if profile.getMachineSetting('machine_type') == 'BCN3DSigma':
            BCN3DSigmaRadio.SetValue(True)
        BCN3DPlusRadio = self.AddRadioButton("BCN3D +")
        BCN3DPlusRadio.Bind(wx.EVT_RADIOBUTTON, self.OnBCN3DPlusSelect)
        if profile.getMachineSetting('machine_type') == 'BCN3DPlus':
            BCN3DPlusRadio.SetValue(True)
        BCN3DRRadio = self.AddRadioButton("BCN3D R")
        BCN3DRRadio.Bind(wx.EVT_RADIOBUTTON, self.OnBCN3DRSelect)
        if profile.getMachineSetting('machine_type') == 'BCN3DR':
            BCN3DRRadio.SetValue(True)
Ejemplo n.º 52
0
def serialList(forAutoDetect=False):
    """
		Retrieve a list of serial ports found in the system.
	:param forAutoDetect: if true then only the USB serial ports are listed. Else all ports are listed.
	:return: A list of strings where each string is a serial port.
	"""
    baselist = []
    if platform.system() == "Windows":
        try:
            key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
                                  "HARDWARE\\DEVICEMAP\\SERIALCOMM")
            i = 0
            while True:
                values = _winreg.EnumValue(key, i)
                if 'VCP0' in values[0] or 'USBSER' in values[0]:
                    baselist += [values[1]]
                i += 1
        except:
            pass
    if forAutoDetect:
        baselist = baselist + glob.glob('/dev/ttyUSB*') + glob.glob(
            '/dev/ttyACM*') + glob.glob("/dev/cu.usb*")
        baselist = filter(lambda s: not 'Bluetooth' in s, baselist)
        prev = profile.getMachineSetting('serial_port_auto')
        if prev in baselist:
            baselist.remove(prev)
            baselist.insert(0, prev)
    else:
        baselist = baselist + glob.glob('/dev/ttyUSB*') + glob.glob(
            '/dev/ttyACM*') + glob.glob("/dev/cu.*") + glob.glob(
                "/dev/tty.usb*") + glob.glob("/dev/rfcomm*") + glob.glob(
                    '/dev/serial/by-id/*')
    if version.isDevVersion() and not forAutoDetect:
        baselist.append('VIRTUAL')
    return baselist
Ejemplo n.º 53
0
    def getSettingOverrides(self):
        settings = {}
        for setting in profile.settingsList:
            if not setting.isProfile():
                continue
            settings[setting.getName()] = setting.getDefault()

        for button in self._print_profile_options:
            if button.GetValue():
                cp = configparser.ConfigParser()
                cp.read(button.filename)
                for setting in profile.settingsList:
                    if setting.isProfile():
                        if cp.has_option('profile', setting.getName()):
                            settings[setting.getName()] = cp.get(
                                'profile', setting.getName())
        if profile.getMachineSetting('gcode_flavor') != 'UltiGCode':
            for button in self._print_material_options:
                if button.GetValue():
                    cp = configparser.ConfigParser()
                    cp.read(button.filename)
                    for setting in profile.settingsList:
                        if setting.isProfile():
                            if cp.has_option('profile', setting.getName()):
                                settings[setting.getName()] = cp.get(
                                    'profile', setting.getName())

        if self.printSupport.GetValue():
            settings['support'] = "Exterior Only"
        return settings
Ejemplo n.º 54
0
	def __init__(self, parent, callback = None):
		super(normalSettingsPanel, self).__init__(parent, callback)

		#Main tabs
		self.nb = wx.Notebook(self)
		self.SetSizer(wx.BoxSizer(wx.HORIZONTAL))
		self.GetSizer().Add(self.nb, 1, wx.EXPAND)

		(left, right, self.printPanel) = self.CreateDynamicConfigTab(self.nb, 'Basic')
		self._addSettingsToPanels('basic', left, right)
		self.SizeLabelWidths(left, right)

		(left, right, self.advancedPanel) = self.CreateDynamicConfigTab(self.nb, 'Advanced')
		self._addSettingsToPanels('advanced', left, right)
		self.SizeLabelWidths(left, right)

		#Plugin page
		self.pluginPanel = pluginPanel.pluginPanel(self.nb, callback)
		self.nb.AddPage(self.pluginPanel, _("Plugins"))

		#Alteration page
		if profile.getMachineSetting('gcode_flavor') == 'UltiGCode':
			self.alterationPanel = None
		else:
			self.alterationPanel = alterationPanel.alterationPanel(self.nb, callback)
			self.nb.AddPage(self.alterationPanel, "Start/End-GCode")

		self.Bind(wx.EVT_SIZE, self.OnSize)

		self.nb.SetSize(self.GetSize())
		self.UpdateSize(self.printPanel)
		self.UpdateSize(self.advancedPanel)
Ejemplo n.º 55
0
 def getAvailableGroup(self):
     if profile.getMachineSetting('gcode_flavor') == 'UltiGCode':
         return None
     for g in self._groupList:
         if len(g.getAvailableConnections()) > 0:
             return g
     return None
	def getAvailableGroup(self):
		if profile.getMachineSetting('gcode_flavor') == 'UltiGCode':
			return None
		for g in self._groupList:
			if len(g.getAvailableConnections()) > 0:
				return g
		return None
Ejemplo n.º 57
0
    def __init__(self, parent, filename=None, port=None, machineIndex=None):
        super(AutoUpdateFirmware,
              self).__init__(parent=parent,
                             title=_("Auto Firmware install"),
                             size=(250, 500))
        if port is None:
            port = profile.getMachineSetting('serial_port')
        self._serial = None

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.progressLabel = wx.StaticText(
            self, -1,
            'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nX\nX')
        sizer.Add(self.progressLabel,
                  0,
                  flag=wx.ALIGN_CENTER | wx.ALL,
                  border=5)
        self.progressGauge = wx.Gauge(self, -1)
        sizer.Add(self.progressGauge, 0, flag=wx.EXPAND)
        self.okButton = wx.Button(self, -1, _("OK"))
        self.okButton.Bind(wx.EVT_BUTTON, self.OnOk)
        sizer.Add(self.okButton, 0, flag=wx.ALIGN_CENTER | wx.ALL, border=5)

        f = wx.Font(8, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_NORMAL, False)
        self._termLog = wx.TextCtrl(self,
                                    style=wx.TE_MULTILINE | wx.TE_DONTWRAP)
        self._termLog.SetFont(f)
        self._termLog.SetEditable(0)
        self._termLog.SetMinSize((1, 400))
        self._termInput = wx.TextCtrl(self, style=wx.TE_PROCESS_ENTER)
        self._termInput.SetFont(f)
        sizer.Add(self._termLog, 0, flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND)
        sizer.Add(self._termInput,
                  0,
                  flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND)

        self.Bind(wx.EVT_TEXT_ENTER, self.OnTermEnterLine, self._termInput)

        self.SetSizer(sizer)

        self.filename = filename
        self.port = port

        self.Layout()
        self.Fit()

        self.thread = threading.Thread(target=self.OnRun)
        self.thread.daemon = True
        self.thread.start()

        self.read_thread = threading.Thread(target=self.OnSerialRead)
        self.read_thread.daemon = True
        self.read_thread.start()

        self.ShowModal()
        self.Destroy()
        return
Ejemplo n.º 58
0
	def __init__(self):
		self._print_profiles = []
		self._material_profiles = []
		self._material_in_print_profile = False
		for filename in resources.getSimpleModeProfiles(profile.getMachineSetting('machine_type')):
			pi = ProfileInfo(filename)
			self._print_profiles.append(pi)
			if pi.material is not None:
				self._material_in_print_profile = True

		if not self._material_in_print_profile and profile.getMachineSetting('gcode_flavor') != 'UltiGCode':
			for filename in resources.getSimpleModeMaterials():
				pi = ProfileInfo(filename)
				self._material_profiles.append(pi)

		self._print_profiles.sort(cmp=lambda a, b: a.order - b.order)
		self._material_profiles.sort(cmp=lambda a, b: a.order - b.order)
Ejemplo n.º 59
0
    def __init__(self, parent):
        super(preferencesDialog, self).__init__(parent, title=_("Preferences"))

        wx.EVT_CLOSE(self, self.OnClose)

        self.parent = parent
        extruderCount = int(profile.getMachineSetting('extruder_amount'))

        self.panel = configBase.configPanelBase(self)

        left, right, main = self.panel.CreateConfigPanel(self)

        configBase.TitleRow(left, _("Colours"))
        configBase.SettingRow(left, 'model_colour', wx.Colour)
        for i in xrange(1, extruderCount):
            configBase.SettingRow(left, 'model_colour%d' % (i + 1), wx.Colour)

        if len(resources.getLanguageOptions()) > 1:
            configBase.TitleRow(left, _("Language"))
            configBase.SettingRow(
                left, 'language',
                map(lambda n: n[1], resources.getLanguageOptions()))

        configBase.TitleRow(right, _("Filament settings"))
        configBase.SettingRow(right, 'filament_physical_density')
        configBase.SettingRow(right, 'filament_cost_kg')
        configBase.SettingRow(right, 'filament_cost_meter')

        #configBase.TitleRow(right, 'Slicer settings')
        #configBase.SettingRow(right, 'save_profile')

        configBase.TitleRow(right, 'SD Card settings')
        configBase.SettingRow(right, 'auto_detect_sd')
        configBase.SettingRow(right, 'sdcard_rootfolder')
        #same as the expert settings button.
        self.browseButton = wx.Button(right, -1, '...', style=wx.BU_EXACTFIT)
        self.browseButton.SetFont(
            wx.Font(
                wx.SystemSettings.GetFont(
                    wx.SYS_DEFAULT_GUI_FONT).GetPointSize() * 0.8,
                wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_NORMAL))
        self.browseButton.Bind(wx.EVT_BUTTON, self.OnBrowseSDRootFolder)
        right.GetSizer().Add(self.browseButton,
                             (right.GetSizer().GetRows() - 1, 2),
                             flag=wx.ALIGN_CENTER_VERTICAL)

        configBase.TitleRow(right, _("Cura settings"))
        configBase.SettingRow(right, 'check_for_updates')
        #configBase.SettingRow(right, 'submit_slice_information')

        self.okButton = wx.Button(right, -1, _('Ok'))
        right.GetSizer().Add(self.okButton, (right.GetSizer().GetRows(), 0),
                             flag=wx.BOTTOM,
                             border=5)
        self.okButton.Bind(wx.EVT_BUTTON, lambda e: self.Close())

        main.Fit()
        self.Fit()
Ejemplo n.º 60
0
    def __init__(self, parent, filename=None, port=None, machineIndex=None):
        super(UpdateFirmware, self).__init__(
            parent=parent,
            title="Firmware install for %s" %
            (profile.getMachineSetting('machine_name', machineIndex).title()),
            size=(250, 100))

        if port is None:
            port = profile.getMachineSetting('serial_port')
        if filename is None:
            filename = getDefaultFirmware(machineIndex)
            self._default_firmware = False
        self._machine_type = profile.getMachineSetting('machine_type',
                                                       machineIndex)

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.progressLabel = wx.StaticText(
            self, -1,
            'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nX\nX')
        sizer.Add(self.progressLabel,
                  0,
                  flag=wx.ALIGN_CENTER | wx.ALL,
                  border=5)
        self.progressGauge = wx.Gauge(self, -1)
        sizer.Add(self.progressGauge, 0, flag=wx.EXPAND)
        self.okButton = wx.Button(self, -1, _("OK"))
        self.okButton.Disable()
        self.okButton.Bind(wx.EVT_BUTTON, self.OnOk)
        sizer.Add(self.okButton, 0, flag=wx.ALIGN_CENTER | wx.ALL, border=5)
        self.SetSizer(sizer)

        self.port = port
        self.filename = filename

        self.Layout()
        self.Fit()

        self.thread = threading.Thread(target=self.OnRun)
        self.thread.daemon = True
        self.thread.start()

        self.ShowModal()
        self.Destroy()
        return