pep8 compliance: E302 expected 2 blank lines
This commit is contained in:
parent
cab5c2a1e0
commit
44277200a0
@ -25,6 +25,7 @@ BrushSettings.updateBrushOffset = BrushSettings("Update Brush Offset", False)
|
|||||||
BrushSettings.chooseBlockImmediately = BrushSettings("Choose Block Immediately", False)
|
BrushSettings.chooseBlockImmediately = BrushSettings("Choose Block Immediately", False)
|
||||||
BrushSettings.alpha = BrushSettings("Alpha", 0.66)
|
BrushSettings.alpha = BrushSettings("Alpha", 0.66)
|
||||||
|
|
||||||
|
|
||||||
class BrushMode(object):
|
class BrushMode(object):
|
||||||
options = []
|
options = []
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ class BrushMode(object):
|
|||||||
def createOptions(self, panel, tool):
|
def createOptions(self, panel, tool):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Modes:
|
class Modes:
|
||||||
class Fill(BrushMode):
|
class Fill(BrushMode):
|
||||||
name = "Fill"
|
name = "Fill"
|
||||||
@ -344,6 +346,7 @@ class Modes:
|
|||||||
|
|
||||||
return op.level.copyBlocksFromIter(level, level.bounds, point, create=True)
|
return op.level.copyBlocksFromIter(level, level.bounds, point, create=True)
|
||||||
|
|
||||||
|
|
||||||
class BrushOperation(Operation):
|
class BrushOperation(Operation):
|
||||||
|
|
||||||
def __init__(self, editor, points, options):
|
def __init__(self, editor, points, options):
|
||||||
@ -515,6 +518,7 @@ class BrushOperation(Operation):
|
|||||||
dirtyBox = self.brushMode.dirtyBoxForPointAndOptions(point, self.options)
|
dirtyBox = self.brushMode.dirtyBoxForPointAndOptions(point, self.options)
|
||||||
return self.brushMode.performAtPoint(self, point, dirtyBox)
|
return self.brushMode.performAtPoint(self, point, dirtyBox)
|
||||||
|
|
||||||
|
|
||||||
class BrushPanel(Panel):
|
class BrushPanel(Panel):
|
||||||
|
|
||||||
def __init__(self, tool):
|
def __init__(self, tool):
|
||||||
@ -607,6 +611,7 @@ class BrushPanel(Panel):
|
|||||||
self.blockButton.blockInfo = self.replaceBlockButton.blockInfo
|
self.blockButton.blockInfo = self.replaceBlockButton.blockInfo
|
||||||
self.replaceBlockButton.blockInfo = b
|
self.replaceBlockButton.blockInfo = b
|
||||||
|
|
||||||
|
|
||||||
class BrushToolOptions(ToolOptions):
|
class BrushToolOptions(ToolOptions):
|
||||||
def __init__(self, tool):
|
def __init__(self, tool):
|
||||||
Panel.__init__(self)
|
Panel.__init__(self)
|
||||||
@ -628,6 +633,7 @@ class BrushToolOptions(ToolOptions):
|
|||||||
|
|
||||||
from clone import CloneTool
|
from clone import CloneTool
|
||||||
|
|
||||||
|
|
||||||
class BrushTool(CloneTool):
|
class BrushTool(CloneTool):
|
||||||
tooltipText = "Brush\nRight-click for options"
|
tooltipText = "Brush\nRight-click for options"
|
||||||
toolIconName = "brush"
|
toolIconName = "brush"
|
||||||
|
@ -16,6 +16,7 @@ from toolbasics import *
|
|||||||
from pymclevel.infiniteworld import MCServerChunkGenerator
|
from pymclevel.infiniteworld import MCServerChunkGenerator
|
||||||
from albow.dialogs import Dialog
|
from albow.dialogs import Dialog
|
||||||
|
|
||||||
|
|
||||||
class ChunkToolPanel(Panel):
|
class ChunkToolPanel(Panel):
|
||||||
|
|
||||||
def __init__(self, tool, *a, **kw):
|
def __init__(self, tool, *a, **kw):
|
||||||
@ -320,6 +321,7 @@ class ChunkTool(EditorTool):
|
|||||||
def mouseUp(self, evt, *args):
|
def mouseUp(self, evt, *args):
|
||||||
self.editor.selectionTool.mouseUp(evt, *args)
|
self.editor.selectionTool.mouseUp(evt, *args)
|
||||||
|
|
||||||
|
|
||||||
def GeneratorPanel():
|
def GeneratorPanel():
|
||||||
panel = Widget()
|
panel = Widget()
|
||||||
panel.chunkHeight = 64
|
panel.chunkHeight = 64
|
||||||
|
@ -21,6 +21,7 @@ CloneSettings.copyAir = CloneSettings("Copy Air", True)
|
|||||||
CloneSettings.copyWater = CloneSettings("Copy Water", True)
|
CloneSettings.copyWater = CloneSettings("Copy Water", True)
|
||||||
CloneSettings.placeImmediately = CloneSettings("Place Immediately", True)
|
CloneSettings.placeImmediately = CloneSettings("Place Immediately", True)
|
||||||
|
|
||||||
|
|
||||||
class CoordsInput(Widget):
|
class CoordsInput(Widget):
|
||||||
is_gl_container = True
|
is_gl_container = True
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ class CoordsInput(Widget):
|
|||||||
#nudge is a 3-tuple where one of the elements is -1 or 1, and the others are 0.
|
#nudge is a 3-tuple where one of the elements is -1 or 1, and the others are 0.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BlockCopyOperation(Operation):
|
class BlockCopyOperation(Operation):
|
||||||
def __init__(self, editor, sourceLevel, sourceBox, destLevel, destPoint, copyAir, copyWater):
|
def __init__(self, editor, sourceLevel, sourceBox, destLevel, destPoint, copyAir, copyWater):
|
||||||
self.editor = editor
|
self.editor = editor
|
||||||
@ -193,6 +195,7 @@ class CloneOperation (Operation):
|
|||||||
[i.undo() for i in self.selectionOps]
|
[i.undo() for i in self.selectionOps]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CloneToolPanel(Panel):
|
class CloneToolPanel(Panel):
|
||||||
useOffsetInput = True
|
useOffsetInput = True
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE."""
|
|||||||
from toolbasics import *
|
from toolbasics import *
|
||||||
from albow.dialogs import wrapped_label
|
from albow.dialogs import wrapped_label
|
||||||
|
|
||||||
|
|
||||||
def alertFilterException(func):
|
def alertFilterException(func):
|
||||||
def _func(*args, **kw):
|
def _func(*args, **kw):
|
||||||
try:
|
try:
|
||||||
@ -24,6 +25,7 @@ def alertFilterException(func):
|
|||||||
|
|
||||||
return _func
|
return _func
|
||||||
|
|
||||||
|
|
||||||
class FilterModuleOptions(Widget):
|
class FilterModuleOptions(Widget):
|
||||||
is_gl_container = True
|
is_gl_container = True
|
||||||
def __init__(self, tool, module, *args, **kw):
|
def __init__(self, tool, module, *args, **kw):
|
||||||
@ -126,6 +128,7 @@ class FilterModuleOptions(Widget):
|
|||||||
if k in self.optionDict:
|
if k in self.optionDict:
|
||||||
self.optionDict[k].set(val[k])
|
self.optionDict[k].set(val[k])
|
||||||
|
|
||||||
|
|
||||||
class FilterToolPanel(Panel):
|
class FilterToolPanel(Panel):
|
||||||
def __init__(self, tool):
|
def __init__(self, tool):
|
||||||
Panel.__init__(self)
|
Panel.__init__(self)
|
||||||
@ -194,6 +197,7 @@ class FilterToolPanel(Panel):
|
|||||||
if self.filterOptionsPanel:
|
if self.filterOptionsPanel:
|
||||||
self.savedOptions[self.selectedFilterName] = self.filterOptionsPanel.options
|
self.savedOptions[self.selectedFilterName] = self.filterOptionsPanel.options
|
||||||
|
|
||||||
|
|
||||||
class FilterOperation(Operation):
|
class FilterOperation(Operation):
|
||||||
def __init__(self, level, box, filter, options):
|
def __init__(self, level, box, filter, options):
|
||||||
self.box = box
|
self.box = box
|
||||||
@ -220,6 +224,7 @@ class FilterOperation(Operation):
|
|||||||
|
|
||||||
def dirtyBox(self): return self.box
|
def dirtyBox(self): return self.box
|
||||||
|
|
||||||
|
|
||||||
class FilterTool(EditorTool):
|
class FilterTool(EditorTool):
|
||||||
tooltipText = "Filter"
|
tooltipText = "Filter"
|
||||||
toolIconName = "filter"
|
toolIconName = "filter"
|
||||||
|
@ -16,6 +16,7 @@ from toolbasics import *
|
|||||||
import urllib
|
import urllib
|
||||||
from pymclevel.box import FloatBox
|
from pymclevel.box import FloatBox
|
||||||
|
|
||||||
|
|
||||||
class PlayerMoveOperation(Operation):
|
class PlayerMoveOperation(Operation):
|
||||||
undoPos = None
|
undoPos = None
|
||||||
def __init__(self, tool, pos, player="Player", yp = (None, None)):
|
def __init__(self, tool, pos, player="Player", yp = (None, None)):
|
||||||
@ -58,17 +59,21 @@ class PlayerMoveOperation(Operation):
|
|||||||
class SpawnPositionInvalid(Exception):
|
class SpawnPositionInvalid(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def okayAt63(level, pos):
|
def okayAt63(level, pos):
|
||||||
"""blocks 63 or 64 must be occupied"""
|
"""blocks 63 or 64 must be occupied"""
|
||||||
return level.blockAt(pos[0], 63, pos[2]) != 0 or level.blockAt(pos[0], 64, pos[2]) != 0
|
return level.blockAt(pos[0], 63, pos[2]) != 0 or level.blockAt(pos[0], 64, pos[2]) != 0
|
||||||
|
|
||||||
|
|
||||||
def okayAboveSpawn(level, pos):
|
def okayAboveSpawn(level, pos):
|
||||||
"""3 blocks above spawn must be open"""
|
"""3 blocks above spawn must be open"""
|
||||||
return not any( [level.blockAt(pos[0], pos[1]+i, pos[2]) for i in range(1, 4)] )
|
return not any( [level.blockAt(pos[0], pos[1]+i, pos[2]) for i in range(1, 4)] )
|
||||||
|
|
||||||
|
|
||||||
def positionValid(level, pos):
|
def positionValid(level, pos):
|
||||||
return okayAt63(level, pos) and okayAboveSpawn(level, pos)
|
return okayAt63(level, pos) and okayAboveSpawn(level, pos)
|
||||||
|
|
||||||
|
|
||||||
class PlayerSpawnMoveOperation(PlayerMoveOperation):
|
class PlayerSpawnMoveOperation(PlayerMoveOperation):
|
||||||
def perform(self, recordUndo=True):
|
def perform(self, recordUndo=True):
|
||||||
level = self.tool.editor.level
|
level = self.tool.editor.level
|
||||||
@ -123,6 +128,7 @@ class PlayerPositionPanel(Panel):
|
|||||||
def selectedPlayer(self):
|
def selectedPlayer(self):
|
||||||
return self.players[self.table.index]
|
return self.players[self.table.index]
|
||||||
|
|
||||||
|
|
||||||
class PlayerPositionTool(EditorTool):
|
class PlayerPositionTool(EditorTool):
|
||||||
surfaceBuild = True
|
surfaceBuild = True
|
||||||
toolIconName = "player"
|
toolIconName = "player"
|
||||||
@ -373,6 +379,7 @@ class PlayerSpawnPositionOptions(ToolOptions):
|
|||||||
SpawnSettings = config.Settings("Spawn")
|
SpawnSettings = config.Settings("Spawn")
|
||||||
SpawnSettings.spawnProtection = SpawnSettings("Spawn Protection", True)
|
SpawnSettings.spawnProtection = SpawnSettings("Spawn Protection", True)
|
||||||
|
|
||||||
|
|
||||||
class PlayerSpawnPositionTool(PlayerPositionTool):
|
class PlayerSpawnPositionTool(PlayerPositionTool):
|
||||||
surfaceBuild = True
|
surfaceBuild = True
|
||||||
toolIconName = "playerspawn"
|
toolIconName = "playerspawn"
|
||||||
|
@ -21,6 +21,8 @@ SelectSettings.color = SelectSettings("Color", "teal")
|
|||||||
|
|
||||||
ColorSettings = config.Settings("Selection Colors")
|
ColorSettings = config.Settings("Selection Colors")
|
||||||
ColorSettings.defaultColors = {}
|
ColorSettings.defaultColors = {}
|
||||||
|
|
||||||
|
|
||||||
class ColorSetting(config.Setting):
|
class ColorSetting(config.Setting):
|
||||||
def __init__(self, section, name, dtype, default):
|
def __init__(self, section, name, dtype, default):
|
||||||
super(ColorSetting, self).__init__(section, name, dtype, default)
|
super(ColorSetting, self).__init__(section, name, dtype, default)
|
||||||
@ -35,6 +37,7 @@ class ColorSetting(config.Setting):
|
|||||||
return parseValues(colorValues)
|
return parseValues(colorValues)
|
||||||
ColorSettings.Setting = ColorSetting
|
ColorSettings.Setting = ColorSetting
|
||||||
|
|
||||||
|
|
||||||
def parseValues(colorValues):
|
def parseValues(colorValues):
|
||||||
if colorValues is None:
|
if colorValues is None:
|
||||||
return 1., 1., 1.
|
return 1., 1., 1.
|
||||||
@ -60,6 +63,7 @@ ColorSettings("yellow" ,(1.0, 1.0, 0.75))
|
|||||||
ColorSettings("grey", (0.6, 0.6, 0.6))
|
ColorSettings("grey", (0.6, 0.6, 0.6))
|
||||||
ColorSettings("black", (0.0, 0.0, 0.0))
|
ColorSettings("black", (0.0, 0.0, 0.0))
|
||||||
|
|
||||||
|
|
||||||
def GetSelectionColor(colorWord = None):
|
def GetSelectionColor(colorWord = None):
|
||||||
if colorWord is None:
|
if colorWord is None:
|
||||||
colorWord = SelectSettings.color.get()
|
colorWord = SelectSettings.color.get()
|
||||||
@ -67,6 +71,7 @@ def GetSelectionColor(colorWord = None):
|
|||||||
colorValues = config.config.get("Selection Colors", colorWord)
|
colorValues = config.config.get("Selection Colors", colorWord)
|
||||||
return parseValues(colorValues)
|
return parseValues(colorValues)
|
||||||
|
|
||||||
|
|
||||||
class SelectionToolOptions(ToolOptions):
|
class SelectionToolOptions(ToolOptions):
|
||||||
|
|
||||||
def updateColors(self):
|
def updateColors(self):
|
||||||
@ -220,6 +225,7 @@ class NudgeBlocksOperation (Operation) :
|
|||||||
self.editor.invalidateBox(self.dirtyBox())
|
self.editor.invalidateBox(self.dirtyBox())
|
||||||
self.nudgeSelection.undo()
|
self.nudgeSelection.undo()
|
||||||
|
|
||||||
|
|
||||||
class SelectionTool(EditorTool):
|
class SelectionTool(EditorTool):
|
||||||
#selectionColor = (1.0, .9, .9);
|
#selectionColor = (1.0, .9, .9);
|
||||||
color = (0.7, 0., 0.7)
|
color = (0.7, 0., 0.7)
|
||||||
@ -1057,6 +1063,7 @@ class SelectionTool(EditorTool):
|
|||||||
if schematic:
|
if schematic:
|
||||||
self.editor.exportSchematic(schematic)
|
self.editor.exportSchematic(schematic)
|
||||||
|
|
||||||
|
|
||||||
class SelectionOperation(Operation):
|
class SelectionOperation(Operation):
|
||||||
changedLevel = False
|
changedLevel = False
|
||||||
def __init__(self, selectionTool, points):
|
def __init__(self, selectionTool, points):
|
||||||
|
@ -39,6 +39,7 @@ from albow.dialogs import Dialog
|
|||||||
from pymclevel.mclevelbase import exhaust
|
from pymclevel.mclevelbase import exhaust
|
||||||
from albow.root import Cancel
|
from albow.root import Cancel
|
||||||
|
|
||||||
|
|
||||||
class NudgeButton(GLBackground):
|
class NudgeButton(GLBackground):
|
||||||
""" A button that captures movement keys while pressed and sends them to a listener as nudge events.
|
""" A button that captures movement keys while pressed and sends them to a listener as nudge events.
|
||||||
Poorly planned. """
|
Poorly planned. """
|
||||||
@ -124,6 +125,7 @@ class Operation(object):
|
|||||||
"""
|
"""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class ToolOptions(Panel):
|
class ToolOptions(Panel):
|
||||||
@property
|
@property
|
||||||
def editor(self):
|
def editor(self):
|
||||||
@ -194,6 +196,7 @@ class ThumbView(GLPerspective):
|
|||||||
self.renderer.draw()
|
self.renderer.draw()
|
||||||
GL.glPopAttrib()
|
GL.glPopAttrib()
|
||||||
|
|
||||||
|
|
||||||
class BlockThumbView(Widget):
|
class BlockThumbView(Widget):
|
||||||
is_gl_container = True
|
is_gl_container = True
|
||||||
|
|
||||||
@ -226,6 +229,7 @@ class BlockThumbView(Widget):
|
|||||||
for i in self.thumb.renderer.chunkWorker:
|
for i in self.thumb.renderer.chunkWorker:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BlockView(GLOrtho):
|
class BlockView(GLOrtho):
|
||||||
def __init__(self, materials, blockInfo=None):
|
def __init__(self, materials, blockInfo=None):
|
||||||
GLOrtho.__init__(self)
|
GLOrtho.__init__(self)
|
||||||
@ -377,6 +381,7 @@ class BlockButton(ButtonBase, Panel):
|
|||||||
if blockPicker.present():
|
if blockPicker.present():
|
||||||
self.blockInfo = blockPicker.blockInfo
|
self.blockInfo = blockPicker.blockInfo
|
||||||
|
|
||||||
|
|
||||||
def anySubtype(self):
|
def anySubtype(self):
|
||||||
bl = materials.Block(self.materials, self.ID, self.blockData)
|
bl = materials.Block(self.materials, self.ID, self.blockData)
|
||||||
bl.wildcard = True
|
bl.wildcard = True
|
||||||
|
Reference in New Issue
Block a user