Exemplo n.º 1
0
def exportProfileAsZipFile(abridgedSettings, suffixDirectoryPath, suffixFileNameWithoutExtension):
	'Export the profile from the gcode text as a zip file.'
	if len(abridgedSettings) < 1:
		print('Warning, the synopsis zip file could not be generated because there are no setting comments in the file.')
		return
	suffixFileName =  suffixFileNameWithoutExtension + 'zip'
	abridgedSettingsDictionary = {}
	for abridgedSetting in abridgedSettings:
		euclidean.addElementToListDictionary(abridgedSetting, abridgedSetting.procedure, abridgedSettingsDictionary)
	abridgedSettingFileNamePaths = []
	for abridgedSettingsKey in abridgedSettingsDictionary:
		abridgedSettings = abridgedSettingsDictionary[abridgedSettingsKey]
		repositoryWriter = settings.getRepositoryWriter(abridgedSettingsKey)
		addAbridgedSettings(abridgedSettings, repositoryWriter)
		abridgedSettingFileNamePath = FileNamePath(suffixDirectoryPath, abridgedSettingsKey + '.csv')
		abridgedSettingFileNamePaths.append(abridgedSettingFileNamePath)
		archive.writeFileText(abridgedSettingFileNamePath.path, repositoryWriter.getvalue())
	time.sleep(0.2) # the sleep is so that the file system is sure to be consistent
	zipArchive = zipfile.ZipFile(suffixFileName, 'w', compression=zipfile.ZIP_DEFLATED)
	for abridgedSettingFileNamePath in abridgedSettingFileNamePaths:
		zipArchive.write(abridgedSettingFileNamePath.path, abridgedSettingFileNamePath.fileName)
	zipArchive.close()
	time.sleep(0.2) # the sleep is so that the file system is sure to be consistent
	for abridgedSettingFileNamePath in abridgedSettingFileNamePaths:
		os.remove(abridgedSettingFileNamePath.path)
	print('The synopsis zip file is saved as ' + archive.getSummarizedFileName(suffixFileName))
Exemplo n.º 2
0
def exportProfileAsZipFile(abridgedSettings, suffixDirectoryPath, suffixFileNameWithoutExtension):
	'Export the profile from the gcode text as a zip file.'
	if len(abridgedSettings) < 1:
		print('Warning, the synopsis zip file could not be generated because there are no setting comments in the file.')
		return
	suffixFileName =  suffixFileNameWithoutExtension + 'zip'
	abridgedSettingsDictionary = {}
	for abridgedSetting in abridgedSettings:
		euclidean.addElementToListDictionary(abridgedSetting, abridgedSetting.procedure, abridgedSettingsDictionary)
	abridgedSettingFileNamePaths = []
	for abridgedSettingsKey in abridgedSettingsDictionary:
		abridgedSettings = abridgedSettingsDictionary[abridgedSettingsKey]
		repositoryWriter = settings.getRepositoryWriter(abridgedSettingsKey)
		addAbridgedSettings(abridgedSettings, repositoryWriter)
		abridgedSettingFileNamePath = FileNamePath(suffixDirectoryPath, abridgedSettingsKey + '.csv')
		abridgedSettingFileNamePaths.append(abridgedSettingFileNamePath)
		archive.writeFileText(abridgedSettingFileNamePath.path, repositoryWriter.getvalue())
	time.sleep(0.2) # the sleep is so that the file system is sure to be consistent
	zipArchive = zipfile.ZipFile(suffixFileName, 'w', compression=zipfile.ZIP_DEFLATED)
	for abridgedSettingFileNamePath in abridgedSettingFileNamePaths:
		zipArchive.write(abridgedSettingFileNamePath.path, abridgedSettingFileNamePath.fileName)
	zipArchive.close()
	time.sleep(0.2) # the sleep is so that the file system is sure to be consistent
	for abridgedSettingFileNamePath in abridgedSettingFileNamePaths:
		os.remove(abridgedSettingFileNamePath.path)
	print('The synopsis zip file is saved as ' + archive.getSummarizedFileName(suffixFileName))
Exemplo n.º 3
0
def exportProfileAsCSVFile(abridgedSettings, suffixFileNameWithoutExtension):
	'Export the profile from the gcode text as a csv file.'
	if len(abridgedSettings) < 1:
		print('Warning, the synopsis csv file could not be generated because there are no setting comments in the file.')
		return
	repositoryWriter = settings.getRepositoryWriter('profile')
	suffixFileName = suffixFileNameWithoutExtension + 'csv'
	addAbridgedSettings(abridgedSettings, repositoryWriter)
	archive.writeFileText(suffixFileName, repositoryWriter.getvalue())
	print('The synopsis csv file is saved as ' + archive.getSummarizedFileName(suffixFileName))
Exemplo n.º 4
0
def exportProfileAsCSVFile(abridgedSettings, suffixFileNameWithoutExtension):
	'Export the profile from the gcode text as a csv file.'
	if len(abridgedSettings) < 1:
		print('Warning, the synopsis csv file could not be generated because there are no setting comments in the file.')
		return
	repositoryWriter = settings.getRepositoryWriter('profile')
	suffixFileName = suffixFileNameWithoutExtension + 'csv'
	addAbridgedSettings(abridgedSettings, repositoryWriter)
	archive.writeFileText(suffixFileName, repositoryWriter.getvalue())
	print('The synopsis csv file is saved as ' + archive.getSummarizedFileName(suffixFileName))