Docstrings for UIs.
[realism.git] / ui / ui.py
blob9394be810276037580888fd72d6e8950a0e6b68e
1 # This file is part of Realism, which is Copyright FunnyMan3595 (Charlie Nolan)
2 # and licensed under the GNU GPL v3. For more details, see LICENSE in the main
3 # Realism directory.
5 '''Holds the generic user interface, UI.'''
7 class NotImplementedException(Exception): pass
9 class UI(object):
10 '''The generic user interface.'''
11 class_name = "Generic UI"
13 def ni(self, function = None):
14 '''Throws a "not implemented" exception. If function name is provided, it is included in the exception.'''
15 if function:
16 raise NotImplementedException(function + " is not implemented by " + self.class_name)
17 raise NotImplementedException("This function is not implemented by " + self.class_name)
19 def __init__(self):
20 '''Initializes the user interface.'''
21 self.ni('__init__')
23 def main_loop(self):
24 '''Invokes the main control loop.'''
25 self.ni('main_loop')
27 def map_mode(self, map):
28 '''Puts the UI in map mode.'''
29 self.ni('map_mode')
31 def shop_mode(self, shop):
32 '''Puts the UI in shop mode.'''
33 self.ni('shop_mode')
35 def battle_mode(self, battle):
36 '''Puts the UI in battle mode.'''
37 self.ni('battle_mode')
39 def conversation_mode(self, conversation):
40 '''Puts the UI in conversation mode.'''
41 self.ni('conversation_mode')
43 def hp_tick(self, character, amount):
44 '''Reports a gain in health.'''
45 self.ni('hp_tick')
47 def mp_tick(self, character, amount):
48 '''Reports a gain in mana.'''
49 self.ni('mp_tick')
51 def gained_ability_level(self, character, ability):
52 '''Reports an ability level gain.'''
53 self.ni('gained_ability_level')
55 def gained_level(self, character):
56 '''Reports a level gain.'''
57 self.ni('gained_level')
59 def won_battle(self):
60 '''Returns the UI to the map after winning a battle.'''
61 self.ni('won_battle')