source: branches/active/character_customization/game/parpg/common/listeners/command_listener.py @ 797

Revision 736, 1.4 KB checked in by aspidites, 9 years ago (diff)

Patch by Aspidites:

  • renamed scripts package to parpg
  • renamed parpg module to application
  • removed packaging and other related files (kept locally for reference, will reintroduce similar scripts to resolve bug #275
  • updated all import statements to respect changes above
  • Property svn:eol-style set to native
Line 
1#!/usr/bin/env python
2#   This file is part of PARPG.
3
4#   PARPG is free software: you can redistribute it and/or modify
5#   it under the terms of the GNU General Public License as published by
6#   the Free Software Foundation, either version 3 of the License, or
7#   (at your option) any later version.
8
9#   PARPG is distributed in the hope that it will be useful,
10#   but WITHOUT ANY WARRANTY; without even the implied warranty of
11#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12#   GNU General Public License for more details.
13
14#   You should have received a copy of the GNU General Public License
15#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
16
17"""This module contains the CommandListener class for receiving command events"""
18
19
20class CommandListener(object):
21    """Base class for listeners that receiving command events"""
22
23    def __init__(self, event_listener):
24        self.event_listener = None
25        CommandListener.attach(self, event_listener)
26   
27    def attach(self, event_listener):
28        """Attaches the listener to the event"""
29        event_listener.addListener("Command", self)
30        self.event_listener = event_listener
31       
32    def detach(self):
33        """Detaches the listener from the event"""
34        self.event_listener.removeListener("Command", self)
35        self.event_listener = None
36
37    def onCommand(self, command):
38        """Called when a command is executed"""
39        pass
Note: See TracBrowser for help on using the repository browser.