Package pajammin :: Package util :: Module leveleditor :: Class EntityTool
[show private | hide private]
[frames | no frames]

Type EntityTool

     object --+    
              |    
LevelEditorTool --+
                  |
                 EntityTool

Known Subclasses:
AgentTool, AvatarTool, DecorationTool, EditorLabelTool, PlatformTool, SpaceTool, WallTool

A base class for tools that create and modify entities. By default:

Subclassing

Subclasses must define the following: Subclasses may optionally define the following:
Method Summary
  __init__(self, level, display, subtool_icons)
  activate(self)
Turn this tool on.
  add_entity(self, entity, select)
Add the given entity to the level, and mark it as applicable.
  deactivate(self)
Turn this tool off.
  delete_entity(self, entity)
  getinfo(self, entity)
  menu_Delete(self, entity)
  menu_Lower(self, entity)
  menu_Raise(self, entity)
  relevant(self, entity)
Return true if this tool should manipulate the given entity.
  select(self, entity)
  select_subtool(self, subtool)
Select the subtool corresponding to the given icon
  update_infobox(self)
  _clear_marks(self)
  _context_menu_select(self, choice)
  _delete(self, event)
  _entity_at(self, x, y)
Return the relevant entity at the given world position, if there is one; otherwise, return None.
  _init_context_menu(self)
  _init_infobox(self)
  _init_listeners(self)
  _init_markers(self)
  _lclick(self, event)
  _ldrag(self, event)
  _mark(self, entity)
  _rpress(self, event)
  _start_ldrag(self, event)
  _start_listeners(self)
  _stop_ldrag(self, event)
  _stop_listeners(self)
  _togglemarks(self, event)
  _unmark(self, entity)
    Mouse Event Handerls
  click_entity(self, entity, x, y)
Called when the user clicks the left mouse button on an entity; by default, this method selects the entity.
  click_space(self, x, y)
Called when the user clicks the left mouse button on an empty area; by default, this creates a new entity.
  start_drag_entity(self, entity, x, y)
Called when the user starts dragging an entity with the left mouse button; by default, this does nothing.
  drag_entity(self, entity, oldx, oldy, newx, newy)
Called when the user drags an entity with the left mouse button; by default, this moves the entity.
  stop_drag_entity(self, entity, x, y)
Called when the user finishes dragging an entity with the left mouse button; by default, this does nothing.
  start_drag_space(self, x, y)
Called when the user starts dragging in empty space with the left mouse button; by default, this creates a new entity and selects it.
  drag_space(self, oldx, oldy, newx, newy)
Called when the user drags in empty space with the left moues button; by default this moves the newly created entity.
  stop_drag_space(self, x, y)
Called when the user finishes dragging in empty space with the left mouse button; by default, this does nothing.
    Inherited from LevelEditorTool
  set_level(self, level)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
Return repr(x)...
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Instance Variable Summary
  selection: The currently selected entity, or None if no entity is selected
  _context_menu: A pop-up menu widget, for manipulating the currently selected entity.
  _dragged_entity: When the user is dragging an entity, this points to that entity; otherwise, it is None.
  _infobox: A textbox widget, for displaying information about the currently selected entity.
  _listeners: Mouse input delegators.
  _relevant_mark: A dictionary containing marker shapes that are used to highlight entities that are relevant to this tool.
  _selection_mark: A marker shape that is used to highlight the currently selected entity.
    Inherited from LevelEditorTool
NoneType shortcut: The keyboard shortcut for this tool, or None if this tool doesn't have a keyboard shortcut.

Class Variable Summary
NoneType entity_factories: A list of entity constructors or factory functions, which take (x,y) as input and return a new entity.
  entity_factory: The currently selected entity factory function.
bool hide_body_markers = True

Method Details

click_entity(self, entity, x, y)

Called when the user clicks the left mouse button on an entity; by default, this method selects the entity.

click_space(self, x, y)

Called when the user clicks the left mouse button on an empty area; by default, this creates a new entity.

start_drag_entity(self, entity, x, y)

Called when the user starts dragging an entity with the left mouse button; by default, this does nothing.

drag_entity(self, entity, oldx, oldy, newx, newy)

Called when the user drags an entity with the left mouse button; by default, this moves the entity.

stop_drag_entity(self, entity, x, y)

Called when the user finishes dragging an entity with the left mouse button; by default, this does nothing.

start_drag_space(self, x, y)

Called when the user starts dragging in empty space with the left mouse button; by default, this creates a new entity and selects it.

drag_space(self, oldx, oldy, newx, newy)

Called when the user drags in empty space with the left moues button; by default this moves the newly created entity.

stop_drag_space(self, x, y)

Called when the user finishes dragging in empty space with the left mouse button; by default, this does nothing.

__init__(self, level, display, subtool_icons)
(Constructor)

Overrides:
pajammin.util.leveleditor.LevelEditorTool.__init__

activate(self)

Turn this tool on.
Overrides:
pajammin.util.leveleditor.LevelEditorTool.activate (inherited documentation)

add_entity(self, entity, select=True)

Add the given entity to the level, and mark it as applicable. If select is true, then select the new entity.

deactivate(self)

Turn this tool off.
Overrides:
pajammin.util.leveleditor.LevelEditorTool.deactivate (inherited documentation)

delete_entity(self, entity)

getinfo(self, entity)

menu_Delete(self, entity)

menu_Lower(self, entity)

menu_Raise(self, entity)

relevant(self, entity)

Return true if this tool should manipulate the given entity.

select(self, entity)

select_subtool(self, subtool)

Select the subtool corresponding to the given icon
Overrides:
pajammin.util.leveleditor.LevelEditorTool.select_subtool (inherited documentation)

update_infobox(self)

_clear_marks(self)

_context_menu_select(self, choice)

_delete(self, event)

_entity_at(self, x, y)

Return the relevant entity at the given world position, if there is one; otherwise, return None.

_init_context_menu(self)

_init_infobox(self)

_init_listeners(self)

_init_markers(self)

_lclick(self, event)

_ldrag(self, event)

_mark(self, entity)

_rpress(self, event)

_start_ldrag(self, event)

_start_listeners(self)

_stop_ldrag(self, event)

_stop_listeners(self)

_togglemarks(self, event)

_unmark(self, entity)


Instance Variable Details

selection

The currently selected entity, or None if no entity is selected

_context_menu

A pop-up menu widget, for manipulating the currently selected entity.

_dragged_entity

When the user is dragging an entity, this points to that entity; otherwise, it is None.

_infobox

A textbox widget, for displaying information about the currently selected entity.

_listeners

Mouse input delegators.

_relevant_mark

A dictionary containing marker shapes that are used to highlight entities that are relevant to this tool. The dictionary maps from entities to makers.

_selection_mark

A marker shape that is used to highlight the currently selected entity.

Class Variable Details

entity_factories

A list of entity constructors or factory functions, which take (x,y) as input and return a new entity.
Type:
NoneType
Value:
None                                                                  

entity_factory

The currently selected entity factory function.

hide_body_markers

Type:
bool
Value:
True