Rewrite some docstrings in NumpyDoc
This commit is contained in:
parent
55b0dc9aae
commit
042bfa739b
@ -19,13 +19,18 @@ class BrushShape(QtCore.QObject):
|
|||||||
to the widget, and for signaling its client that the user has changed these options. It also
|
to the widget, and for signaling its client that the user has changed these options. It also
|
||||||
provides an internal string ID and an icon to display in the shape chooser widget.
|
provides an internal string ID and an icon to display in the shape chooser widget.
|
||||||
|
|
||||||
:cvar ID: String identifier
|
Attributes
|
||||||
:type ID: str
|
----------
|
||||||
:cvar icon: Path to icon file, relative to `mcedit2/assets/mcedit2/icons`
|
|
||||||
:type icon: basestring
|
ID : unicode
|
||||||
:cvar optionsChanged: This signal should be emitted whenever the options in the BrushShape's
|
Textual identifier for this shape. Used for preference saving, etc.
|
||||||
options widget are changed, to notify the shape's client that it should redraw the shape.
|
|
||||||
:type optionsChanged: Signal
|
icon : unicode
|
||||||
|
Path to icon file, relative to `mcedit2/assets/mcedit2/icons`
|
||||||
|
|
||||||
|
optionsChanged : Signal
|
||||||
|
This signal should be emitted whenever the options in the BrushShape's
|
||||||
|
options widget are changed, to notify the shape's client that it should redraw the shape.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ID = NotImplemented
|
ID = NotImplemented
|
||||||
@ -41,12 +46,18 @@ class BrushShape(QtCore.QObject):
|
|||||||
|
|
||||||
TODO: BitmapSelectionBox
|
TODO: BitmapSelectionBox
|
||||||
|
|
||||||
:param box: Bounding box of the selection
|
Parameters
|
||||||
:type box: BoundingBox
|
----------
|
||||||
:param dimension: Dimension to create the shaped selection for.
|
|
||||||
:type dimension: WorldEditorDimension
|
box : BoundingBox
|
||||||
:return: SelectionBox object that selects all blocks inside this shape
|
Bounding box of the selection
|
||||||
:rtype: SelectionBox
|
dimension : WorldEditorDimension
|
||||||
|
Dimension to create the shaped selection for.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
box: SelectionBox
|
||||||
|
SelectionBox object that selects all blocks inside this shape
|
||||||
"""
|
"""
|
||||||
return selection.ShapeFuncSelection(box, self.shapeFunc)
|
return selection.ShapeFuncSelection(box, self.shapeFunc)
|
||||||
|
|
||||||
@ -70,12 +81,18 @@ class BrushShape(QtCore.QObject):
|
|||||||
|
|
||||||
The size of the shape's bounding box is given by selectionSize.
|
The size of the shape's bounding box is given by selectionSize.
|
||||||
|
|
||||||
:param blockPositions: Coordinates of requested blocks relative to Shape's bounding box.
|
Parameters
|
||||||
:type blockPositions: numpy.ndarray[ndims=4,dtype=float32]
|
----------
|
||||||
:param selectionSize: Size of the Shape's bounding box.
|
|
||||||
:type selectionSize: (int, int, int)
|
blockPositions : numpy.ndarray[ndims=4,dtype=float32]
|
||||||
:return: Boolean array of the same shape as blockPositions[0] where selected blocks are True
|
Coordinates of requested blocks relative to Shape's bounding box.
|
||||||
:rtype: numpy.ndarray[ndims=3,dtype=bool]
|
selectionSize : (int, int, int)
|
||||||
|
Size of the Shape's bounding box.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
mask : numpy.ndarray[ndims=3,dtype=bool]
|
||||||
|
Boolean array of the same shape as blockPositions[0] where selected blocks are True
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@ -85,11 +102,14 @@ class BrushShape(QtCore.QObject):
|
|||||||
|
|
||||||
If there are no options to present, return None. This is the default implementation.
|
If there are no options to present, return None. This is the default implementation.
|
||||||
|
|
||||||
:return: Options widget
|
Returns
|
||||||
:rtype: QWidget | NoneType
|
-------
|
||||||
|
|
||||||
|
widget : QWidget | NoneType
|
||||||
"""
|
"""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class Round(BrushShape):
|
class Round(BrushShape):
|
||||||
ID = "Round"
|
ID = "Round"
|
||||||
icon = "shapes/round.png"
|
icon = "shapes/round.png"
|
||||||
|
@ -39,8 +39,10 @@ class IChunkLoaderClient(object):
|
|||||||
|
|
||||||
Return None to request no chunks.
|
Return None to request no chunks.
|
||||||
|
|
||||||
:rtype: (cx, cz)
|
Returns
|
||||||
:return: Chunk coordinates
|
-------
|
||||||
|
|
||||||
|
chunkPos : (int, int) | None
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -51,7 +53,10 @@ class IChunkLoaderClient(object):
|
|||||||
Return False to skip loading the chunk at the given position.
|
Return False to skip loading the chunk at the given position.
|
||||||
If all clients return False, the chunk is not loaded.
|
If all clients return False, the chunk is not loaded.
|
||||||
|
|
||||||
:rtype: boolean
|
Returns
|
||||||
|
-------
|
||||||
|
|
||||||
|
wantsChunk : bool
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def recieveChunk(self, chunk):
|
def recieveChunk(self, chunk):
|
||||||
@ -63,10 +68,16 @@ class IChunkLoaderClient(object):
|
|||||||
long-running operations on a single chunk to be split over multiple calls to
|
long-running operations on a single chunk to be split over multiple calls to
|
||||||
ChunkLoader.next()
|
ChunkLoader.next()
|
||||||
|
|
||||||
:param chunk: returned by level.getChunk()
|
Parameters
|
||||||
:type chunk: WorldEditorChunk
|
----------
|
||||||
:return: See description
|
|
||||||
:rtype: Iterable | None
|
chunk : WorldEditorChunk
|
||||||
|
The chunk returned by level.getChunk()
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
|
||||||
|
worker : Iterable | None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def chunkNotLoaded(self, (cx, cz), exc):
|
def chunkNotLoaded(self, (cx, cz), exc):
|
||||||
@ -75,8 +86,12 @@ class IChunkLoaderClient(object):
|
|||||||
|
|
||||||
Notifies each client of the chunk's position and the thrown exception.
|
Notifies each client of the chunk's position and the thrown exception.
|
||||||
|
|
||||||
:param (cx, cz): chunk position
|
Parameters
|
||||||
:param exc: The exception that was thrown, usually IOError or LevelFormatError
|
----------
|
||||||
|
(cx, cz) : (int, int)
|
||||||
|
Position of the failed chunk.
|
||||||
|
|
||||||
|
exc : The Exception object thrown by the world, usually IOError or LevelFormatError
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def chunkNotPresent(self, (cx, cz)):
|
def chunkNotPresent(self, (cx, cz)):
|
||||||
@ -85,7 +100,10 @@ class IChunkLoaderClient(object):
|
|||||||
|
|
||||||
Notifies each client of the chunk's position.
|
Notifies each client of the chunk's position.
|
||||||
|
|
||||||
:param (cx, cz): chunk position
|
Parameters
|
||||||
|
----------
|
||||||
|
(cx, cz) : (int, int)
|
||||||
|
chunk position
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def chunkInvalid(self, (cx, cz), deleted):
|
def chunkInvalid(self, (cx, cz), deleted):
|
||||||
@ -122,7 +140,11 @@ class ChunkLoader(QtCore.QObject):
|
|||||||
to load and process chunks. `StopIteration` will be raised when all clients return None when
|
to load and process chunks. `StopIteration` will be raised when all clients return None when
|
||||||
requestChunk is called.
|
requestChunk is called.
|
||||||
|
|
||||||
:param dimension: WorldEditorDimension
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
dimension : WorldEditorDimension
|
||||||
|
The dimension to load chunks from.
|
||||||
"""
|
"""
|
||||||
QtCore.QObject.__init__(self, *args, **kwargs)
|
QtCore.QObject.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
@ -149,14 +171,20 @@ class ChunkLoader(QtCore.QObject):
|
|||||||
|
|
||||||
def addClient(self, client, index=-1):
|
def addClient(self, client, index=-1):
|
||||||
"""
|
"""
|
||||||
:type client: IChunkLoaderClient
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
client : IChunkLoaderClient
|
||||||
"""
|
"""
|
||||||
self.clients.insert(index, weakref.ref(client))
|
self.clients.insert(index, weakref.ref(client))
|
||||||
log.info("Added: client %s", client)
|
log.info("Added: client %s", client)
|
||||||
|
|
||||||
def removeClient(self, client):
|
def removeClient(self, client):
|
||||||
"""
|
"""
|
||||||
:type client: IChunkLoaderClient
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
client : IChunkLoaderClient
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self.clients[:] = [c for c in self.clients if c() is not client]
|
self.clients[:] = [c for c in self.clients if c() is not client]
|
||||||
|
@ -54,9 +54,11 @@ class SceneUpdateTask(object):
|
|||||||
def __init__(self, worldScene, textureAtlas):
|
def __init__(self, worldScene, textureAtlas):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
:type worldScene: WorldScene
|
Parameters
|
||||||
:type bounds: BoundingBox
|
----------
|
||||||
:type textureAtlas: TextureAtlas
|
|
||||||
|
worldScene : WorldScene
|
||||||
|
textureAtlas : TextureAtlas
|
||||||
"""
|
"""
|
||||||
self.worldScene = worldScene
|
self.worldScene = worldScene
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'''
|
"""
|
||||||
Base classes for all Minecraft levels.
|
Classes used in implementing adapters for worlds physically stored as a single array.
|
||||||
'''
|
Slices of this array are presented as virtual chunks.
|
||||||
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
@ -95,7 +96,8 @@ class FakeChunkData(object):
|
|||||||
|
|
||||||
|
|
||||||
class FakeChunkedLevelAdapter(object):
|
class FakeChunkedLevelAdapter(object):
|
||||||
""" FakeChunkedLevelAdapter is an abstract class for implementing fixed size, non-chunked storage formats.
|
"""
|
||||||
|
FakeChunkedLevelAdapter is an abstract class for implementing fixed size, non-chunked storage formats.
|
||||||
Classic, Indev, and Schematic formats inherit from this class. FakeChunkedLevelAdapter has dummy functions for
|
Classic, Indev, and Schematic formats inherit from this class. FakeChunkedLevelAdapter has dummy functions for
|
||||||
pretending to have Players, Entities and TileEntities. If Entities and TileEntities already present, provides
|
pretending to have Players, Entities and TileEntities. If Entities and TileEntities already present, provides
|
||||||
a working `getEntities` and `getTileEntities`.
|
a working `getEntities` and `getTileEntities`.
|
||||||
@ -105,22 +107,21 @@ class FakeChunkedLevelAdapter(object):
|
|||||||
|
|
||||||
FakeChunkedLevelAdapter implements IWorld and ISectionWorld.
|
FakeChunkedLevelAdapter implements IWorld and ISectionWorld.
|
||||||
|
|
||||||
Required attributes:
|
Attributes
|
||||||
|
----------
|
||||||
|
|
||||||
:ivar Height: int
|
Height : int
|
||||||
:ivar Length: int
|
Length : int
|
||||||
:ivar Width: int
|
Width : int
|
||||||
:ivar Blocks: ndarray of any shape, indexed [x, z, y]
|
Blocks : ndarray of any shape, indexed [x, z, y]
|
||||||
:ivar blocktypes: BlockTypeSet
|
blocktypes : BlockTypeSet
|
||||||
|
|
||||||
Optional attributes:
|
Entities : list or TAG_List
|
||||||
|
TileEntities : list or TAG_List
|
||||||
:ivar Entities: list or TAG_List
|
Data : ndarray, same shape and indexes as Blocks
|
||||||
:ivar TileEntities: list or TAG_List
|
BlockLight : ndarray, same shape and indexes as Blocks
|
||||||
:ivar Data: ndarray, same shape and indexes as Blocks
|
SkyLight : ndarray, same shape and indexes as Blocks
|
||||||
:ivar BlockLight: ndarray, same shape and indexes as Blocks
|
Biomes : ndarray, same x and z sizes as Blocks, indexed [x, z]
|
||||||
:ivar SkyLight: ndarray, same shape and indexes as Blocks
|
|
||||||
:ivar Biomes: ndarray, same x and z sizes as Blocks, indexed [x, z]
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user