Exemplo n.º 1
0
def view_type_settings_validator(key, value, argument_name=None):
    key_argument_name = ('Key - {0}[{1}]'.format(argument_name, key)
                         if argument_name else 'Key \'{0}\''.format(key))

    value_argument_name = ('{0}[{1}]'.format(argument_name, key)
                           if argument_name else
                           'Value for Key \'{0}\''.format(key))

    assert_in(key, VISUALIZATION_TYPE_VALUES, key_argument_name)
    assert_type(value, SettingsGroup, value_argument_name)
class HeatMapSettings(PythonModel):
    @classmethod
    def registry(cls):
        return HeatMapProperty

    @property
    @HeatMapProperty.getter(
        nullable=False,
        default_value=DEFAULT_SELECTED_FIELD,
        value_validate_function=lambda value: assert_string(
            value, 'selected_field'),
    )
    def selected_field(self):
        return self.get('selectedField')

    @selected_field.setter
    @HeatMapProperty.setter()
    def selected_field(self, value):
        self['selectedField'] = value

    @property
    @HeatMapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_BASE_LAYER,
        value_validate_function=lambda value: assert_in(
            value, BASE_LAYERS, 'base_layer'),
    )
    def base_layer(self):
        return self.get('baseLayer')

    @base_layer.setter
    @HeatMapProperty.setter()
    def base_layer(self, value):
        self['baseLayer'] = value
class MapSettings(PythonModel):
    @classmethod
    def registry(cls):
        return MapProperty

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_BASE_LAYER,
        value_validate_function=lambda value: assert_in(
            value, BASE_LAYERS, 'base_layer'),
    )
    def base_layer(self):
        return self.get('baseLayer')

    @base_layer.setter
    @MapProperty.setter()
    def base_layer(self, value):
        self['baseLayer'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_CURRENT_DISPLAY,
        value_validate_function=lambda value: assert_string(
            value, 'current_display'),
    )
    def current_display(self):
        return self.get('currentDisplay')

    @current_display.setter
    @MapProperty.setter()
    def current_display(self, value):
        self['currentDisplay'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_CENTER,
        value_validate_function=lambda value: assert_map_coordinates(
            value, 'map_center'),
    )
    def map_center(self):
        return self.get('mapCenter')

    @map_center.setter
    @MapProperty.setter()
    def map_center(self, value):
        self['mapCenter'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_OVERLAY_LAYERS,
        value_validate_function=lambda value: assert_overlay_layers(
            value, 'overlay_layers'),
    )
    def overlay_layers(self):
        return self.get('overlayLayers')

    @overlay_layers.setter
    @MapProperty.setter()
    def overlay_layers(self, value):
        self['overlayLayers'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_SELECTED_FIELD,
        value_validate_function=lambda value: assert_string(
            value, 'selected_field'),
    )
    def selected_field(self):
        return self.get('selectedField')

    @selected_field.setter
    @MapProperty.setter()
    def selected_field(self, value):
        self['selectedField'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        value_validate_function=lambda value: assert_string(
            value, 'selected_geo_tiles'),
    )
    def selected_geo_tiles(self):
        return self.get('selectedGeoTiles')

    @selected_geo_tiles.setter
    @MapProperty.setter()
    def selected_geo_tiles(self, value):
        self['selectedGeoTiles'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_ZOOM_LEVEL,
        value_validate_function=lambda value: assert_float(
            value, 'zoom_level'),
    )
    def zoom_level(self):
        return self.get('zoomLevel')

    @zoom_level.setter
    @MapProperty.setter(value_parser_function=float)
    def zoom_level(self, value):
        self['zoomLevel'] = value

    @property
    @MapProperty.getter(
        'showAdminBoundaries',
        nullable=False,
        default_value=DEFAULT_MAP_SHOW_ADMINISTRATIVE_BOUNDARIES,
        value_validate_function=lambda value: assert_boolean(
            value, 'show_administrative_boundaries'),
    )
    def show_administrative_boundaries(self):
        return self.get('showAdminBoundaries')

    @show_administrative_boundaries.setter
    @MapProperty.setter()
    def show_administrative_boundaries(self, value):
        self['showAdminBoundaries'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_SHOW_LABELS,
        value_validate_function=lambda value: assert_boolean(
            value, 'show_labels'),
    )
    def show_labels(self):
        return self.get('showLabels')

    @show_labels.setter
    @MapProperty.setter()
    def show_labels(self, value):
        self['showLabels'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_TOOLTIP_BACKGROUND,
        value_validate_function=lambda value: True,
    )
    def tooltip_background_color(self):
        return self.get('tooltipBackgroundColor')

    @tooltip_background_color.setter
    @MapProperty.setter()
    def tooltip_background_color(self, value):
        self['tooltipBackgroundColor'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_TOOLTIP_FONT_COLOR,
        value_validate_function=lambda value: assert_string(
            value, 'tooltip_font_color'),
    )
    def tooltip_font_color(self):
        return self.get('tooltipFontColor')

    @tooltip_font_color.setter
    @MapProperty.setter()
    def tooltip_font_color(self, value):
        self['tooltipFontColor'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_TOOLTIP_FONT,
        value_validate_function=lambda value: assert_string(
            value, 'tooltip_font_family'),
    )
    def tooltip_font_family(self):
        return self.get('tooltipFontFamily')

    @tooltip_font_family.setter
    @MapProperty.setter()
    def tooltip_font_family(self, value):
        self['tooltipFontFamily'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_TOOLTIP_FONT_SIZE,
        value_validate_function=lambda value: assert_string(
            value, 'tooltip_font_size'),
    )
    def tooltip_font_size(self):
        return self.get('tooltipFontSize')

    @tooltip_font_size.setter
    @MapProperty.setter()
    def tooltip_font_size(self, value):
        self['tooltipFontSize'] = value

    @property
    @MapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_TOOLTIP_BOLD,
        value_validate_function=lambda value: assert_boolean(
            value, 'tooltip_bold'),
    )
    def tooltip_bold(self):
        return self.get('tooltipBold')

    @tooltip_bold.setter
    @MapProperty.setter()
    def tooltip_bold(self, value):
        self['tooltipBold'] = value
class AnimatedMapSettings(PythonModel):
    @classmethod
    def registry(cls):
        return AnimatedMapProperty

    @property
    @AnimatedMapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_BASE_LAYER,
        value_validate_function=lambda value: assert_in(
            value, BASE_LAYERS, 'base_layer'),
    )
    def base_layer(self):
        return self.get('baseLayer')

    @base_layer.setter
    @AnimatedMapProperty.setter()
    def base_layer(self, value):
        self['baseLayer'] = value

    @property
    @AnimatedMapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_CURRENT_DISPLAY,
        value_validate_function=lambda value: assert_string(
            value, 'current_display'),
    )
    def current_display(self):
        return self.get('currentDisplay')

    @current_display.setter
    @AnimatedMapProperty.setter()
    def current_display(self, value):
        self['currentDisplay'] = value

    @property
    @AnimatedMapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_CENTER,
        value_validate_function=lambda value: assert_map_coordinates(
            value, 'map_center'),
    )
    def map_center(self):
        return self.get('mapCenter')

    @map_center.setter
    @AnimatedMapProperty.setter()
    def map_center(self, value):
        self['mapCenter'] = value

    @property
    @AnimatedMapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_OVERLAY_LAYERS,
        value_validate_function=lambda value: assert_overlay_layers(
            value, 'overlay_layers'),
    )
    def overlay_layers(self):
        return self.get('overlayLayers')

    @overlay_layers.setter
    @AnimatedMapProperty.setter()
    def overlay_layers(self, value):
        self['overlayLayers'] = value

    @property
    @AnimatedMapProperty.getter(
        nullable=False,
        default_value=DEFAULT_SELECTED_FIELD,
        value_validate_function=lambda value: assert_string(
            value, 'selected_field'),
    )
    def selected_field(self):
        return self.get('selectedField')

    @selected_field.setter
    @AnimatedMapProperty.setter()
    def selected_field(self, value):
        self['selectedField'] = value

    @property
    @AnimatedMapProperty.getter(
        nullable=False,
        value_validate_function=lambda value: assert_string(
            value, 'selected_geo_tiles'),
    )
    def selected_geo_tiles(self):
        return self.get('selectedGeoTiles')

    @selected_geo_tiles.setter
    @AnimatedMapProperty.setter()
    def selected_geo_tiles(self, value):
        self['selectedGeoTiles'] = value

    @property
    @AnimatedMapProperty.getter(
        nullable=False,
        default_value=DEFAULT_MAP_ZOOM_LEVEL,
        value_validate_function=lambda value: assert_float(
            value, 'zoom_level'),
    )
    def zoom_level(self):
        return self.get('zoomLevel')

    @zoom_level.setter
    @AnimatedMapProperty.setter(value_parser_function=float)
    def zoom_level(self, value):
        self['zoomLevel'] = value