Skip to content

Commit

Permalink
python: TemplatePyMod: *.py: Fix python3 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
plaes authored and wwmayer committed Feb 24, 2017
1 parent a101d42 commit f6b6e62
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Mod/TemplatePyMod/Automation.py
Expand Up @@ -79,7 +79,7 @@ def makeSnapshotWithoutGui():

# Other formats are only available if simage package is installed
if off.isWriteSupported("PNG"):
print "Save as PNG"
print("Save as PNG")
off.writeToFile("crystal.png","PNG")

if FreeCAD.GuiUp:
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/TemplatePyMod/Commands.py
Expand Up @@ -28,7 +28,7 @@ def addCommand(name,cmdObject):
class TemplatePyMod_Cmd1:
"Example command class"
def Activated(self):
print "TemplatePyMod_Cmd1 activated ;-) "
print("TemplatePyMod_Cmd1 activated ;-) ")

def GetResources(self):
return {'Pixmap' : 'Std_Tool1', 'MenuText': 'Example command', 'ToolTip': 'Very unimportand example command'}
Expand Down Expand Up @@ -235,9 +235,9 @@ class TemplatePyCheckable:
"Example toggle command class"
def Activated(self, index):
if index == 0:
print "Toggle is off"
print("Toggle is off")
else:
print "Toggle is on"
print("Toggle is on")

def GetResources(self):
return {'Pixmap' : 'python', 'MenuText': 'Toggle command', 'ToolTip': 'Example toggle command', 'Checkable': True}
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TemplatePyMod/FeaturePython.py
Expand Up @@ -654,7 +654,7 @@ def __init__(self, obj):
obj.Proxy = self

def updateData(self, fp, prop):
print "prop updated:",prop
print("prop updated:",prop)

def __getstate__(self):
return None
Expand Down
10 changes: 5 additions & 5 deletions src/Mod/TemplatePyMod/MengerSponge.py
Expand Up @@ -20,7 +20,7 @@ def PlaceBox(x,y,z):
return mbox

def Sierpinski(level,x0,y0,z0):
#print threading.current_thread().name
#print(threading.current_thread().name)
boxnums = pow(3,level)
thirds = boxnums / 3
twothirds = thirds * 2
Expand Down Expand Up @@ -95,7 +95,7 @@ def makeMengerSponge_mt(level=3,x0=0,y0=0,z0=0):
threads.append(thr)
args=args[count:]

print "Number of threads: %i" % (len(threads))
print("Number of threads: %i" % (len(threads)))
for thr in threads:
thr.start()
for thr in threads:
Expand All @@ -106,11 +106,11 @@ def makeMengerSponge_mt(level=3,x0=0,y0=0,z0=0):
mesh.addMesh(thr.mesh)
del thr.mesh

print mesh
print(mesh)
mesh.removeDuplicatedPoints()
mesh.removeFacets(mesh.getInternalFacets())
mesh.rebuildNeighbourHood()
print "Mesh is solid: %s" % (mesh.isSolid())
print("Mesh is solid: %s" % (mesh.isSolid()))
Mesh.show(mesh)


Expand All @@ -121,5 +121,5 @@ def makeMengerSponge(level=3,x0=0,y0=0,z0=0):
mesh.removeDuplicatedPoints()
mesh.removeFacets(mesh.getInternalFacets())
mesh.rebuildNeighbourHood()
print "Mesh is solid: %s" % (mesh.isSolid())
print("Mesh is solid: %s" % (mesh.isSolid()))
Mesh.show(mesh)
14 changes: 7 additions & 7 deletions src/Mod/TemplatePyMod/Tests.py
Expand Up @@ -69,14 +69,14 @@ def testNesting(self):
# Parameter testing
#FreeCAD.PrintLog("Base::ParameterTestCase::testNesting\n")
for i in range(50):
self.TestPar.SetFloat(`i`,4711.4711)
self.TestPar.SetInt(`i`,4711)
self.TestPar.SetBool(`i`,1)
Temp = self.TestPar.GetGroup(`i`)
self.TestPar.SetFloat(i,4711.4711)
self.TestPar.SetInt(i,4711)
self.TestPar.SetBool(i,1)
Temp = self.TestPar.GetGroup(i)
for l in range(50):
Temp.SetFloat(`l`,4711.4711)
Temp.SetInt(`l`,4711)
Temp.SetBool(`l`,1)
Temp.SetFloat(l,4711.4711)
Temp.SetInt(l,4711)
Temp.SetBool(l,1)
Temp = 0

def testExportImport(self):
Expand Down

0 comments on commit f6b6e62

Please sign in to comment.