pep8 compliance: E302 expected 2 blank lines
This commit is contained in:
parent
0040b10967
commit
f4c90ed24b
18
mceutils.py
18
mceutils.py
@ -42,6 +42,7 @@ from pymclevel import materials
|
|||||||
|
|
||||||
from errorreporting import reportException, reportCrash
|
from errorreporting import reportException, reportCrash
|
||||||
|
|
||||||
|
|
||||||
def alertException(func):
|
def alertException(func):
|
||||||
def _alertException(*args, **kw):
|
def _alertException(*args, **kw):
|
||||||
try:
|
try:
|
||||||
@ -56,6 +57,7 @@ def alertException(func):
|
|||||||
|
|
||||||
from pymclevel.faces import *
|
from pymclevel.faces import *
|
||||||
|
|
||||||
|
|
||||||
def drawFace(box, face, type=GL.GL_QUADS):
|
def drawFace(box, face, type=GL.GL_QUADS):
|
||||||
x, y, z, = box.origin
|
x, y, z, = box.origin
|
||||||
x2, y2, z2 = box.maximum
|
x2, y2, z2 = box.maximum
|
||||||
@ -239,6 +241,7 @@ def drawCube(box, cubeType=GL.GL_QUADS, blockType=0, texture=None, textureVertic
|
|||||||
GL.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY)
|
GL.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY)
|
||||||
GL.glDisable(GL.GL_TEXTURE_2D)
|
GL.glDisable(GL.GL_TEXTURE_2D)
|
||||||
|
|
||||||
|
|
||||||
def drawTerrainCuttingWire(box,
|
def drawTerrainCuttingWire(box,
|
||||||
c0=(0.75, 0.75, 0.75, 0.4),
|
c0=(0.75, 0.75, 0.75, 0.4),
|
||||||
c1=(1.0, 1.0, 1.0, 1.0)):
|
c1=(1.0, 1.0, 1.0, 1.0)):
|
||||||
@ -262,6 +265,7 @@ def drawTerrainCuttingWire(box,
|
|||||||
|
|
||||||
#texturePacksDir = os.path.join(pymclevel.minecraftDir, "texturepacks")
|
#texturePacksDir = os.path.join(pymclevel.minecraftDir, "texturepacks")
|
||||||
|
|
||||||
|
|
||||||
def loadAlphaTerrainTexture():
|
def loadAlphaTerrainTexture():
|
||||||
pngFile = None
|
pngFile = None
|
||||||
customWaterFile = None
|
customWaterFile = None
|
||||||
@ -420,6 +424,7 @@ def loadPNGData(filename_or_data):
|
|||||||
|
|
||||||
return w, h, data
|
return w, h, data
|
||||||
|
|
||||||
|
|
||||||
def loadPNGFile(filename):
|
def loadPNGFile(filename):
|
||||||
(w, h, data) = loadPNGData(filename)
|
(w, h, data) = loadPNGData(filename)
|
||||||
|
|
||||||
@ -430,10 +435,12 @@ def loadPNGFile(filename):
|
|||||||
|
|
||||||
return w, h, data
|
return w, h, data
|
||||||
|
|
||||||
|
|
||||||
def loadTextureFunc(w, h, ndata):
|
def loadTextureFunc(w, h, ndata):
|
||||||
GL.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, w, h, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, ndata)
|
GL.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, w, h, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, ndata)
|
||||||
return w, h
|
return w, h
|
||||||
|
|
||||||
|
|
||||||
def loadPNGTexture(filename):
|
def loadPNGTexture(filename):
|
||||||
try:
|
try:
|
||||||
w, h, ndata = loadPNGFile(filename)
|
w, h, ndata = loadPNGFile(filename)
|
||||||
@ -448,6 +455,7 @@ def loadPNGTexture(filename):
|
|||||||
|
|
||||||
import glutils
|
import glutils
|
||||||
|
|
||||||
|
|
||||||
def normalize(x):
|
def normalize(x):
|
||||||
l = x[0] * x[0] + x[1] * x[1] + x[2] * x[2]
|
l = x[0] * x[0] + x[1] * x[1] + x[2] * x[2]
|
||||||
if l <= 0.0: return [0, 0, 0]
|
if l <= 0.0: return [0, 0, 0]
|
||||||
@ -456,6 +464,7 @@ def normalize(x):
|
|||||||
return [0, 0, 0]
|
return [0, 0, 0]
|
||||||
return map(lambda a:a / size, x)
|
return map(lambda a:a / size, x)
|
||||||
|
|
||||||
|
|
||||||
def normalize_size(x):
|
def normalize_size(x):
|
||||||
l = x[0] * x[0] + x[1] * x[1] + x[2] * x[2]
|
l = x[0] * x[0] + x[1] * x[1] + x[2] * x[2]
|
||||||
if l <= 0.0: return [0., 0., 0.], 0.
|
if l <= 0.0: return [0., 0., 0.], 0.
|
||||||
@ -502,6 +511,8 @@ class HotkeyColumn(Widget):
|
|||||||
|
|
||||||
|
|
||||||
from albow import CheckBox, AttrRef, Menu
|
from albow import CheckBox, AttrRef, Menu
|
||||||
|
|
||||||
|
|
||||||
class MenuButton(Button):
|
class MenuButton(Button):
|
||||||
def __init__(self, title, choices, **kw):
|
def __init__(self, title, choices, **kw):
|
||||||
Button.__init__(self, title, **kw)
|
Button.__init__(self, title, **kw)
|
||||||
@ -516,6 +527,7 @@ class MenuButton(Button):
|
|||||||
def menu_picked(self, index):
|
def menu_picked(self, index):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ChoiceButton(ValueButton):
|
class ChoiceButton(ValueButton):
|
||||||
align="c"
|
align="c"
|
||||||
choose = None
|
choose = None
|
||||||
@ -589,14 +601,19 @@ def CheckBoxLabel(title, *args, **kw):
|
|||||||
return row
|
return row
|
||||||
|
|
||||||
from albow import FloatField, IntField
|
from albow import FloatField, IntField
|
||||||
|
|
||||||
|
|
||||||
def FloatInputRow(title, *args, **kw):
|
def FloatInputRow(title, *args, **kw):
|
||||||
return Row((Label(title, tooltipText=kw.get('tooltipText')), FloatField(*args, **kw)))
|
return Row((Label(title, tooltipText=kw.get('tooltipText')), FloatField(*args, **kw)))
|
||||||
|
|
||||||
|
|
||||||
def IntInputRow(title, *args, **kw):
|
def IntInputRow(title, *args, **kw):
|
||||||
return Row((Label(title, tooltipText=kw.get('tooltipText')), IntField(*args, **kw)))
|
return Row((Label(title, tooltipText=kw.get('tooltipText')), IntField(*args, **kw)))
|
||||||
|
|
||||||
from albow.dialogs import Dialog
|
from albow.dialogs import Dialog
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
|
|
||||||
def setWindowCaption(prefix):
|
def setWindowCaption(prefix):
|
||||||
caption = display.get_caption()[0]
|
caption = display.get_caption()[0]
|
||||||
|
|
||||||
@ -607,6 +624,7 @@ def setWindowCaption(prefix):
|
|||||||
display.set_caption(caption)
|
display.set_caption(caption)
|
||||||
return ctx()
|
return ctx()
|
||||||
|
|
||||||
|
|
||||||
def showProgress(progressText, progressIterator, cancel=False):
|
def showProgress(progressText, progressIterator, cancel=False):
|
||||||
"""Show the progress for a long-running synchronous operation.
|
"""Show the progress for a long-running synchronous operation.
|
||||||
progressIterator should be a generator-like object that can return
|
progressIterator should be a generator-like object that can return
|
||||||
|
Reference in New Issue
Block a user