Package horizons :: Package util :: Module worldobject :: Class WorldObject
[hide private]
[frames] | no frames]

Class WorldObject

source code

changelistener.ChangeListener --+
                                |
                               WorldObject

Gives every instance a unique id.

Instance Methods [hide private]
 
__init__(self, worldid=None, **kwargs) source code
 
__init(self, worldid=None) source code
 
save(self, db) source code
 
load(self, db, worldid) source code
 
remove(self) source code
 
__lt__(self, other) source code
    Inherited from changelistener.ChangeListener
 
_changed(self)
Calls every listener when an object changed
source code
 
add_change_listener(self, listener, call_listener_now=False, no_duplicates=False) source code
 
add_remove_listener(self, listener, no_duplicates=False)
A listener that listens for removal of the object
source code
 
clear_change_listeners(self)
Removes all change listeners
source code
 
discard_change_listener(self, listener)
Remove listener if it's there
source code
 
discard_remove_listener(self, listener) source code
 
end(self) source code
 
has_change_listener(self, listener) source code
 
has_remove_listener(self, listener) source code
 
remove_change_listener(self, listener) source code
 
remove_remove_listener(self, listener) source code
Class Methods [hide private]
 
get_object_by_id(cls, id)
Returns the worldobject with id id Throws WorldObjectNotFound with the worldid as arg.
source code
 
reset(cls) source code
 
get_objs(cls) source code
Class Variables [hide private]
  __next_id = 1
  __objects = weakref.WeakValueDictionary()
  log = logging.getLogger("util.worldobject")
Method Details [hide private]

__init__(self, worldid=None, **kwargs)
(Constructor)

source code 
Parameters:
  • worldid - worldid to assign. Use None to get an autogenerated one.
Overrides: changelistener.ChangeListener.__init__

load(self, db, worldid)

source code 
Overrides: changelistener.ChangeListener.load

remove(self)

source code 
Overrides: changelistener.ChangeListener.remove