def getSimpleModeIniFiles(subdir, pattern = '*.ini'): machine_type = profile.getMachineSetting('machine_type') paths = [] paths.append(os.path.normpath(os.path.expanduser(os.path.join('~', '.Cura', 'quickprint', machine_type, subdir)))) paths.append(os.path.normpath(os.path.expanduser(os.path.join('~', '.Cura', 'quickprint', subdir)))) paths.append(os.path.normpath(os.path.join(resourceBasePath, 'quickprint', machine_type, subdir))) paths.append(os.path.normpath(os.path.join(resourceBasePath, 'quickprint', subdir))) for path in paths: if os.path.isdir(path): files = sorted(glob.glob(os.path.join(path, pattern))) if len(files) > 0: return files return []
def getSimpleModeMaterials(): machine_type = profile.getMachineSetting('machine_type') paths = [] paths.append(os.path.normpath(os.path.expanduser(os.path.join('~', '.Cura', 'quickprint', machine_type)))) paths.append(os.path.normpath(os.path.expanduser(os.path.join('~', '.Cura', 'quickprint')))) paths.append(os.path.normpath(os.path.join(resourceBasePath, 'quickprint', machine_type))) paths.append(os.path.normpath(os.path.join(resourceBasePath, 'quickprint'))) materials = [] global_options = [] for path in paths: if os.path.isdir(path): option_files = sorted(glob.glob(os.path.join(path, 'option_*.ini'))) for option_file in option_files: option = ProfileIni(option_file) if not option._isInList(global_options): global_options.append(option) material_files = sorted(glob.glob(os.path.join(path, '*/material.ini'))) if len(material_files) > 0: for material_file in material_files: material = PrintMaterial(material_file) if not material._isInList(materials): materials.append(material) else: for ini in materials: if ini.base_name == material.base_name: ini.parseDirectory(os.path.split(material_file)[0]) break materials.sort(key=alphaAndExperimental) for material in materials: material.addGlobalOptions(global_options) #print "Materials found for %s :\n%s" % (machine_type, materials) return materials
def getLatestFHVersion(ver): #Go to a different url depending on the printer to get the desired firmware if profile.getMachineSetting('machine_type') == 'BCN3DSigma': if haveInternet() != True: wx.MessageBox( _("It seems like you do not have an internet connection.\n" "In order to check whether you have the latest version\n" "you need to be connected to the internet.\n\n" "Please check your connection and try again!"), _("Alert!"), wx.OK | wx.ICON_EXCLAMATION) elif haveInternet() == True: base_url = 'https://github.com/BCN3D/BCN3DSigma-Firmware/archive/' url = 'https://github.com/BCN3D/BCN3DSigma-Firmware/releases' urlContent = urllib2.urlopen(url) data = urlContent.read() first_v = ver[:2] second_v = ver[:2] if first_v == '01': versionMatch = re.search(r'(01-[\d.]+)\.(zip)', data) if not versionMatch: sys.exit('Couldn\'t find the Latest Version!') version = versionMatch.group(1) print 'The latest firmware version available is:', version print ver if ver == version: wx.MessageBox(_("Your firmware is already up to date!"), _("Firmware Information"), wx.OK) return None elif ver != version: mychoice = wx.MessageBox( _("Your firmware version is: " + ver + "\nThe latest firmware version available is: " + version + "\nWant to download the new version?"), _("New Version"), wx.YES_NO | wx.ICON_QUESTION) if mychoice == wx.NO: return None else: isDownloaded = downloadLatestFHVersion( version, base_url) if isDownloaded == None: return None elif isDownloaded != None: return version elif second_v == '02': versionMatch = re.search(r'(02-[\d.]+)\.(zip)', data) if not versionMatch: sys.exit('Couldn\'t find the Latest Version!') version = versionMatch.group(1) print 'The latest firmware version available is:', version if ver == version: wx.MessageBox(_("Your firmware is already up to date!"), _("Firmware Information"), wx.OK) return None elif ver != version: mychoice = wx.MessageBox( _("Your firmware version is: " + ver + "\nThe latest firmware version available is: " + version + "\nWant to download the new version?"), _("New Version"), wx.YES_NO) if mychoice == wx.NO: return None else: isDownloaded = downloadLatestFHVersion( version, base_url) if isDownloaded == None: return None elif isDownloaded != None: return version elif profile.getMachineSetting('machine_type') == 'BCN3DPlus': wx.MessageBox(_("Couldn\'t find the latest version!"), _("Firmware Information"), wx.OK) return None elif profile.getMachineSetting('machine_type') == 'BCN3DR': wx.MessageBox(_("Couldn\'t find the latest version!"), _("Firmware Information"), wx.OK) return None
def getLatestFHVersion(ver): #Go to a different url depending on the printer to get the desired firmware if profile.getMachineSetting('machine_type') == 'BCN3DSigma': base_url = 'https://github.com/BCN3D/BCN3DSigma-Firmware/archive/' url = 'https://github.com/BCN3D/BCN3DSigma-Firmware/releases' urlContent = urllib2.urlopen(url) data = urlContent.read() first_v = ver[:2] second_v = ver[:2] if first_v == '01': versionMatch = re.search(r'(01-[\d.]+)\.(zip)', data) if not versionMatch: sys.exit('Couldn\'t find the Latest Version!') version = versionMatch.group(1) print 'The latest firmware version available is:', version if ver == version: wx.MessageBox(_("Your firmware is already up to date!"), _("Firmware Information"), wx.OK) return None elif ver != version: mychoice = wx.MessageBox( _("Your firmware version is: " + ver + "\nThe latest firmware version available is: " + version + "\nWant to download the new version?"), _("New Version"), wx.YES_NO) if mychoice == wx.NO: return None else: isDownloaded = downloadLatestFHVersion(version, base_url) if isDownloaded == None: return None elif isDownloaded != None: return not None elif second_v == '02': versionMatch = re.search(r'(02-[\d.]+)\.(zip)', data) if not versionMatch: sys.exit('Couldn\'t find the Latest Version!') version = versionMatch.group(1) print 'The latest firmware version available is:', version if ver == version: wx.MessageBox(_("Your firmware is already up to date!"), _("Firmware Information"), wx.OK) return None elif ver != version: mychoice = wx.MessageBox( _("Your firmware version is: " + ver + "\nThe latest firmware version available is: " + version + "\nWant to download the new version?"), _("New Version"), wx.YES_NO) if mychoice == wx.NO: return None else: isDownloaded = downloadLatestFHVersion(version, base_url) if isDownloaded == None: return None elif isDownloaded != None: return not None elif profile.getMachineSetting('machine_type') == 'BCN3DPlus': wx.MessageBox(_("Couldn\'t find the latest version!"), _("Firmware Information"), wx.OK) return None elif profile.getMachineSetting('machine_type') == 'BCN3DR': wx.MessageBox(_("Couldn\'t find the latest version!"), _("Firmware Information"), wx.OK) return None
def getLatestFHVersion(ver): #Go to a different url depending on the printer to get the desired firmware if profile.getMachineSetting('machine_type') == 'BCN3DSigma': base_url = 'https://github.com/BCN3D/BCN3DSigma-Firmware/archive/' url = 'https://github.com/BCN3D/BCN3DSigma-Firmware/releases' urlContent = urllib2.urlopen(url) data = urlContent.read() elif profile.getMachineSetting('machine_type') == 'BCN3DPlus': wx.MessageBox(_("Couldn\'t find the latest version!"), _("Firmware Information"), wx.OK) return None #base_url = 'https://github.com/remelbourne/BCN3DSigma-Firmware-Updates/archive/' #url = 'https://github.com/remelbourne/BCN3DSigma-Firmware-Updates/releases/' #urlContent = urllib2.urlopen(url) #data = urlContent.read() elif profile.getMachineSetting('machine_type') == 'BCN3DR': wx.MessageBox(_("Couldn\'t find the latest version!"), _("Firmware Information"), wx.OK) return None #base_url = 'https://github.com/remelbourne/BCN3DSigma-Firmware-Updates/archive/' #url = 'https://github.com/remelbourne/BCN3DSigma-Firmware-Updates/releases/' #urlContent = urllib2.urlopen(url) #data = urlContent.read() first_v = ver[:2] second_v = ver[:2] if first_v == '01': versionMatch = re.search(r'(01-[\d.]+)\.(zip)', data) if not versionMatch: sys.exit('Couldn\'t find the Latest Version!') version = versionMatch.group(1) print 'The latest firmware version available is:',version if ver == version: wx.MessageBox(_("Your firmware is already up to date!"), _("Firmware Information"), wx.OK) return None elif ver != version: mychoice = wx.MessageBox(_("Your firmware version is: " + ver + "\nThe latest firmware version available is: " + version + "\nWant to download the new version?"), _("New Version"), wx.YES_NO) if mychoice == wx.NO: return None else: isDownloaded = downloadLatestFHVersion(version, base_url) if isDownloaded == None: return None elif isDownloaded != None: return not None elif second_v == '02': versionMatch = re.search(r'(02-[\d.]+)\.(zip)', data) if not versionMatch: sys.exit('Couldn\'t find the Latest Version!') version = versionMatch.group(1) print 'The latest firmware version available is:',version if ver == version: wx.MessageBox(_("Your firmware is already up to date!"), _("Firmware Information"), wx.OK) return None elif ver != version: mychoice = wx.MessageBox(_("Your firmware version is: " + ver + "\nThe latest firmware version available is: " + version + "\nWant to download the new version?"), _("New Version"), wx.YES_NO) if mychoice == wx.NO: return None else: isDownloaded = downloadLatestFHVersion(version, base_url) if isDownloaded == None: return None elif isDownloaded != None: return not None
def getLatestFHVersion(ver): #Go to a different url depending on the printer to get the desired firmware if profile.getMachineSetting('machine_type') == 'BCN3DSigma': if haveInternet() != True: wx.MessageBox(_("It seems like you do not have an internet connection.\n" "In order to check whether you have the latest version\n" "you need to be connected to the internet.\n\n" "Please check your connection and try again!"), _("Alert!"), wx.OK | wx.ICON_EXCLAMATION) elif haveInternet() == True: base_url = 'https://github.com/BCN3D/BCN3DSigma-Firmware/archive/' url = 'https://github.com/BCN3D/BCN3DSigma-Firmware/releases' urlContent = urllib2.urlopen(url) data = urlContent.read() first_v = ver[:2] second_v = ver[:2] if first_v == '01': versionMatch = re.search(r'(01-[\d.]+)\.(zip)', data) if not versionMatch: sys.exit('Couldn\'t find the Latest Version!') version = versionMatch.group(1) print 'The latest firmware version available is:',version print ver if ver == version: wx.MessageBox(_("Your firmware is already up to date!"), _("Firmware Information"), wx.OK) return None elif ver != version: mychoice = wx.MessageBox(_("Your firmware version is: " + ver + "\nThe latest firmware version available is: " + version + "\nWant to download the new version?"), _("New Version"), wx.YES_NO | wx.ICON_QUESTION) if mychoice == wx.NO: return None else: isDownloaded = downloadLatestFHVersion(version, base_url) if isDownloaded == None: return None elif isDownloaded != None: return version elif second_v == '02': versionMatch = re.search(r'(02-[\d.]+)\.(zip)', data) if not versionMatch: sys.exit('Couldn\'t find the Latest Version!') version = versionMatch.group(1) print 'The latest firmware version available is:',version if ver == version: wx.MessageBox(_("Your firmware is already up to date!"), _("Firmware Information"), wx.OK) return None elif ver != version: mychoice = wx.MessageBox(_("Your firmware version is: " + ver + "\nThe latest firmware version available is: " + version + "\nWant to download the new version?"), _("New Version"), wx.YES_NO) if mychoice == wx.NO: return None else: isDownloaded = downloadLatestFHVersion(version, base_url) if isDownloaded == None: return None elif isDownloaded != None: return version elif profile.getMachineSetting('machine_type') == 'BCN3DPlus': wx.MessageBox(_("Couldn\'t find the latest version!"), _("Firmware Information"), wx.OK) return None elif profile.getMachineSetting('machine_type') == 'BCN3DR': wx.MessageBox(_("Couldn\'t find the latest version!"), _("Firmware Information"), wx.OK) return None