本文整理汇总了Python中skeinforge_tools.skeinforge_utilities.gcodec.getTextLines函数的典型用法代码示例。如果您正苦于以下问题:Python getTextLines函数的具体用法?Python getTextLines怎么用?Python getTextLines使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getTextLines函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getReplacedSVGTemplateLines
def getReplacedSVGTemplateLines( self, fileName, rotatedBoundaryLayers ):
"Get the lines of text from the svg_template.tmpl file."
#( layers.length + 1 ) * (margin + sliceDimY * unitScale + txtHeight) + margin + txtHeight + margin + 110
svgTemplateText = gcodec.getFileTextInFileDirectory( __file__, 'svg_template.tmpl' )
originalTextLines = gcodec.getTextLines( svgTemplateText )
self.margin = getParameterFromJavascript( originalTextLines, 'margin', self.margin )
self.textHeight = getParameterFromJavascript( originalTextLines, 'textHeight', self.textHeight )
javascriptControlsWidth = getParameterFromJavascript( originalTextLines, 'javascripControlBoxX', 510.0 )
noJavascriptControlsHeight = getParameterFromJavascript( originalTextLines, 'noJavascriptControlBoxY', 110.0 )
controlTop = len( rotatedBoundaryLayers ) * ( self.margin + self.extent.y * self.unitScale + self.textHeight ) + 2.0 * self.margin + self.textHeight
# width = margin + (sliceDimX * unitScale) + margin;
svgTemplateText = getReplacedInQuotes( 'height', self.getRounded( controlTop + noJavascriptControlsHeight + self.margin ), svgTemplateText )
width = 2.0 * self.margin + max( self.extent.y * self.unitScale, javascriptControlsWidth )
svgTemplateText = getReplacedInQuotes( 'width', self.getRounded( width ), svgTemplateText )
svgTemplateText = getReplacedWordAndInQuotes( 'layerThickness', self.getRounded( self.layerThickness ), svgTemplateText )
svgTemplateText = getReplacedWordAndInQuotes( 'maxX', self.getRounded( self.cornerMaximum.x ), svgTemplateText )
svgTemplateText = getReplacedWordAndInQuotes( 'minX', self.getRounded( self.cornerMinimum.x ), svgTemplateText )
svgTemplateText = getReplacedWordAndInQuotes( 'dimX', self.getRounded( self.extent.x ), svgTemplateText )
svgTemplateText = getReplacedWordAndInQuotes( 'maxY', self.getRounded( self.cornerMaximum.y ), svgTemplateText )
svgTemplateText = getReplacedWordAndInQuotes( 'minY', self.getRounded( self.cornerMinimum.y ), svgTemplateText )
svgTemplateText = getReplacedWordAndInQuotes( 'dimY', self.getRounded( self.extent.y ), svgTemplateText )
svgTemplateText = getReplacedWordAndInQuotes( 'maxZ', self.getRounded( self.cornerMaximum.z ), svgTemplateText )
svgTemplateText = getReplacedWordAndInQuotes( 'minZ', self.getRounded( self.cornerMinimum.z ), svgTemplateText )
svgTemplateText = getReplacedWordAndInQuotes( 'dimZ', self.getRounded( self.extent.z ), svgTemplateText )
summarizedFilename = gcodec.getSummarizedFilename( fileName ) + ' SVG Slice File'
svgTemplateText = getReplacedWordAndInQuotes( 'Title', summarizedFilename, svgTemplateText )
noJavascriptControlsTagString = '<g id="noJavascriptControls" fill="#000" transform="translate(%s, %s)">' % ( self.getRounded( self.margin ), self.getRounded( controlTop ) )
svgTemplateText = getReplacedTagString( noJavascriptControlsTagString, 'noJavascriptControls', svgTemplateText )
# <g id="noJavascriptControls" fill="#000" transform="translate(20, 1400)">
return gcodec.getTextLines( svgTemplateText )
示例2: getCraftedGcode
def getCraftedGcode(self, gcodeText, coolRepository):
"Parse gcode text and store the cool gcode."
self.coolRepository = coolRepository
self.coolEndText = preferences.getFileInAlterationsOrGivenDirectory(os.path.dirname(__file__), "Cool_End.gcode")
self.coolEndLines = gcodec.getTextLines(self.coolEndText)
self.coolStartText = preferences.getFileInAlterationsOrGivenDirectory(
os.path.dirname(__file__), "Cool_Start.gcode"
)
self.coolStartLines = gcodec.getTextLines(self.coolStartText)
self.cornerMaximum = complex(-999999999.0, -999999999.0)
self.cornerMinimum = complex(999999999.0, 999999999.0)
self.halfCorner = complex(coolRepository.minimumOrbitalRadius.value, coolRepository.minimumOrbitalRadius.value)
self.lines = gcodec.getTextLines(gcodeText)
self.minimumArea = 4.0 * coolRepository.minimumOrbitalRadius.value * coolRepository.minimumOrbitalRadius.value
self.parseInitialization()
for lineIndex in xrange(self.lineIndex, len(self.lines)):
line = self.lines[lineIndex]
self.parseCorner(line)
margin = 0.2 * self.perimeterWidth
halfCornerMargin = self.halfCorner + complex(margin, margin)
self.cornerMaximum -= halfCornerMargin
self.cornerMinimum += halfCornerMargin
for self.lineIndex in xrange(self.lineIndex, len(self.lines)):
line = self.lines[self.lineIndex]
self.parseLine(line)
if coolRepository.turnFanOffAtEnding.value:
self.distanceFeedRate.addLine("M107")
return self.distanceFeedRate.output.getvalue()
示例3: getCraftedGcode
def getCraftedGcode( self, gcodeText, homePreferences ):
"Parse gcode text and store the home gcode."
self.lines = gcodec.getTextLines( gcodeText )
self.homePreferences = homePreferences
self.parseInitialization( homePreferences )
self.homingText = preferences.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), homePreferences.nameOfHomingFile.value )
self.homingLines = gcodec.getTextLines( self.homingText )
for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ):
line = self.lines[ self.lineIndex ]
self.parseLine( line )
return self.distanceFeedRate.output.getvalue()
示例4: parseGcode
def parseGcode( self, combPreferences, gcodeText ):
"Parse gcode text and store the comb gcode."
self.lines = gcodec.getTextLines( gcodeText )
self.parseInitialization( combPreferences )
for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ):
line = self.lines[ self.lineIndex ]
self.parseAddJitter( line )
self.lines = gcodec.getTextLines( self.output.getvalue() )
self.initializeMoreParameters()
for self.lineIndex in xrange( len( self.lines ) ):
line = self.lines[ self.lineIndex ]
self.parseLine( combPreferences, line )
for self.lineIndex in xrange( len( self.lines ) ):
line = self.lines[ self.lineIndex ]
self.parseAddTravel( line )
示例5: getCraftedGcode
def getCraftedGcode( self, gcodeStepRepository, gcodeText ):
"Parse gcode text and store the gcode."
self.gcodeStepRepository = gcodeStepRepository
lines = gcodec.getTextLines( gcodeText )
for line in lines:
self.parseLine( line )
return self.output.getvalue()
示例6: parseGcode
def parseGcode( self, gcodeText, skeinviewPreferences ):
"Parse gcode text and store the vector output."
self.arrowType = None
if skeinviewPreferences.drawArrows.value:
self.arrowType = 'last'
self.initializeActiveLocation()
self.cornerHigh = Vector3( - 999999999.0, - 999999999.0, - 999999999.0 )
self.cornerLow = Vector3( 999999999.0, 999999999.0, 999999999.0 )
self.goAroundExtruderOffTravel = skeinviewPreferences.goAroundExtruderOffTravel.value
self.lines = gcodec.getTextLines( gcodeText )
self.isThereALayerStartWord = gcodec.isThereAFirstWord( '(<layer>', self.lines, 1 )
for line in self.lines:
self.parseCorner( line )
self.scale = skeinviewPreferences.pixelsWidthExtrusion.value / abs( self.extrusionWidth )
self.scaleCornerHigh = self.scale * self.cornerHigh.dropAxis( 2 )
self.scaleCornerLow = self.scale * self.cornerLow.dropAxis( 2 )
print( "The lower left corner of the skeinview window is at %s, %s" % ( self.cornerLow.x, self.cornerLow.y ) )
print( "The upper right corner of the skeinview window is at %s, %s" % ( self.cornerHigh.x, self.cornerHigh.y ) )
self.cornerImaginaryTotal = self.cornerHigh.y + self.cornerLow.y
margin = complex( 5.0, 5.0 )
self.marginCornerLow = self.scaleCornerLow - margin
self.scaleSize = margin + self.scaleCornerHigh - self.marginCornerLow
self.initializeActiveLocation()
self.colorNames = [ 'brown', 'red', 'orange', 'yellow', 'green', 'blue', 'purple' ]
for self.lineIndex in xrange( len( self.lines ) ):
line = self.lines[ self.lineIndex ]
self.parseLine( line )
示例7: getCraftedGcode
def getCraftedGcode( self, gcodeText, binary16ByteRepository ):
"Parse gcode text and store the gcode."
self.binary16ByteRepository = binary16ByteRepository
lines = gcodec.getTextLines( gcodeText )
for line in lines:
self.parseLine( line )
return self.output.getvalue()
示例8: parseGcode
def parseGcode( self, fileName, gcodeText, beholdPreferences ):
"Parse gcode text and store the vector output."
self.beholdPreferences = beholdPreferences
self.fileName = fileName
self.gcodeText = gcodeText
self.initializeActiveLocation()
self.cornerHigh = Vector3( - 999999999.0, - 999999999.0, - 999999999.0 )
self.cornerLow = Vector3( 999999999.0, 999999999.0, 999999999.0 )
self.goAroundExtruderOffTravel = beholdPreferences.goAroundExtruderOffTravel.value
self.lines = gcodec.getTextLines( gcodeText )
self.isThereALayerStartWord = gcodec.isThereAFirstWord( '(<layer>', self.lines, 1 )
for line in self.lines:
self.parseCorner( line )
if len( self.layerTops ) > 0:
self.layerTops[ - 1 ] += 912345678.9
if len( self.layerTops ) > 1:
self.oneMinusBrightnessOverTopLayerIndex = ( 1.0 - beholdPreferences.bottomLayerBrightness.value ) / float( len( self.layerTops ) - 1 )
self.firstTopLayer = len( self.layerTops ) - self.beholdPreferences.numberOfFillTopLayers.value
self.centerComplex = 0.5 * ( self.cornerHigh.dropAxis( 2 ) + self.cornerLow.dropAxis( 2 ) )
self.centerBottom = Vector3( self.centerComplex.real, self.centerComplex.imag, self.cornerLow.z )
self.scale = beholdPreferences.pixelsPerMillimeter.value
self.scaleCenterBottom = self.scale * self.centerBottom
self.scaleCornerHigh = self.scale * self.cornerHigh.dropAxis( 2 )
self.scaleCornerLow = self.scale * self.cornerLow.dropAxis( 2 )
print( "The lower left corner of the behold window is at %s, %s" % ( self.cornerLow.x, self.cornerLow.y ) )
print( "The upper right corner of the behold window is at %s, %s" % ( self.cornerHigh.x, self.cornerHigh.y ) )
self.cornerImaginaryTotal = self.cornerHigh.y + self.cornerLow.y
margin = complex( 5.0, 5.0 )
self.marginCornerLow = self.scaleCornerLow - margin
self.screenSize = margin + 2.0 * ( self.scaleCornerHigh - self.marginCornerLow )
self.initializeActiveLocation()
for self.lineIndex in xrange( len( self.lines ) ):
line = self.lines[ self.lineIndex ]
self.parseLine( line )
self.skeinPanes.sort( compareLayerSequence )
示例9: parseGcode
def parseGcode( self, gcodeText, twitterbotPreferences ):
"Parse gcode text and store the twitterbot gcode."
self.lines = gcodec.getTextLines( gcodeText )
self.twitterUsername = twitterbotPreferences.twitterUsername.value
self.twitterPassword = twitterbotPreferences.twitterPassword.value
self.layersBetweenTweets = twitterbotPreferences.layersBetweenTweets.value
self.startMessage = twitterbotPreferences.startMessage.value
self.progressMessage = twitterbotPreferences.progressMessage.value
self.finishMessage = twitterbotPreferences.finishMessage.value
self.quips = twitterbotPreferences.quips.value
self.quipsList = self.quips.split( '|' )
#print( 'quipsList: ' + str ( self.quipsList ) )
self.prevQuip = ''
self.percentageOfQuips = int( twitterbotPreferences.percentageOfQuips.value )
if self.percentageOfQuips <= 0 or self.percentageOfQuips > 10:
self.percentageOfQuips = 3
if int( self.layersBetweenTweets ) < 1:
self.layersBetweenTweets = 10
self.twitterHashtags = twitterbotPreferences.twitterHashtags.value
self.parseInitialization( twitterbotPreferences )
#print( "===> self.lineIndex: " + str( self.lineIndex ) )
self.totalGcodeLines = len( self.lines )
self.linesBetweenQuips = int( round( self.totalGcodeLines / self.percentageOfQuips, 0 ) )
#print( 'self.linesBetweenQuips: ' + str( self.linesBetweenQuips ) )
#print( 'self.totalGcodeLines: ' + str( self.totalGcodeLines ) )
for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ):
# quip messages
# print( '===> self.lineIndex: ' + str( self.lineIndex ) )
if self.lineIndex % self.linesBetweenQuips == 0 and self.lineIndex > 0 and self.isPrintFinished == False:
self.addLine( self.createQuipMessage( self.lineIndex ) )
line = self.lines[ self.lineIndex ]
# print( '===> Parsing line ' + str( self.lineIndex ) + ': ' + line )
self.parseLine( line )
示例10: getNavigationHypertext
def getNavigationHypertext( fileText, transferredFileNameIndex, transferredFileNames ):
"Get the hypertext help with navigation lines."
helpTextEnd = fileText.find( '</p>' )
helpTextStart = fileText.find( '<p>' )
helpText = fileText[ helpTextStart : helpTextEnd ]
lines = gcodec.getTextLines( helpText )
headings = []
headingLineTable = {}
for line in lines:
addToHeadings( headingLineTable, headings, line )
headingsToBeenAdded = True
output = cStringIO.StringIO()
for line in lines:
if line[ : 2 ] == '==':
if headingsToBeenAdded:
output.write( '<br />\n' )
for heading in headings:
heading.addToOutput( output )
output.write( '<br />\n' )
headingsToBeenAdded = False
if line in headingLineTable:
line = headingLineTable[ line ]
output.write( line + '\n' )
helpText = output.getvalue()
previousFileName = 'contents.html'
previousIndex = transferredFileNameIndex - 1
if previousIndex >= 0:
previousFileName = transferredFileNames[ previousIndex ]
previousLinkText = '<a href="%s">Previous</a>' % previousFileName
navigationLine = getNavigationLine( '<a href="contents.html">Contents</a>', previousLinkText, getNextLinkText( transferredFileNames, transferredFileNameIndex + 1 ) )
helpText = navigationLine + helpText + '<br />\n<br />\n' + navigationLine + '<hr>\n'
return fileText[ : helpTextStart ] + helpText + fileText[ helpTextEnd : ]
示例11: parseGcode
def parseGcode( self, fileName, gcodeText, repository ):
"Parse gcode text and store the vector output."
self.fileName = fileName
self.gcodeText = gcodeText
self.repository = repository
self.initializeActiveLocation()
self.cornerHigh = Vector3( - 999999999.0, - 999999999.0, - 999999999.0 )
self.cornerLow = Vector3( 999999999.0, 999999999.0, 999999999.0 )
self.lines = gcodec.getTextLines( gcodeText )
self.isThereALayerStartWord = gcodec.isThereAFirstWord( '(<layer>', self.lines, 1 )
self.parseInitialization()
for line in self.lines[ self.lineIndex : ]:
self.parseCorner( line )
self.cornerHighComplex = self.cornerHigh.dropAxis( 2 )
self.cornerLowComplex = self.cornerLow.dropAxis( 2 )
self.scale = repository.scale.value
self.scaleCornerHigh = self.scale * self.cornerHighComplex
self.scaleCornerLow = self.scale * self.cornerLowComplex
self.cornerImaginaryTotal = self.cornerHigh.y + self.cornerLow.y
self.margin = complex( 10.0, 10.0 )
self.marginCornerHigh = self.scaleCornerHigh + self.margin
self.marginCornerLow = self.scaleCornerLow - self.margin
self.screenSize = self.marginCornerHigh - self.marginCornerLow
self.initializeActiveLocation()
self.colorNames = [ 'brown', 'red', 'orange', 'yellow', 'green', 'blue', 'purple' ]
for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ):
line = self.lines[ self.lineIndex ]
self.parseLine( line )
示例12: getCraftedGcode
def getCraftedGcode( self, gcodeText, raftRepository ):
"Parse gcode text and store the raft gcode."
self.raftRepository = raftRepository
self.supportEndText = preferences.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), 'Support_End.gcode' )
self.supportEndLines = gcodec.getTextLines( self.supportEndText )
self.supportStartText = preferences.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), 'Support_Start.gcode' )
self.supportStartLines = gcodec.getTextLines( self.supportStartText )
self.minimumSupportRatio = math.tan( math.radians( raftRepository.supportMinimumAngle.value ) )
self.lines = gcodec.getTextLines( gcodeText )
self.parseInitialization()
if raftRepository.addRaftElevateNozzleOrbitSetAltitude.value:
self.addRaft()
self.addTemperature( raftRepository.temperatureShapeFirstLayerOutline.value )
for line in self.lines[ self.lineIndex : ]:
self.parseLine( line )
return self.distanceFeedRate.output.getvalue()
示例13: parseGcode
def parseGcode( self, fileName, gcodeText, skeinviewPreferences ):
"Parse gcode text and store the vector output."
self.fileName = fileName
self.gcodeText = gcodeText
self.initializeActiveLocation()
self.cornerHigh = Vector3( - 999999999.0, - 999999999.0, - 999999999.0 )
self.cornerLow = Vector3( 999999999.0, 999999999.0, 999999999.0 )
self.goAroundExtruderOffTravel = skeinviewPreferences.goAroundExtruderOffTravel.value
self.lines = gcodec.getTextLines( gcodeText )
self.isThereALayerStartWord = gcodec.isThereAFirstWord( '(<layer>', self.lines, 1 )
for line in self.lines:
self.parseCorner( line )
self.cornerHighComplex = self.cornerHigh.dropAxis( 2 )
self.cornerLowComplex = self.cornerLow.dropAxis( 2 )
self.scale = skeinviewPreferences.pixelsPerMillimeter.value
self.scaleCornerHigh = self.scale * self.cornerHighComplex
self.scaleCornerLow = self.scale * self.cornerLowComplex
self.cornerImaginaryTotal = self.cornerHigh.y + self.cornerLow.y
self.margin = complex( 10.0, 10.0 )
self.marginCornerHigh = self.scaleCornerHigh + self.margin
self.marginCornerLow = self.scaleCornerLow - self.margin
self.screenSize = self.marginCornerHigh - self.marginCornerLow
self.initializeActiveLocation()
self.colorNames = [ 'brown', 'red', 'orange', 'yellow', 'green', 'blue', 'purple' ]
for self.lineIndex in xrange( len( self.lines ) ):
line = self.lines[ self.lineIndex ]
self.parseLine( line )
示例14: parseGcode
def parseGcode( self, gcodeText, loopTailorPreferences ):
"Parse gcode text and store the clip gcode."
self.lines = gcodec.getTextLines( gcodeText )
self.parseInitialization( loopTailorPreferences )
for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ):
line = self.lines[ self.lineIndex ]
self.parseLine( line )
示例15: __init__
def __init__( self, xmlText ):
"Add empty lists."
self.isInComment = False
self.parents = []
self.rootElement = None
self.lines = gcodec.getTextLines( xmlText )
for line in self.lines:
self.parseLine( line )