Removed more unneeded prints, converted others to logging.
This commit is contained in:
parent
0041b8c23a
commit
ef91839844
@ -1,15 +1,15 @@
|
||||
"""Copyright (c) 2010-2012 David Rio Vierra
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
"""Copyright (c) 2010-2012 David Rio Vierra
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE."""
|
||||
|
||||
"""
|
||||
@ -451,8 +451,8 @@ class CameraViewport(GLViewport):
|
||||
glReadBuffer(GL_BACK)
|
||||
else:
|
||||
glReadBuffer(GL_FRONT)
|
||||
except Exception, e:
|
||||
print "Exception during glReadBuffer: {0!r}".format(e)
|
||||
except Exception:
|
||||
logging.exception('Exception during glReadBuffer')
|
||||
ws = self.get_root().size
|
||||
if center:
|
||||
x, y = ws
|
||||
@ -469,9 +469,7 @@ class CameraViewport(GLViewport):
|
||||
try:
|
||||
pixel = glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT)
|
||||
newpoint = unproject(x, y, pixel[0])
|
||||
except Exception, e:
|
||||
# print e
|
||||
# traceback.print_exc()
|
||||
except Exception:
|
||||
return 0, 0, 0
|
||||
|
||||
return newpoint
|
||||
@ -734,7 +732,6 @@ class CameraViewport(GLViewport):
|
||||
self.editor.level.addTileEntity(tileEntityTag)
|
||||
|
||||
if tileEntityTag["id"].value != containerID:
|
||||
print "Not a {0}! \n".format(containerID), tileEntityTag
|
||||
return
|
||||
|
||||
backupEntityTag = deepcopy(tileEntityTag)
|
||||
@ -1413,16 +1410,12 @@ class LevelEditor(GLViewport):
|
||||
self.cameraPanKeys = [0., 0.]
|
||||
self.cameraToolDistance = self.defaultCameraToolDistance
|
||||
|
||||
print "MCRenderer()"
|
||||
self.createRenderers()
|
||||
|
||||
print "Generating selection grid texture..."
|
||||
self.sixteenBlockTex = self.genSixteenBlockTexture()
|
||||
|
||||
# print "FontRenderer()"
|
||||
# self.Font = Font("Verdana, Arial", 18)
|
||||
|
||||
print "generateStars()"
|
||||
self.generateStars()
|
||||
|
||||
self.optionsBar = Widget()
|
||||
@ -1526,7 +1519,6 @@ class LevelEditor(GLViewport):
|
||||
self.add(self.viewportContainer)
|
||||
Settings.viewMode.addObserver(self)
|
||||
|
||||
print "EditorToolbar()"
|
||||
self.reloadToolbar()
|
||||
|
||||
self.currentTool = None
|
||||
@ -1895,7 +1887,6 @@ class LevelEditor(GLViewport):
|
||||
try:
|
||||
glColor(color[0], color[1], color[2], max(color[3], 0.35))
|
||||
except IndexError:
|
||||
print color
|
||||
raise
|
||||
glLineWidth(1.0)
|
||||
drawCube(box, cubeType=GL_LINE_STRIP)
|
||||
@ -1927,7 +1918,9 @@ class LevelEditor(GLViewport):
|
||||
try:
|
||||
level = fromFile(filename)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
logging.exception(
|
||||
'Wasn\'t able to open a file {file => %s}' % filename
|
||||
)
|
||||
alert(u"I don't know how to open {0}:\n\n{1!r}".format(filename, e))
|
||||
return
|
||||
|
||||
@ -2870,8 +2863,7 @@ class LevelEditor(GLViewport):
|
||||
for f in worldFiles:
|
||||
try:
|
||||
lev = MCInfdevOldLevel(f)
|
||||
except Exception, e:
|
||||
print f, ": ", repr(e)
|
||||
except Exception:
|
||||
continue
|
||||
else:
|
||||
worlds.append(lev)
|
||||
@ -2936,8 +2928,8 @@ class LevelEditor(GLViewport):
|
||||
filename = mcplatform.askOpenFile()
|
||||
if filename:
|
||||
self.parent.loadFile(filename)
|
||||
except Exception, e:
|
||||
print "Exception while getting filename", e
|
||||
except Exception:
|
||||
logging.exception('Error while asking user for filename')
|
||||
return
|
||||
|
||||
def createNewLevel(self):
|
||||
@ -2989,7 +2981,6 @@ class LevelEditor(GLViewport):
|
||||
return
|
||||
filename = mcplatform.askCreateWorld(saveFileDir)
|
||||
|
||||
print filename
|
||||
if not filename:
|
||||
return
|
||||
|
||||
@ -3025,9 +3016,10 @@ class LevelEditor(GLViewport):
|
||||
newlevel.setBlockAt(x, y, z, alphaMaterials.Sponge.ID)
|
||||
|
||||
self.loadFile(filename)
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
alert(u"Error while creating world {0}: {1}".format(os.path.basename(filename), e))
|
||||
except Exception:
|
||||
logging.exception(
|
||||
'Error while creating world. {world => %s}' % filename
|
||||
)
|
||||
return
|
||||
|
||||
return newlevel
|
||||
@ -3104,7 +3096,6 @@ class LevelEditor(GLViewport):
|
||||
self.addUnsavedEdit()
|
||||
|
||||
def invalidateBox(self, box):
|
||||
print "Invalidating box", box, ", Chunk range ", box.mincx, box.mincz, box.maxcx, box.maxcz
|
||||
self.renderer.invalidateChunksInBox(box)
|
||||
|
||||
def invalidateChunks(self, c):
|
||||
@ -3496,8 +3487,11 @@ class LevelEditor(GLViewport):
|
||||
self.renderer.viewDistance = self.renderer.viewDistance - 4
|
||||
self.renderer.discardAllChunks()
|
||||
|
||||
print "Out of memory! Decreasing view distance to {0}".format(self.renderer.viewDistance)
|
||||
print "Freed {0} objects".format(gc.collect())
|
||||
logging.warning(
|
||||
'Out of memory, decreasing view distance. {view => %s}' % (
|
||||
self.renderer.viewDistance
|
||||
)
|
||||
)
|
||||
|
||||
Settings.viewDistance.set(self.renderer.viewDistance)
|
||||
config.saveConfig()
|
||||
@ -3679,8 +3673,8 @@ class EditorToolbar(GLOrtho):
|
||||
), dtype="f4"))
|
||||
|
||||
glDrawArrays(GL_QUADS, 0, 4)
|
||||
except Exception, e:
|
||||
print "Exception: {0!r}".format(e)
|
||||
except Exception:
|
||||
logging.exception('Error while drawing toolbar.')
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY)
|
||||
|
||||
gfont = None
|
||||
|
Reference in New Issue
Block a user