pep8 compliance: E301 expected 1 blank line
This commit is contained in:
parent
f5c267072c
commit
c800106039
@ -571,6 +571,7 @@ class CameraViewport(GLViewport):
|
|||||||
return self.width / float(self.height)
|
return self.width / float(self.height)
|
||||||
|
|
||||||
startingMousePosition = None
|
startingMousePosition = None
|
||||||
|
|
||||||
def mouseLookOn(self):
|
def mouseLookOn(self):
|
||||||
root.get_root().capture_mouse(self)
|
root.get_root().capture_mouse(self)
|
||||||
self.focus_switch = None
|
self.focus_switch = None
|
||||||
@ -741,6 +742,7 @@ class CameraViewport(GLViewport):
|
|||||||
if 0 == len(tileEntityTag['Items']):
|
if 0 == len(tileEntityTag['Items']):
|
||||||
return "N/A"
|
return "N/A"
|
||||||
return tileEntityTag['Items'][self.selectedItemIndex][key].value
|
return tileEntityTag['Items'][self.selectedItemIndex][key].value
|
||||||
|
|
||||||
def setter(self, val):
|
def setter(self, val):
|
||||||
if 0 == len(tileEntityTag['Items']):
|
if 0 == len(tileEntityTag['Items']):
|
||||||
return
|
return
|
||||||
@ -771,6 +773,7 @@ class CameraViewport(GLViewport):
|
|||||||
|
|
||||||
TableColumn("Name", 200, "l"),
|
TableColumn("Name", 200, "l"),
|
||||||
])
|
])
|
||||||
|
|
||||||
def itemName(id, damage):
|
def itemName(id, damage):
|
||||||
try:
|
try:
|
||||||
return items.items.findItem(id, damage).name
|
return items.items.findItem(id, damage).name
|
||||||
@ -783,6 +786,7 @@ class CameraViewport(GLViewport):
|
|||||||
return slot, id, damage, count, itemName(id, damage)
|
return slot, id, damage, count, itemName(id, damage)
|
||||||
|
|
||||||
chestWidget.selectedItemIndex = 0
|
chestWidget.selectedItemIndex = 0
|
||||||
|
|
||||||
def selectTableRow(i, evt):
|
def selectTableRow(i, evt):
|
||||||
chestWidget.selectedItemIndex = i
|
chestWidget.selectedItemIndex = i
|
||||||
|
|
||||||
@ -825,6 +829,7 @@ class CameraViewport(GLViewport):
|
|||||||
else:
|
else:
|
||||||
def matches(t):
|
def matches(t):
|
||||||
return t["id"].value == id
|
return t["id"].value == id
|
||||||
|
|
||||||
def matches_itementity(e):
|
def matches_itementity(e):
|
||||||
if e["id"].value != "Item":
|
if e["id"].value != "Item":
|
||||||
return False
|
return False
|
||||||
@ -881,8 +886,10 @@ class CameraViewport(GLViewport):
|
|||||||
|
|
||||||
def deleteEnable():
|
def deleteEnable():
|
||||||
return len(tileEntityTag['Items']) and chestWidget.selectedItemIndex != -1
|
return len(tileEntityTag['Items']) and chestWidget.selectedItemIndex != -1
|
||||||
|
|
||||||
def addEnable():
|
def addEnable():
|
||||||
return len(tileEntityTag['Items']) < chestWidget.itemLimit
|
return len(tileEntityTag['Items']) < chestWidget.itemLimit
|
||||||
|
|
||||||
def addItem():
|
def addItem():
|
||||||
slot = 0
|
slot = 0
|
||||||
for item in tileEntityTag['Items']:
|
for item in tileEntityTag['Items']:
|
||||||
@ -914,6 +921,7 @@ class CameraViewport(GLViewport):
|
|||||||
class ChestEditOperation(Operation):
|
class ChestEditOperation(Operation):
|
||||||
def perform(self, recordUndo=True):
|
def perform(self, recordUndo=True):
|
||||||
level.addTileEntity(tileEntityTag)
|
level.addTileEntity(tileEntityTag)
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
level.addTileEntity(backupEntityTag)
|
level.addTileEntity(backupEntityTag)
|
||||||
return BoundingBox(TileEntity.pos(tileEntityTag), (1, 1, 1))
|
return BoundingBox(TileEntity.pos(tileEntityTag), (1, 1, 1))
|
||||||
@ -925,6 +933,7 @@ class CameraViewport(GLViewport):
|
|||||||
self.editor.addUnsavedEdit()
|
self.editor.addUnsavedEdit()
|
||||||
|
|
||||||
rightMouseDragStart = None
|
rightMouseDragStart = None
|
||||||
|
|
||||||
def rightClickDown(self, evt):
|
def rightClickDown(self, evt):
|
||||||
|
|
||||||
self.rightMouseDragStart = datetime.now()
|
self.rightMouseDragStart = datetime.now()
|
||||||
@ -1095,6 +1104,7 @@ class CameraViewport(GLViewport):
|
|||||||
glTranslate(-x, -y, -z)
|
glTranslate(-x, -y, -z)
|
||||||
|
|
||||||
_floorQuadList = None
|
_floorQuadList = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def floorQuadList(self):
|
def floorQuadList(self):
|
||||||
if not self._floorQuadList:
|
if not self._floorQuadList:
|
||||||
@ -1102,6 +1112,7 @@ class CameraViewport(GLViewport):
|
|||||||
return self._floorQuadList
|
return self._floorQuadList
|
||||||
|
|
||||||
_ceilingList = None
|
_ceilingList = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ceilingList(self):
|
def ceilingList(self):
|
||||||
if not self._ceilingList:
|
if not self._ceilingList:
|
||||||
@ -1128,6 +1139,7 @@ class CameraViewport(GLViewport):
|
|||||||
@property
|
@property
|
||||||
def drawSky(self):
|
def drawSky(self):
|
||||||
return self._drawSky
|
return self._drawSky
|
||||||
|
|
||||||
@drawSky.setter
|
@drawSky.setter
|
||||||
def drawSky(self, val):
|
def drawSky(self, val):
|
||||||
self._drawSky = val
|
self._drawSky = val
|
||||||
@ -1137,6 +1149,7 @@ class CameraViewport(GLViewport):
|
|||||||
self._floorQuadList.invalidate()
|
self._floorQuadList.invalidate()
|
||||||
|
|
||||||
skyList = None
|
skyList = None
|
||||||
|
|
||||||
def drawSkyBackground(self):
|
def drawSkyBackground(self):
|
||||||
if self.skyList is None:
|
if self.skyList is None:
|
||||||
self.skyList = DisplayList()
|
self.skyList = DisplayList()
|
||||||
@ -1181,6 +1194,7 @@ class CameraViewport(GLViewport):
|
|||||||
@property
|
@property
|
||||||
def drawFog(self):
|
def drawFog(self):
|
||||||
return self._drawFog and not self.editor.renderer.inSpace()
|
return self._drawFog and not self.editor.renderer.inSpace()
|
||||||
|
|
||||||
@drawFog.setter
|
@drawFog.setter
|
||||||
def drawFog(self, val):
|
def drawFog(self, val):
|
||||||
self._drawFog = val
|
self._drawFog = val
|
||||||
@ -1196,6 +1210,7 @@ class CameraViewport(GLViewport):
|
|||||||
glFogfv(GL_FOG_COLOR, self.fogColorBlack)
|
glFogfv(GL_FOG_COLOR, self.fogColorBlack)
|
||||||
|
|
||||||
glFogf(GL_FOG_DENSITY, 0.002)
|
glFogf(GL_FOG_DENSITY, 0.002)
|
||||||
|
|
||||||
def disableFog(self):
|
def disableFog(self):
|
||||||
glDisable(GL_FOG)
|
glDisable(GL_FOG)
|
||||||
|
|
||||||
@ -1277,6 +1292,7 @@ class CameraViewport(GLViewport):
|
|||||||
|
|
||||||
class ChunkViewport(CameraViewport):
|
class ChunkViewport(CameraViewport):
|
||||||
defaultScale = 1.0 # pixels per block
|
defaultScale = 1.0 # pixels per block
|
||||||
|
|
||||||
def __init__(self, *a, **kw):
|
def __init__(self, *a, **kw):
|
||||||
CameraViewport.__init__(self, *a, **kw)
|
CameraViewport.__init__(self, *a, **kw)
|
||||||
|
|
||||||
@ -1308,8 +1324,10 @@ class ChunkViewport(CameraViewport):
|
|||||||
self.editor.renderer.loadNearbyChunks()
|
self.editor.renderer.loadNearbyChunks()
|
||||||
|
|
||||||
incrementFactor = 1.4
|
incrementFactor = 1.4
|
||||||
|
|
||||||
def zoomIn(self):
|
def zoomIn(self):
|
||||||
self.zoom(1.0 / self.incrementFactor)
|
self.zoom(1.0 / self.incrementFactor)
|
||||||
|
|
||||||
def zoomOut(self):
|
def zoomOut(self):
|
||||||
self.zoom(self.incrementFactor)
|
self.zoom(self.incrementFactor)
|
||||||
|
|
||||||
@ -1364,6 +1382,7 @@ class ChunkViewport(CameraViewport):
|
|||||||
|
|
||||||
class LevelEditor(GLViewport):
|
class LevelEditor(GLViewport):
|
||||||
anchor = "tlbr"
|
anchor = "tlbr"
|
||||||
|
|
||||||
def __init__(self, mcedit):
|
def __init__(self, mcedit):
|
||||||
self.mcedit = mcedit
|
self.mcedit = mcedit
|
||||||
rect = mcedit.rect
|
rect = mcedit.rect
|
||||||
@ -1518,6 +1537,7 @@ class LevelEditor(GLViewport):
|
|||||||
self.deleteAllCopiedSchematics()
|
self.deleteAllCopiedSchematics()
|
||||||
|
|
||||||
_viewMode = None
|
_viewMode = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def viewMode(self):
|
def viewMode(self):
|
||||||
return self._viewMode
|
return self._viewMode
|
||||||
@ -1600,6 +1620,7 @@ class LevelEditor(GLViewport):
|
|||||||
|
|
||||||
thumbCache = None
|
thumbCache = None
|
||||||
fboCache = None
|
fboCache = None
|
||||||
|
|
||||||
def createCopyPanel(self):
|
def createCopyPanel(self):
|
||||||
panel = GLBackground()
|
panel = GLBackground()
|
||||||
panel.bg_color = (0.0, 0.0, 0.0, 0.5)
|
panel.bg_color = (0.0, 0.0, 0.0, 0.5)
|
||||||
@ -2264,6 +2285,7 @@ class LevelEditor(GLViewport):
|
|||||||
def mouseLookOff(self):
|
def mouseLookOff(self):
|
||||||
self.mouseWasCaptured = False
|
self.mouseWasCaptured = False
|
||||||
self.mainViewport.mouseLookOff()
|
self.mainViewport.mouseLookOff()
|
||||||
|
|
||||||
def mouseLookOn(self):
|
def mouseLookOn(self):
|
||||||
self.mainViewport.mouseLookOn()
|
self.mainViewport.mouseLookOn()
|
||||||
|
|
||||||
@ -2377,6 +2399,7 @@ class LevelEditor(GLViewport):
|
|||||||
if reach > 30 and self.fractionalReachAdjustment:
|
if reach > 30 and self.fractionalReachAdjustment:
|
||||||
reach *= 1.05
|
reach *= 1.05
|
||||||
return reach
|
return reach
|
||||||
|
|
||||||
def _decrementReach(self, reach):
|
def _decrementReach(self, reach):
|
||||||
reach -= 1
|
reach -= 1
|
||||||
if reach > 30 and self.fractionalReachAdjustment:
|
if reach > 30 and self.fractionalReachAdjustment:
|
||||||
@ -2626,6 +2649,7 @@ class LevelEditor(GLViewport):
|
|||||||
gotoPanel.add(column)
|
gotoPanel.add(column)
|
||||||
gotoPanel.shrink_wrap()
|
gotoPanel.shrink_wrap()
|
||||||
d = Dialog(client=gotoPanel, responses=["Goto", "Cancel"])
|
d = Dialog(client=gotoPanel, responses=["Goto", "Cancel"])
|
||||||
|
|
||||||
def click_outside(event):
|
def click_outside(event):
|
||||||
if event not in d:
|
if event not in d:
|
||||||
x, y, z = self.blockFaceUnderCursor[0]
|
x, y, z = self.blockFaceUnderCursor[0]
|
||||||
@ -2733,6 +2757,7 @@ class LevelEditor(GLViewport):
|
|||||||
if hasattr(self.level, 'GameType'):
|
if hasattr(self.level, 'GameType'):
|
||||||
t = self.level.GameType
|
t = self.level.GameType
|
||||||
types = ["Survival", "Creative"]
|
types = ["Survival", "Creative"]
|
||||||
|
|
||||||
def gametype(t):
|
def gametype(t):
|
||||||
if t < len(types):
|
if t < len(types):
|
||||||
return types[t]
|
return types[t]
|
||||||
@ -2866,6 +2891,7 @@ class LevelEditor(GLViewport):
|
|||||||
TableColumn("Dims", 100, "r"),
|
TableColumn("Dims", 100, "r"),
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
def dateobj(lp):
|
def dateobj(lp):
|
||||||
try:
|
try:
|
||||||
return datetime.utcfromtimestamp(lp / 1000.0)
|
return datetime.utcfromtimestamp(lp / 1000.0)
|
||||||
@ -2938,6 +2964,7 @@ class LevelEditor(GLViewport):
|
|||||||
# blockInputRow = Row( (Label("Surface: "), blockInput) )
|
# blockInputRow = Row( (Label("Surface: "), blockInput) )
|
||||||
|
|
||||||
types = ["Survival", "Creative"]
|
types = ["Survival", "Creative"]
|
||||||
|
|
||||||
def gametype(t):
|
def gametype(t):
|
||||||
if t < len(types):
|
if t < len(types):
|
||||||
return types[t]
|
return types[t]
|
||||||
@ -3188,6 +3215,7 @@ class LevelEditor(GLViewport):
|
|||||||
return panel
|
return panel
|
||||||
|
|
||||||
workInfoPanel = None
|
workInfoPanel = None
|
||||||
|
|
||||||
def updateWorkInfoPanel(self):
|
def updateWorkInfoPanel(self):
|
||||||
if self.workInfoPanel:
|
if self.workInfoPanel:
|
||||||
self.workInfoPanel.set_parent(None)
|
self.workInfoPanel.set_parent(None)
|
||||||
@ -3329,6 +3357,7 @@ class LevelEditor(GLViewport):
|
|||||||
self.parent.confirm_quit()
|
self.parent.confirm_quit()
|
||||||
|
|
||||||
mouseWasCaptured = False
|
mouseWasCaptured = False
|
||||||
|
|
||||||
def showControls(self):
|
def showControls(self):
|
||||||
if self.controlPanel.parent:
|
if self.controlPanel.parent:
|
||||||
return
|
return
|
||||||
@ -3351,6 +3380,7 @@ class LevelEditor(GLViewport):
|
|||||||
self.controlPanel.set_parent(None)
|
self.controlPanel.set_parent(None)
|
||||||
|
|
||||||
infoPanel = None
|
infoPanel = None
|
||||||
|
|
||||||
def showChunkRendererInfo(self):
|
def showChunkRendererInfo(self):
|
||||||
if self.infoPanel:
|
if self.infoPanel:
|
||||||
self.infoPanel.set_parent(None)
|
self.infoPanel.set_parent(None)
|
||||||
@ -3358,6 +3388,7 @@ class LevelEditor(GLViewport):
|
|||||||
|
|
||||||
self.infoPanel = infoPanel = Widget(bg_color = (0, 0, 0, 80))
|
self.infoPanel = infoPanel = Widget(bg_color = (0, 0, 0, 80))
|
||||||
infoPanel.add(Label(""))
|
infoPanel.add(Label(""))
|
||||||
|
|
||||||
def idleHandler(evt):
|
def idleHandler(evt):
|
||||||
|
|
||||||
x,y,z = self.blockFaceUnderCursor[0]
|
x,y,z = self.blockFaceUnderCursor[0]
|
||||||
|
Reference in New Issue
Block a user