def OnCheckForUpdate(self, e): newVersion = version.checkForNewerVersion() if newVersion is not None: if wx.MessageBox(language.getText('A new version of Cura is available, would you like to download?'), language.getText('New version available'), wx.YES_NO | wx.ICON_INFORMATION) == wx.YES: webbrowser.open(newVersion) else: wx.MessageBox(language.getText('You are running the latest version of Cura!'), language.getText('Awesome!'), wx.ICON_INFORMATION)
def OnCheckForUpdate(self, e): 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) else: wx.MessageBox('You are running the latest version of Cura!', 'Awesome!', wx.ICON_INFORMATION)
def OnCheckForUpdate(self, e): 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) else: wx.MessageBox(_("You are running the latest version of Cura!"), _("Awesome!"), wx.ICON_INFORMATION)
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', '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 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)
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)
def OnCheckForUpdate(self, e): 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) else: wx.MessageBox(_("You are running the latest version of Cura!"), _("Awesome!"), wx.ICON_INFORMATION)
def OnCheckForUpdate(self, e): needsUpdate = False downloadLink = '' updateVersion = '' versionStatus = version.checkForNewerVersion() # Corresponding keys for versionStatus: # "needsUpdate" # "downloadLink" # "updateVersion" # # If download is not needed, then the value returned will be: '' if versionStatus: for x, y in versionStatus.items(): if x == 'needsUpdate' and y != '': needsUpdate = y elif x == 'downloadLink' and y != '': downloadLink = y elif x == 'updateVersion' and y != '': updateVersion = y if needsUpdate is True and updateVersion != '': if wx.MessageBox(_("Cura Type A v%s is now available. Would you like to download it?" % updateVersion), _("New Version Available"), wx.YES_NO | wx.ICON_INFORMATION) == wx.YES: webbrowser.open(downloadLink) else: profile.putPreference('check_for_updates', False) # If the user says no, then set check_for_updates to False # Users will still be able to see the update dialog from the # help menu else: if e: wx.MessageBox(_("You are running the latest version of Cura!"), style=wx.ICON_INFORMATION) else: if e: wx.MessageBox(_("Please check your internet connection or try again later."), _("Error"), wx.OK | wx.ICON_INFORMATION)
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)
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 # Don't look for old versions ''' if profile.getMachineSetting('machine_type') == 'unknown': try: otherCuraInstalls = profile.getAlternativeBasePaths() for path in otherCuraInstalls[::-1]: try: print 'Loading old settings from %s' % (path) profile.loadPreferences(os.path.join(path, 'preferences.ini')) profile.loadProfile(os.path.join(path, 'current_profile.ini')) break except: import traceback print traceback.print_exc() except: import traceback print traceback.print_exc() ''' #If we haven't run it before, run the configuration wizard. if profile.getMachineSetting('machine_type') == 'unknown': #Check if we need to copy our examples exampleFile = os.path.normpath( os.path.join(resources.resourceBasePath, 'example', '3DK-printing-sample.STL')) self.loadFiles = [exampleFile] if self.splash is not None: self.splash.Show(False) configWizard.ConfigWizard() if profile.getPreference('check_for_updates') == 'NOPE': 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)
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() for path in otherCuraInstalls[::-1]: try: print 'Loading old settings from %s' % (path) profile.loadPreferences(os.path.join(path, 'preferences.ini')) profile.loadProfile(os.path.join(path, 'current_profile.ini')) break except: import traceback print traceback.print_exc() except: import traceback print traceback.print_exc() #If we haven't run it before, run the configuration wizard. if profile.getMachineSetting('machine_type') == 'unknown': #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)
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 _ try: from distutils.version import LooseVersion if LooseVersion(wx.__version__) < LooseVersion('3.0'): wx.MessageBox(_("This version of Cura requires WxPython version 3.0 or newer.\nYour current WxPython version is %s.") % wx.__version__, _("WxPython version is too old"), wx.OK | wx.ICON_ERROR) return except: # distutils not found.. it can happen! # Only check the first 3 characters of the version string instead if float(wx.__version__[0:3]) < 3.0: wx.MessageBox(_("This version of Cura requires WxPython version 3.0 or newer.\nYour current WxPython version is %s.") % wx.__version__, _("WxPython version is too old"), wx.OK | wx.ICON_ERROR) return #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() for path in otherCuraInstalls[::-1]: try: print 'Loading old settings from %s' % (path) profile.loadPreferences(os.path.join(path, 'preferences.ini')) profile.loadProfile(os.path.join(path, 'current_profile.ini')) break except: import traceback print traceback.print_exc() except: import traceback print traceback.print_exc() #If we haven't run it before, run the configuration wizard. if profile.getMachineSetting('machine_type') == 'unknown': #Check if we need to copy our examples exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'Rocktopus.stl')) self.loadFiles = [exampleFile] self.destroySplashScreen() configWizard.ConfigWizard() if profile.getPreference('check_for_updates') == 'True': newVersion = version.checkForNewerVersion() if newVersion is not None: self.destroySplashScreen() 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 if profile.getPreference('last_run_version') != version.getVersion(False): profile.performVersionUpgrade() # Must happen before the main window is created, in case there are changes # that would affect it (such as machine name changes) if version.isDevVersion(): profile.performVersionUpgrade() self.mainWindow = mainWindow.mainWindow() self.destroySplashScreen() self.SetTopWindow(self.mainWindow) self.mainWindow.Show() self.mainWindow.OnDropFiles(self.loadFiles) setFullScreenCapable(self.mainWindow) if profile.getPreference('last_run_version') != version.getVersion(False): profile.putPreference('last_run_version', version.getVersion(False)) newVersionDialog.newVersionDialog().Show() # Must come after creating the main window #if version.isDevVersion(): #import wx.lib.inspection # Show the WX widget inspection tool #wx.lib.inspection.InspectionTool().Show() if sys.platform.startswith('darwin'): wx.CallAfter(self.StupidMacOSWorkaround)
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 _ try: from distutils.version import LooseVersion if LooseVersion(wx.__version__) < LooseVersion('3.0'): wx.MessageBox( _("This version of Cura requires WxPython version 3.0 or newer.\nYour current WxPython version is %s." ) % wx.__version__, _("WxPython version is too old"), wx.OK | wx.ICON_ERROR) return except: # distutils not found.. it can happen! # Only check the first 3 characters of the version string instead if float(wx.__version__[0:3]) < 3.0: wx.MessageBox( _("This version of Cura requires WxPython version 3.0 or newer.\nYour current WxPython version is %s." ) % wx.__version__, _("WxPython version is too old"), wx.OK | wx.ICON_ERROR) return #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() for path in otherCuraInstalls[::-1]: try: print 'Loading old settings from %s' % (path) profile.loadPreferences( os.path.join(path, 'preferences.ini')) profile.loadProfile( os.path.join(path, 'current_profile.ini')) break except: import traceback print traceback.print_exc() except: import traceback print traceback.print_exc() #If we haven't run it before, run the configuration wizard. if profile.getMachineSetting('machine_type') == 'unknown': #Check if we need to copy our examples exampleFile = os.path.normpath( os.path.join(resources.resourceBasePath, 'example', 'Rocktopus.stl')) self.loadFiles = [exampleFile] self.destroySplashScreen() configWizard.ConfigWizard() if profile.getPreference('check_for_updates') == 'True': newVersion = version.checkForNewerVersion() if newVersion is not None: self.destroySplashScreen() 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 if profile.getPreference('last_run_version') != version.getVersion( False): profile.performVersionUpgrade() # Must happen before the main window is created, in case there are changes # that would affect it (such as machine name changes) if version.isDevVersion(): profile.performVersionUpgrade() self.mainWindow = mainWindow.mainWindow() self.destroySplashScreen() self.SetTopWindow(self.mainWindow) self.mainWindow.Show() self.mainWindow.OnDropFiles(self.loadFiles) setFullScreenCapable(self.mainWindow) if profile.getPreference('last_run_version') != version.getVersion( False): profile.putPreference('last_run_version', version.getVersion(False)) newVersionDialog.newVersionDialog().Show() # Must come after creating the main window #if version.isDevVersion(): #import wx.lib.inspection # Show the WX widget inspection tool #wx.lib.inspection.InspectionTool().Show() if sys.platform.startswith('darwin'): wx.CallAfter(self.StupidMacOSWorkaround)