Пример #1
0
def writeHypertext():
	"Run pydoc, then read, write and delete each of the files."
	shellCommand = 'pydoc -w ./'
	commandResult = os.system( shellCommand )
	if commandResult != 0:
		print('Failed to execute the following command in writeHypertext in docwrap.')
		print( shellCommand )
	hypertextFiles = gcodec.getFilesWithFileTypeWithoutWords('html')
	if len( hypertextFiles ) <= 0:
		print('Failed to find any help files in writeHypertext in docwrap.')
		return
	documentDirectoryPath = gcodec.getAbsoluteFolderPath( hypertextFiles[0], 'documentation')
	removeFilesInDirectory( documentDirectoryPath )
	sortedReplaceFiles = []
	for hypertextFile in hypertextFiles:
		sortedReplaceFiles.append( hypertextFile.replace('.html', '. html') )
	sortedReplaceFiles.sort()
	hypertextFiles = []
	for sortedReplaceFile in sortedReplaceFiles:
		hypertextFiles.append( sortedReplaceFile.replace('. html', '.html') )
	transferredFileNames = []
	for hypertextFileIndex in xrange( len( hypertextFiles ) ):
		readWriteDeleteHypertextHelp( documentDirectoryPath, hypertextFileIndex, hypertextFiles, transferredFileNames )
	for transferredFileNameIndex in xrange( len( transferredFileNames ) ):
		readWriteNavigationHelp( documentDirectoryPath, transferredFileNameIndex, transferredFileNames )
	writeContentsFile( documentDirectoryPath, transferredFileNames )
	print('%s files were wrapped.' % len( transferredFileNames ) )
Пример #2
0
def writeHypertext():
    "Run pydoc, then read, write and delete each of the files."
    shellCommand = 'pydoc -w ./'
    commandResult = os.system(shellCommand)
    if commandResult != 0:
        print(
            'Failed to execute the following command in writeHypertext in docwrap.'
        )
        print(shellCommand)
    hypertextFiles = gcodec.getFilesWithFileTypeWithoutWords('html')
    if len(hypertextFiles) <= 0:
        print('Failed to find any help files in writeHypertext in docwrap.')
        return
    documentDirectoryPath = gcodec.getAbsoluteFolderPath(
        hypertextFiles[0], 'documentation')
    removeFilesInDirectory(documentDirectoryPath)
    sortedReplaceFiles = []
    for hypertextFile in hypertextFiles:
        sortedReplaceFiles.append(hypertextFile.replace('.html', '. html'))
    sortedReplaceFiles.sort()
    hypertextFiles = []
    for sortedReplaceFile in sortedReplaceFiles:
        hypertextFiles.append(sortedReplaceFile.replace('. html', '.html'))
    transferredFileNames = []
    for hypertextFileIndex in xrange(len(hypertextFiles)):
        readWriteDeleteHypertextHelp(documentDirectoryPath, hypertextFileIndex,
                                     hypertextFiles, transferredFileNames)
    for transferredFileNameIndex in xrange(len(transferredFileNames)):
        readWriteNavigationHelp(documentDirectoryPath,
                                transferredFileNameIndex, transferredFileNames)
    writeContentsFile(documentDirectoryPath, transferredFileNames)
    print('%s files were wrapped.' % len(transferredFileNames))
Пример #3
0
def getFileOrGcodeDirectory( fileName, wasCancelled, words = [] ):
	"Get the gcode files in the directory the file is in if directory setting is true.  Otherwise, return the file in a list."
	if isEmptyOrCancelled( fileName, wasCancelled ):
		return []
	if isDirectorySetting():
		return gcodec.getFilesWithFileTypeWithoutWords( 'gcode', words, fileName )
	return [ fileName ]
Пример #4
0
def getFileOrGcodeDirectory( fileName, wasCancelled, words = [] ):
	"Get the gcode files in the directory the file is in if directory setting is true.  Otherwise, return the file in a list."
	if isEmptyOrCancelled( fileName, wasCancelled ):
		return []
	if isDirectorySetting():
		dotIndex = fileName.rfind('.')
		if dotIndex < 0:
			print('The file name should have a suffix, like myfile.xml.')
			print('Since the file name does not have a suffix, nothing will be done')
		suffix = fileName[ dotIndex + 1 : ]
		return gcodec.getFilesWithFileTypeWithoutWords( suffix, words, fileName )
	return [ fileName ]
Пример #5
0
def getFileOrGcodeDirectory(fileName, wasCancelled, words=[]):
    "Get the gcode files in the directory the file is in if directory setting is true.  Otherwise, return the file in a list."
    if isEmptyOrCancelled(fileName, wasCancelled):
        return []
    if isDirectorySetting():
        dotIndex = fileName.rfind('.')
        if dotIndex < 0:
            print('The file name should have a suffix, like myfile.xml.')
            print(
                'Since the file name does not have a suffix, nothing will be done'
            )
        suffix = fileName[dotIndex + 1:]
        return gcodec.getFilesWithFileTypeWithoutWords(suffix, words, fileName)
    return [fileName]