Changeset 233:8ea658969f47


Ignore:
Timestamp:
04/07/11 09:05:31 (12 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Message:

Fix on_entry and on_exit handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/dialogue.py

    r217 r233  
    9999                                    "<%s>" % ":".join(base_path + ["on_entry"]),
    100100                                    "exec")
     101        else:
     102            self.on_entry = None
    101103
    102104        on_exit = state_src.get("on_exit", None)
     
    105107                                   "<%s>" % ":".join(base_path + ["on_exit"]),
    106108                                   "exec")
     109        else:
     110            self.on_exit = None
    107111
    108112    def __repr__(self):
     
    116120
    117121    def enter(self, my_locals):
    118         self.on_entry(my_locals, {}, my_locals.copy())
     122        if self.on_entry is not None:
     123            exec(self.on_entry, {}, my_locals.copy())
    119124
    120125    def leave(self, my_locals):
    121         self.on_exit(my_locals, {}, my_locals.copy())
     126        if self.on_exit is not None:
     127            exec(self.on_exit, {}, my_locals.copy())
    122128
    123129
Note: See TracChangeset for help on using the changeset viewer.