# Path: base/scene.py
# class BaseScene(object):
#     """Abstract class for all scenes"""
#     __metaclass__ = abc.ABCMeta
# 
#     def __init__(self, console_manager, scene_manager, game_context):
#         self.console_manager = console_manager
#         self.main_console = console_manager.main_console
#         self.scene_manager = scene_manager
#         self.game_context = game_context
# 
#     @abc.abstractmethod
#     def render(self):
#         pass
# 
#     @abc.abstractmethod
#     def handle_input(self):
#         pass
# 
#     def transition_to(self, scene_name):
#         self.scene_manager.transition_to(scene_name)
# 
# Path: managers/console_manager.py
# class Menu(Console):
#     """
#     Create console for displaying choices to the player
#     """
#     MENU_TEMPLATE = """
#         {menu_name}
#         {menu_text}
#         {options}
#     """
# 
#     OPTION_TEMPLATE = "({option_char:}) {option_description}"
# 
#     def __init__(self, name, text, options, width, height):
#         Console.__init__(self, width, height)
#         self.name = name
#         self.text = text
#         self.options = options
#         self.max_options_len = 26
#         self.letter_index = ord('a')
# 
#     def create_menu(self, pos_x, pos_y):
#         self.move(pos_x, pos_y)
#         self.printStr(self.MENU_TEMPLATE.format(
#             menu_name=self.name,
#             menu_text=self.text,
#             options=self._build_options()
#         ))
# 
#     def _build_options(self):
#         option_msg = []
#         for option_text in self.options:
#             option = self.OPTION_TEMPLATE.format(
#                 option_char=chr(self.letter_index),
#                 option_description=option_text
#             )
#             option_msg.append(option)
#             self.letter_index += 1
#         return "\n".join(option_msg)
# 
#     def print_str(self, text, pos_x, pos_y):
#         self.move(pos_x, pos_y)
#         self.printStr(text)
# 
# Path: ui/controls.py
# ACTIVE_CONTROL_COLOR = (255, 255, 0)
# INACTIVE_CONTROL_COLOR = (255, 255, 255)
# CHOSEN_CONTROL_COLOR = (100, 255, 100)
# BLACK_COLOR = (0, 0, 0)
# class InputControl(object):
# class ListChoiceControl(object):
# class PointDistributionControl(object):
#     def __init__(self, question):
#     def handle_input(self, **kwargs):
#     def text(self):
#     def render(self, console, active, **kwargs):
#     def __init__(self, question, options, root_console):
#     def __assign_letter(self):
#     def text(self):
#     def _get_formatted_options(self):
#     def handle_input(self, **kwargs):
#     def render(self, console, active, **kwargs):
#     def __init__(self, question, options, root_console, initial_value, max_value, total_points, cost_calculator):
#     def text(self):
#     def answer(self):
#     def _get_formatted_options(self):
#     def handle_input(self, **kwargs):
#     def render(self, console, active, **kwargs):
#     def __increase_value(self):
#     def __decrease_value(self):
#     def __cycle_next_option(self):
#     def __cycle_previous_option(self):


import math
import logging
import tdl
from base.scene import BaseScene
from managers.console_manager import Menu
from ui import controls
                window.handle_input(**kwargs)

            if self.active_window == self.windows.index(self.item_list_window):
                if self.item_list_window.chosen_item is not None:
                    self.item_detail_window.build(self.item_list_window.chosen_item)
                    self.active_window = self.windows.index(self.item_detail_window)


class ItemListWindow(object):
    def __init__(self, main_console):
        self.main_console = main_console
        self.window = tdl.Window(
            self.main_console, 0, 0,
            width=int(math.floor(self.main_console.width / 2)),
            height=self.main_console.height
        )
        self.wielded_items_control = None
        self.worn_items_control = None
        self.inventory_items_control = None
        self.chosen_item = None

    def build(self, player):
        # TODO Not sure how often this should be rebuilt but at least every time the menu is opened
        # TODO and another every removed item
        if player and player.equipment:
            self.wielded_items_control = controls.ListChoiceControl(
                "Wielded Items:",
                player.equipment.get_wielded_items(),
                self.window
            )

# Path: base/scene.py
# class BaseScene(object):
#     """Abstract class for all scenes"""
#     __metaclass__ = abc.ABCMeta
# 
#     def __init__(self, console_manager, scene_manager, game_context):
#         self.console_manager = console_manager
#         self.main_console = console_manager.main_console
#         self.scene_manager = scene_manager
#         self.game_context = game_context
# 
#     @abc.abstractmethod
#     def render(self):
#         pass
# 
#     @abc.abstractmethod
#     def handle_input(self):
#         pass
# 
#     def transition_to(self, scene_name):
#         self.scene_manager.transition_to(scene_name)
# 
# Path: managers/console_manager.py
# class Menu(Console):
#     """
#     Create console for displaying choices to the player
#     """
#     MENU_TEMPLATE = """
#         {menu_name}
#         {menu_text}
#         {options}
#     """
# 
#     OPTION_TEMPLATE = "({option_char:}) {option_description}"
# 
#     def __init__(self, name, text, options, width, height):
#         Console.__init__(self, width, height)
#         self.name = name
#         self.text = text
#         self.options = options
#         self.max_options_len = 26
#         self.letter_index = ord('a')
# 
#     def create_menu(self, pos_x, pos_y):
#         self.move(pos_x, pos_y)
#         self.printStr(self.MENU_TEMPLATE.format(
#             menu_name=self.name,
#             menu_text=self.text,
#             options=self._build_options()
#         ))
# 
#     def _build_options(self):
#         option_msg = []
#         for option_text in self.options:
#             option = self.OPTION_TEMPLATE.format(
#                 option_char=chr(self.letter_index),
#                 option_description=option_text
#             )
#             option_msg.append(option)
#             self.letter_index += 1
#         return "\n".join(option_msg)
# 
#     def print_str(self, text, pos_x, pos_y):
#         self.move(pos_x, pos_y)
#         self.printStr(text)
# 
# Path: ui/controls.py
# ACTIVE_CONTROL_COLOR = (255, 255, 0)
# INACTIVE_CONTROL_COLOR = (255, 255, 255)
# CHOSEN_CONTROL_COLOR = (100, 255, 100)
# BLACK_COLOR = (0, 0, 0)
# class InputControl(object):
# class ListChoiceControl(object):
# class PointDistributionControl(object):
#     def __init__(self, question):
#     def handle_input(self, **kwargs):
#     def text(self):
#     def render(self, console, active, **kwargs):
#     def __init__(self, question, options, root_console):
#     def __assign_letter(self):
#     def text(self):
#     def _get_formatted_options(self):
#     def handle_input(self, **kwargs):
#     def render(self, console, active, **kwargs):
#     def __init__(self, question, options, root_console, initial_value, max_value, total_points, cost_calculator):
#     def text(self):
#     def answer(self):
#     def _get_formatted_options(self):
#     def handle_input(self, **kwargs):
#     def render(self, console, active, **kwargs):
#     def __increase_value(self):
#     def __decrease_value(self):
#     def __cycle_next_option(self):
#     def __cycle_previous_option(self):


# Path: scenes/inventory.py
import math
import logging
import tdl
from base.scene import BaseScene
from managers.console_manager import Menu
from ui import controls

                window.handle_input(**kwargs)

            if self.active_window == self.windows.index(self.item_list_window):
                if self.item_list_window.chosen_item is not None:
                    self.item_detail_window.build(self.item_list_window.chosen_item)
                    self.active_window = self.windows.index(self.item_detail_window)


class ItemListWindow(object):
    def __init__(self, main_console):
        self.main_console = main_console
        self.window = tdl.Window(
            self.main_console, 0, 0,
            width=int(math.floor(self.main_console.width / 2)),
            height=self.main_console.height
        )
        self.wielded_items_control = None
        self.worn_items_control = None
        self.inventory_items_control = None
        self.chosen_item = None

    def build(self, player):
        # TODO Not sure how often this should be rebuilt but at least every time the menu is opened
        # TODO and another every removed item
        if player and player.equipment:
            self.wielded_items_control = controls.ListChoiceControl(
                "Wielded Items:",
                player.equipment.get_wielded_items(),
                self.window
            )

            self.worn_items_control = controls.ListChoiceControl(