self.preview.Refresh()
def OnMoveDown(self, e):
- if self.selection == None:
+ if self.selection is None:
return
i = self.listbox.GetSelection()
if i == len(self.list) - 1:
self.preview.Refresh()
def OnCopy(self, e):
- if self.selection == None:
+ if self.selection is None:
return
item = self.selection.clone()
self.preview.Refresh()
def OnSetCustomProfile(self, e):
- if self.selection == None:
+ if self.selection is None:
return
dlg=wx.FileDialog(self, "Select profile", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
def addHorizontallyBoundedPoint(begin, center, end, horizontalBegin, horizontalEnd, path):
'Add point if it is within the horizontal bounds.'
- if center.real >= horizontalEnd and center.real <= horizontalBegin:
+ if horizontalEnd <= center.real <= horizontalBegin:
path.append(center)
return
if end != None:
- if center.real > horizontalBegin and end.real <= horizontalBegin:
+ if center.real > horizontalBegin >= end.real:
centerMinusEnd = center - end
along = (center.real - horizontalBegin) / centerMinusEnd.real
path.append(center - along * centerMinusEnd)
return
if begin != None:
- if center.real < horizontalEnd and begin.real >= horizontalEnd:
+ if center.real < horizontalEnd <= begin.real:
centerMinusBegin = center - begin
along = (center.real - horizontalEnd) / centerMinusBegin.real
path.append(center - along * centerMinusBegin)
def isPointInside(self, point):
'Determine if the point is inside the bounding rectangle.'
- return point.imag >= self.cornerMinimum.imag and point.imag <= self.cornerMaximum.imag and point.real >= self.cornerMinimum.real and point.real <= self.cornerMaximum.real
+ return self.cornerMinimum.imag <= point.imag <= self.cornerMaximum.imag and self.cornerMinimum.real <= point.real <= self.cornerMaximum.real
def parseCorner(self, line):
'Parse a gcode line and use the location to update the bounding corners.'
'Determine if the keyIndex is in range.'
if keyIndex == None:
return False
- return keyIndex >= -len(self.value) and keyIndex < len(self.value)
+ return -len(self.value) <= keyIndex < len(self.value)
class EvaluatorAddition(Evaluator):
beginComplex = rotatedLoop[pointIndex]
endComplex = rotatedLoop[ (pointIndex + 1) % len( rotatedLoop ) ]
xIntersection = euclidean.getXIntersectionIfExists( beginComplex, endComplex, rotatedPointComplex.imag )
- if xIntersection != None:
- if xIntersection >= beginX and xIntersection < endX:
+ if xIntersection is not None:
+ if beginX <= xIntersection < endX:
xIntersectionIndexList.append( euclidean.XIntersectionIndex( pointIndex, xIntersection ) )
self.closestXDistance = 987654321.0
self.closestXIntersectionIndex = None
segmentLoop = []
startEnd = StartEnd(elementNode, len(loop), prefix)
for pointIndex in xrange(len(loop)):
- if pointIndex >= startEnd.start and pointIndex < startEnd.end:
+ if startEnd.start <= pointIndex < startEnd.end:
segmentLoop += getSegmentPath(derivation.center, loop, path, pointIndex)
else:
segmentLoop.append(loop[pointIndex])
y = behindRotated.imag
xIntersection = euclidean.getXIntersectionIfExists( aheadRotated, aheadMidpointRotated, y )
if xIntersection != None:
- if xIntersection > min( behindMidpointRotated.real, behindRotated.real ) and xIntersection < max( behindMidpointRotated.real, behindRotated.real ):
+ if min( behindMidpointRotated.real, behindRotated.real ) < xIntersection < max( behindMidpointRotated.real, behindRotated.real ):
intersectionPoint = normalizedSegment * complex( xIntersection, y )
loop[ ( pointIndex + len( loop ) - 1 ) % len( loop ) ] = intersectionPoint
del loop[pointIndex]
valueFound = False
for radio in self.radioList:
if radio.name == value:
- valueFound = True;
+ valueFound = True
if valueFound:
self.value = value
for radio in self.radioList:
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
-class Vector3:
+class Vector3(object):
'A three dimensional vector class.'
__slots__ = ['x', 'y', 'z']
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
-class Vector3Index:
+class Vector3Index(object):
'A three dimensional vector index class.'
__slots__ = ['index', 'x', 'y', 'z']
maximumX = max(beginRotated.real, endRotated.real)
minimumX = min(beginRotated.real, endRotated.real)
for xIntersection in switchX:
- if xIntersection.x > minimumX and xIntersection.x < maximumX:
+ if minimumX < xIntersection.x < maximumX:
point = segment * complex(xIntersection.x, y)
points.append(point)
boundaryIndexes.append(xIntersection.index)
rateMultiplier = self.dwindlePortionEnd * alongBetween + self.dwindlePortionBegin * (1.0 - alongBetween)
self.addGcodeMovementByRate(distanceFeedRate, endRateMultiplier, location, rateMultiplier, slowdownFlowRateMultiplier)
return
- if self.dwindlePortionBegin > 1.0 and self.dwindlePortionEnd < 1.0:
+ if self.dwindlePortionBegin > 1.0 > self.dwindlePortionEnd:
alongDwindle = 0.0
if self.dwindlePortionBegin > 1.0 + halfOverSteps:
alongDwindle = (self.dwindlePortionBegin - 1.0) / dwindleDifference
def isAddedPointOnPathFree( path, pixelTable, point, pointIndex, width ):
'Determine if the point added to a path is intersecting the pixel table or the path.'
- if pointIndex > 0 and pointIndex < len(path):
+ if 0 < pointIndex < len(path):
if isSharpCorner( ( path[pointIndex - 1] ), point, ( path[pointIndex] ) ):
return False
pointIndexMinusOne = pointIndex - 1
if isSegmentCompletelyInAnIntersection(lineSegment, surroundingXIntersections ):
xFirst = lineSegment[0].point.real
xSecond = lineSegment[1].point.real
- if gridPoint.real > min(xFirst, xSecond) and gridPoint.real < max(xFirst, xSecond):
+ if min(xFirst, xSecond) < gridPoint.real < max(xFirst, xSecond):
return True
return False
def addJorisedPerimeter(self):
'Add jorised perimeter.'
- if self.perimeter == None:
+ if self.perimeter is None:
return
#Calculate the total length of the perimeter.
p = self.oldLocation.dropAxis()
- perimeterLength = 0;
+ perimeterLength = 0
for point in self.perimeter:
- perimeterLength += abs( point - p );
+ perimeterLength += abs( point - p )
p = point
#Build the perimeter with an increasing Z over the length.
def setExtendedPoint( lineSegmentEnd, pointOriginal, x ):
'Set the point in the extended line segment.'
- if x > min( lineSegmentEnd.point.real, pointOriginal.real ) and x < max( lineSegmentEnd.point.real, pointOriginal.real ):
+ if min( lineSegmentEnd.point.real, pointOriginal.real ) < x < max( lineSegmentEnd.point.real, pointOriginal.real ):
lineSegmentEnd.point = complex( x, pointOriginal.imag )
def writeOutput(fileName, shouldAnalyze=True):
return 'Cura profile:' + craftTypeName
def addListsToCraftTypeRepository(fileNameHelp, repository):
- #print('addListsToCraftTypeRepository:', fileNameHelp, repository)
- repository.name = fileNameHelp.split('.')[-2]
- repository.preferences = []
+ #print('addListsToCraftTypeRepository:', fileNameHelp, repository)
+ repository.name = fileNameHelp.split('.')[-2]
+ repository.preferences = []
def getCraftTypePluginModule( craftTypeName = ''):
- "Get the craft type plugin module"
- if craftTypeName == '':
- craftTypeName = getCraftTypeName()
- profilePluginsDirectoryPath = getPluginsDirectoryPath()
- return archive.getModuleWithDirectoryPath( profilePluginsDirectoryPath, craftTypeName )
+ "Get the craft type plugin module"
+ if craftTypeName == '':
+ craftTypeName = getCraftTypeName()
+ profilePluginsDirectoryPath = getPluginsDirectoryPath()
+ return archive.getModuleWithDirectoryPath( profilePluginsDirectoryPath, craftTypeName )
def getPluginsDirectoryPath():
- "Get the plugins directory path."
- return archive.getSkeinforgePluginsPath('profile_plugins')
+ "Get the plugins directory path."
+ return archive.getSkeinforgePluginsPath('profile_plugins')