# Path: conjureup/errors.py
# class MessageException(Exception):
# class BootstrapError(Exception):
# class BootstrapInterrupt(BootstrapError):
# class ControllerNotFoundException(Exception):
# class DeploymentFailure(Exception):
# class JujuBinaryNotFound(Exception):
# class AppConfigAttributeError(Exception):
# class MAASConfigError(Exception):
# class SchemaError(MessageException):
# class SchemaCloudError(SchemaError):
# class SchemaCredentialError(SchemaError):
# class LXDError(MessageException):
# class LXDBinaryNotFoundError(LXDError):
# class LXDCompatibilityError(LXDError):
# class LXDParseError(LXDCompatibilityError):
# class LXDNetworkError(LXDError):
# class LXDStorageError(LXDError):
#     def __init__(self, *args, **kwargs):
# 
# Path: conjureup/ui/widgets/selectors.py
# class RadioList(SelectList):
#     option_type = ValuedRadioButton
#     allow_multiple = False
# 
#     def __init__(self, *args, **kwargs):
#         self.group = []
#         super().__init__(*args, **kwargs)
# 
#     def _create_option(self, label, value):
#         return self.option_type(self.group, label, value)
# 
#     def select_first_option(self):
#         """
#         Select the first option.
#         """
#         for item in self.contents:
#             if isinstance(item, self.option_type):
#                 item.set_state(True)
#                 break
# 
#     def select_option(self, value):
#         """
#         Select an option by value.
#         """
#         for item in self.contents:
#             if isinstance(item, self.option_type):
#                 item.set_state(item.value == value)


from ubuntui.utils import Color
from ubuntui.widgets.hr import HR
from urwid import Columns, Text
from conjureup import errors
from conjureup.ui.views.base import BaseView
from conjureup.ui.widgets.selectors import RadioList



class LXDSetupView(BaseView):
    title = "LXD Configuration"
    subtitle = "Select a network bridge and storage pool for this deployment"

    def __init__(self, devices, submit_cb, back_cb):
        self.devices = devices
        self.submit_cb = submit_cb
        self.prev_screen = back_cb
        self.lxd_config = {
            'network': RadioList(self.devices['networks'].keys()),

# Path: conjureup/errors.py
# class MessageException(Exception):
# class BootstrapError(Exception):
# class BootstrapInterrupt(BootstrapError):
# class ControllerNotFoundException(Exception):
# class DeploymentFailure(Exception):
# class JujuBinaryNotFound(Exception):
# class AppConfigAttributeError(Exception):
# class MAASConfigError(Exception):
# class SchemaError(MessageException):
# class SchemaCloudError(SchemaError):
# class SchemaCredentialError(SchemaError):
# class LXDError(MessageException):
# class LXDBinaryNotFoundError(LXDError):
# class LXDCompatibilityError(LXDError):
# class LXDParseError(LXDCompatibilityError):
# class LXDNetworkError(LXDError):
# class LXDStorageError(LXDError):
#     def __init__(self, *args, **kwargs):
# 
# Path: conjureup/ui/widgets/selectors.py
# class RadioList(SelectList):
#     option_type = ValuedRadioButton
#     allow_multiple = False
# 
#     def __init__(self, *args, **kwargs):
#         self.group = []
#         super().__init__(*args, **kwargs)
# 
#     def _create_option(self, label, value):
#         return self.option_type(self.group, label, value)
# 
#     def select_first_option(self):
#         """
#         Select the first option.
#         """
#         for item in self.contents:
#             if isinstance(item, self.option_type):
#                 item.set_state(True)
#                 break
# 
#     def select_option(self, value):
#         """
#         Select an option by value.
#         """
#         for item in self.contents:
#             if isinstance(item, self.option_type):
#                 item.set_state(item.value == value)


# Path: conjureup/ui/views/lxdsetup.py
from ubuntui.utils import Color
from ubuntui.widgets.hr import HR
from urwid import Columns, Text
from conjureup import errors
from conjureup.ui.views.base import BaseView
from conjureup.ui.widgets.selectors import RadioList




class LXDSetupView(BaseView):
    title = "LXD Configuration"
    subtitle = "Select a network bridge and storage pool for this deployment"

    def __init__(self, devices, submit_cb, back_cb):
        self.devices = devices
        self.submit_cb = submit_cb
        self.prev_screen = back_cb
        self.lxd_config = {
            'network': RadioList(self.devices['networks'].keys()),

            'storage-pool': RadioList(self.devices['storage-pools'].keys()),