Example #1
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)
Example #2
0
	def OnAddNewMachine(self, e):
		self.Hide()
		profile.setActiveMachine(profile.getMachineCount())
		configWizard.configWizard(True)
		self.Show()
		self.reloadSettingPanels()
		self.updateMachineMenu()
Example #3
0
 def OnAddNewMachine(self, e):
     self.Hide()
     profile.setActiveMachine(profile.getMachineCount())
     configWizard.configWizard(True)
     self.Show()
     self.reloadSettingPanels()
     self.updateMachineMenu()
Example #4
0
File: app.py Project: EFinley/Cura
	def afterSplashCallback(self):
		#These imports take most of the time and thus should be done after showing the splashscreen
		from Cura.gui import mainWindow
		from Cura.gui import configWizard

		#If we haven't run it before, run the configuration wizard.
		if profile.getPreference('machine_type') == 'unknown':
			if platform.system() == "Darwin":
				#Check if we need to copy our examples
				exampleFile = os.path.expanduser('~/CuraExamples/UltimakerRobot_support.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)))
					profile.putPreference('lastFile', exampleFile)
			configWizard.configWizard()

		#Hide the splashscreen before showing the main window.
		if self.splash is not None:
			self.splash.Show(False)
		self.mainWindow = mainWindow.mainWindow()

		setFullScreenCapable(self.mainWindow)
Example #5
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)
Example #6
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)
Example #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.util import profile
		from Cura.util import resources
		from Cura.util import version
		from Cura.gui.util import language
		
		language.switchTo("english")

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

		#If we haven't run it before, run the configuration wizard.
		if profile.getPreference('machine_type') == 'unknown':
			if platform.system() == "Windows":
				exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'UltimakerRobot_support.stl'))
			else:
				#Check if we need to copy our examples
				exampleFile = os.path.expanduser('~/CuraExamples/UltimakerRobot_support.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
		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)
Example #8
0
	def OnAddMachine(self, e):
		self.Hide()
		self.parent.Hide()
		profile.setActiveMachine(profile.getMachineCount())
		configWizard.configWizard(True)
		self.parent.Show()
		self.parent.reloadSettingPanels()
		self.parent.updateMachineMenu()

		prefDialog = machineSettingsDialog(self.parent)
		prefDialog.Centre()
		prefDialog.Show()
		wx.CallAfter(self.Close)
	def OnAddMachine(self, e):
		self.Hide()
		self.parent.Hide()
		profile.setActiveMachine(profile.getMachineCount())
		configWizard.configWizard(True)
		self.parent.Show()
		self.parent.reloadSettingPanels()
		self.parent.updateMachineMenu()

		prefDialog = machineSettingsDialog(self.parent)
		prefDialog.Centre()
		prefDialog.Show()
		wx.CallAfter(self.Close)
Example #10
0
def main():
	if profile.getPreference('machine_type') == 'unknown':
		if platform.system() == "Darwin":
			#Check if we need to copy our examples
			exampleFile = os.path.expanduser('~/CuraExamples/UltimakerRobot_support.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(os.path.dirname(os.path.abspath(__file__)), '..', 'example', '*.*'))):
					shutil.copy(filename, os.path.join(os.path.dirname(exampleFile), os.path.basename(filename)))
				profile.putPreference('lastFile', exampleFile)
		configWizard.configWizard()
	mainWindow()
Example #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

		#If we haven't run it before, run the configuration wizard.
		if profile.getPreference('machine_type') == 'unknown':
			if platform.system() == "Darwin":
				#Check if we need to copy our examples
				exampleFile = os.path.expanduser('~/CuraExamples/UltimakerRobot_support.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)))
					profile.putPreference('lastFile', exampleFile)
			configWizard.configWizard()

		#Hide the splashscreen before showing the main window.
		if self.splash is not None:
			self.splash.Show(False)
		if profile.getPreference('check_for_updates') == 'True':
			newVersion = version.checkForNewerVersion()
			if newVersion is not None:
				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
		self.mainWindow = mainWindow.mainWindow()

		setFullScreenCapable(self.mainWindow)
Example #12
0
 def OnFirstRunWizard(self, e):
     self.Hide()
     configWizard.configWizard()
     self.Show()
     self.reloadSettingPanels()
Example #13
0
	def OnFirstRunWizard(self, e):
		configWizard.configWizard()
		self.updateProfileToControls()
Example #14
0
	def OnFirstRunWizard(self, e):
		self.Hide()
		configWizard.configWizard()
		self.Show()
		self.reloadSettingPanels()
Example #15
0
 def OnFirstRunWizard(self, e):
     configWizard.configWizard()
     self.updateProfileToControls()
Example #16
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.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.SetTopWindow(self.mainWindow)
		self.mainWindow.Show()
		self.mainWindow.OnDropFiles(self.loadFiles)
		if profile.getPreference('last_run_version') != version.getVersion(False):
			profile.putPreference('last_run_version', version.getVersion(False))
			newVersionDialog.newVersionDialog().Show()

		setFullScreenCapable(self.mainWindow)

		if sys.platform.startswith('darwin'):
			wx.CallAfter(self.StupidMacOSWorkaround)