# Path: conjureup/ui/widgets/selectors.py
# class MenuSelectButtonList(SelectList):
#     option_type = ValuedMenuSelectButton
#     wrapable = True
# 
#     def __init__(self, opts=None, default=None, *args, **kwargs):
#         super().__init__(opts, *args, **kwargs)
#         if default:
#             self.select_item_by_value(default)
#         else:
#             self.select_first()


from collections import defaultdict
from ubuntui.utils import Color, Padding
from ubuntui.widgets.hr import HR
from urwid import Text
from conjureup.ui.views.base import BaseView
from conjureup.ui.widgets.selectors import MenuSelectButtonList




class ControllerListView(BaseView):
    title = 'Choose a Controller'
    subtitle = ('Please select an existing controller,'
                ' or choose to bootstrap a new one.')
    footer = ('The controller is what allows Juju to deploy and manage your '
              'models/spells.  With JaaS, the controller will be managed '
              'for you for free, so that you can focus on your applications '
              'and solutions. Alternatively, you can host and manage your own '
              'controller on the cloud to which you deploy.')
    footer_align = 'left'

    def __init__(self, app, controllers, submit_cb, back_cb):
        self.app = app
        self.submit_cb = submit_cb
        self.prev_screen = back_cb
        self.controllers = controllers
        self.config = self.app.config
        super().__init__()

    def build_widget(self):

# Path: conjureup/ui/widgets/selectors.py
# class MenuSelectButtonList(SelectList):
#     option_type = ValuedMenuSelectButton
#     wrapable = True
# 
#     def __init__(self, opts=None, default=None, *args, **kwargs):
#         super().__init__(opts, *args, **kwargs)
#         if default:
#             self.select_item_by_value(default)
#         else:
#             self.select_first()


# Path: conjureup/ui/views/ControllerListView.py
from collections import defaultdict
from ubuntui.utils import Color, Padding
from ubuntui.widgets.hr import HR
from urwid import Text
from conjureup.ui.views.base import BaseView
from conjureup.ui.widgets.selectors import MenuSelectButtonList





class ControllerListView(BaseView):
    title = 'Choose a Controller'
    subtitle = ('Please select an existing controller,'
                ' or choose to bootstrap a new one.')
    footer = ('The controller is what allows Juju to deploy and manage your '
              'models/spells.  With JaaS, the controller will be managed '
              'for you for free, so that you can focus on your applications '
              'and solutions. Alternatively, you can host and manage your own '
              'controller on the cloud to which you deploy.')
    footer_align = 'left'

    def __init__(self, app, controllers, submit_cb, back_cb):
        self.app = app
        self.submit_cb = submit_cb
        self.prev_screen = back_cb
        self.controllers = controllers
        self.config = self.app.config
        super().__init__()

    def build_widget(self):

        widget = MenuSelectButtonList()