示例#1
0
    def __init__(self, model):

        # create inputs
        radius_title = v.Html(tag="h4",
                              class_="mt-5",
                              children=[cm.input_lbl.self_ref])
        radius = v.Slider(
            class_="mt-5",
            label=cm.input_lbl.kernel_radius,
            max=cp.max_kernel_radius,
            step=10,
            v_model=model.kernel_radius,
            thumb_label="always",
        )
        ddr_title = v.Html(tag="h4", children=[cm.input_lbl.ddr])
        threshold = v.Slider(
            class_="mt-5",
            label=cm.input_lbl.filter_threshold,
            v_model=model.filter_threshod,
            step=0.001,
            max=0.1,
            thumb_label="always",
        )
        filtering_radius = v.Slider(
            class_="mt-5",
            label=cm.input_lbl.filter_radius,
            min=cp.min_radius_filtering_kernel,
            max=cp.max_radius_filtering_kernel,
            v_model=model.filter_radius,
            step=10,
            thumb_label="always",
        )
        cleaning = v.Slider(
            class_="mt-5",
            label=cm.input_lbl.disturbance_event,
            max=cp.max_disturbing_event_per_kernel,
            v_model=model.cleaning_offset,
            thumb_label="always",
        )

        # bind to the io object
        model.bind(radius,
                   "kernel_radius").bind(threshold, "filter_threshod").bind(
                       filtering_radius,
                       "filter_radius").bind(cleaning, "cleaning_offset")

        super().__init__(
            "nested_widget",
            cm.tile.fcdm,
            inputs=[
                radius_title,
                radius,
                ddr_title,
                threshold,
                filtering_radius,
                cleaning,
            ],
        )
示例#2
0
    def __init__(self, dates=None, **kwargs):

        # display the dates in a text filed in a the prepend slot
        self.display = v.Html(tag="span", children=[""])

        # create a range widget with the default params
        self.slider = v.Slider(class_="pl-5 pr-1 mt-1")

        # add the non conventional parameters for customization
        for k, val in kwargs.items():
            if hasattr(self.slider, k):
                setattr(self.slider, k, val)

        # wrap everything in a layout
        super().__init__(
            row=True,
            v_model=None,
            xs12=True,
            children=[
                v.Flex(xs10=True, children=[self.slider]),
                v.Flex(xs2=True, children=[self.display]),
            ],
        )

        # link the v_models
        self.slider.observe(self._on_change, "v_model")

        # add the real dates if existing
        if dates:
            self.set_dates(dates)
        else:
            self.disable()
示例#3
0
文件: mspa_tile.py 项目: vogtpet/gwb
    def __init__(self, io):

        # create the widgets
        connectivity = v.Select(label=cm.acc.connectivity,
                                items=cp.connectivity,
                                v_model=cp.connectivity[0]['value'])
        edge_width = v.Slider(label=cm.mspa.edge_width,
                              min=1,
                              max=30,
                              v_model=1)
        transition = v.Switch(label=cm.mspa.transition,
                              false_value=0,
                              true_value=1,
                              v_model=1)
        int_ext = v.Switch(label=cm.mspa.int_ext,
                           false_value=0,
                           true_value=1,
                           v_model=1)

        # bind to the io
        self.output = sw.Alert() \
            .bind(connectivity, io, 'connectivity') \
            .bind(edge_width, io, 'edge_width') \
            .bind(transition, io, 'transition') \
            .bind(int_ext, io, 'int_ext')

        super().__init__(
            io=io,
            inputs=[connectivity, edge_width, transition, int_ext],
            output=self.output)
示例#4
0
    def __init__(self, model):

        # no need to gather the io object as attribute as there are no custom methods

        # create the widgets
        self.forest_map = cw.CustomAssetSelect(label=cm.input_lbl.forest_map,
                                               v_model=model.forest_map,
                                               types=["IMAGE"])
        self.forest_map.default_asset = cp.forest_map

        # self.forest_map = v.Select(label=cm.input_lbl.forest_map, items=cp.forest_map, v_model=model.forest_map)
        self.year = v.Slider(
            class_="mt-5",
            label=cm.input_lbl.forest_map_year,
            min=cp.forest_map_min_year,
            max=cp.forest_map_max_year,
            v_model=model.forest_map_year,
            thumb_label="always",
        )
        self.tree_cover = v.Slider(
            class_="mt-5",
            label=cm.input_lbl.treecover,
            v_model=model.treecover,
            thumb_label="always",
        )

        # bind the inputs to the io through an alert
        model.bind(self.forest_map,
                   "forest_map").bind(self.year, "forest_map_year").bind(
                       self.tree_cover, "treecover")

        # create the tile
        super().__init__(
            "nested_widget",
            cm.tile.basemap,
            inputs=[self.forest_map, self.year, self.tree_cover],
        )

        # js behavior
        self.forest_map.observe(self._update_status, "v_model")
        model.observe(self._select_year, "reference_start")
示例#5
0
    def test_toggle_inputs(self):

        inputs = []
        for i in range(5):
            inputs.append(v.Slider())

        input_2_show = v.Slider()
        inputs.append(input_2_show)

        id_ = "id"
        title = "title"
        tile = sw.Tile(id_, title, inputs)

        res = tile.toggle_inputs([input_2_show], inputs)

        self.assertEqual(res, tile)

        for input_ in inputs:
            if input_ == input_2_show:
                self.assertNotIn('d-none', str(input_.class_).strip())
            else:
                self.assertIn('d-none', str(input_.class_).strip())

        return
示例#6
0
    def test_set_title(self):

        id_ = "id"
        title = "title"
        input_ = v.Slider()
        tile = sw.Tile(id_, title, [input_])

        title2 = "title2"
        res = tile.set_title(title2)

        self.assertEqual(res, tile)
        self.assertEqual(tile.children[0].children[0].children[0], title2)
        self.assertEqual(tile.children[0].children[1].children[0], input_)

        return
示例#7
0
    def test_set_content(self):

        id_ = "id"
        title = "title"
        tile = sw.Tile(id_, title, alert=sw.Alert(), btn=sw.Btn())

        input_ = v.Slider()

        res = tile.set_content([input_])

        self.assertEqual(res, tile)
        self.assertEqual(tile.children[0].children[0].children[0], title)
        self.assertEqual(tile.children[0].children[1].children[0], input_)

        return
示例#8
0
def make_widgets(country_large):

    tab1 = v.Tab(children=['New'], v_model='default')
    tab2 = v.Tab(children=['Total'], v_model='default')
    widgets = namedtuple(
        'Widget',
        ['chk_mov_ave', 'slider_mov_ave', 'sel_country', 'tab1', 'tab2'])(
            v.Checkbox(v_model='default', label='moving average'),
            v.Slider(min=2,
                     max=10,
                     class_='px-4',
                     v_model='default',
                     thumb_label=True,
                     ticks=True),
            v.Select(items=country_large, v_model='default'), tab1, tab2)
    return widgets
示例#9
0
 def __init__(self, model, aoi_model):
     
     #gather model inputs 
     self.model = model
     self.aoi_model = aoi_model
     
     # define widgets
     w_threshold = v.Slider(label= 'Threshold', class_="mt-5", thumb_label='always', v_model=30)
     
     # the btn and alert are created separately and linked after the call to super
     btn = sw.Btn('Update map', icon='mdi-check')
     alert = sw.Alert()
     
     # bind the widgets
     self.model.bind(w_threshold, 'threshold')
     
     # create a map
     self.m = sm.SepalMap()
     self.m.add_legend(legend_keys=cp.gfc_labels, legend_colors=cp.hex_palette, position='topleft') 
     
     # create a layout to display the map and the inputs side by side 
     w_inputs = v.Layout(
         row = True, 
         xs12 = True,
         children = [
             v.Flex(md6=True, children = [w_threshold, btn, alert]),
             v.Flex(md6=True, children = [self.m])
         ]
     )
     
     super().__init__(
         "gfc_map_tile",
         'GFC visualization',
         inputs = [w_inputs]
     )
     
     # rewire btn and alert 
     self.btn = btn 
     self.alert = alert
     
     # bind js events 
     self.btn.on_event('click', self._on_click)
示例#10
0
文件: mspa_tile.py 项目: 12rambau/gwb
    def __init__(self, model):

        # create the widgets
        connectivity = v.Select(
            label=cm.acc.connectivity,
            items=cp.connectivity,
            v_model=cp.connectivity[0]["value"],
        )
        edge_width = v.Slider(label=cm.mspa.edge_width,
                              min=1,
                              max=30,
                              v_model=1,
                              thumb_label=True)
        transition = v.Switch(label=cm.mspa.transition,
                              false_value=0,
                              true_value=1,
                              v_model=1)
        int_ext = v.Switch(label=cm.mspa.int_ext,
                           false_value=0,
                           true_value=1,
                           v_model=1)
        disk = v.Switch(label=cm.mspa.disk,
                        false_value=0,
                        true_value=1,
                        v_model=0)
        stats = v.Switch(label=cm.mspa.stats,
                         fals_value=0,
                         true_value=1,
                         v_model=0)

        # bind to the io
        (model.bind(connectivity, "connectivity").bind(
            edge_width, "edge_width").bind(transition, "transition").bind(
                int_ext, "int_ext").bind(disk,
                                         "disk").bind(stats, "statistics"))

        super().__init__(
            model=model,
            inputs=[
                connectivity, edge_width, transition, int_ext, disk, stats
            ],
        )
示例#11
0
    def __init__(self, model, aoi_model, result_tile, **kwargs):

        # define the model and the aoi_model as class attribute so that they can be manipulated in its custom methods
        self.model = model
        self.aoi_model = aoi_model

        # as I will display my results in another tile, I need to gather this extra tile in my attributes
        self.result_tile = result_tile

        # create all the widgets that you want to use in the tile
        # create the widgets following ipyvuetify lib requirements (more information in the ipyvuetify and sepal_ui doc)
        # if you want to use them in custom function you should consider adding them in the class attirbute
        self.slider = v.Slider(label=cm.default_process.slider,
                               class_="mt-5",
                               thumb_label=True,
                               v_model=0)

        self.text = v.TextField(label=cm.default_process.textfield,
                                v_model=None)

        # link the widgets to the model
        model \
            .bind(self.slider, 'slider_value') \
            .bind(self.text, 'text_value')

        # construct the Tile with the widget we have initialized
        super().__init__(
            id_=
            "default_viz_tile",  # the id will be used to make the Tile appear and disapear
            title=cm.default_process.
            title,  # the Title will be displayed on the top of the tile
            inputs=[self.slider, self.text],
            btn=sw.Btn(),
            alert=sw.Alert())

        # now that the Tile is created we can link it to a specific function
        self.btn.on_event('click', self._on_run)
示例#12
0
    def __init__(self):

        # init the downloadable informations
        self.geometry = None
        self.names = []
        self.datasets = {}

        # create the useful widgets
        self.w_scale = v.Slider(
            class_="mt-5",
            v_model=30,  # align on the landsat images,
            ticks="always",
            tick_labels=[
                str(i) if i in self.TICKS_TO_SHOW else ""
                for i in range(10, 301, 10)
            ],
            min=10,
            max=300,
            thumb_label=True,
            step=10,
        )

        self.w_prefix = v.TextField(
            label=cm.export.name,
            small=True,
            dense=True,
            v_model=None,
        )

        self.w_datasets = v.Select(
            dense=True,
            small=True,
            label=cm.export.datasets,
            v_model=None,
            items=[*self.datasets],
            multiple=True,
            chips=True,
        )

        self.w_method = v.RadioGroup(
            v_model="gee",
            row=True,
            children=[
                v.Radio(label=cm.export.radio.sepal, value="sepal"),
                v.Radio(label=cm.export.radio.gee, value="gee"),
            ],
        )

        self.alert = sw.Alert()

        self.btn = sw.Btn(cm.export.apply, small=True)

        export_data = v.Card(children=[
            v.CardTitle(
                children=[v.Html(tag="h4", children=[cm.export.title])]),
            v.CardText(children=[
                self.w_prefix,
                self.w_datasets,
                v.Html(tag="h4", children=[cm.export.scale]),
                self.w_scale,
                v.Html(tag="h4", children=[cm.export.radio.label]),
                self.w_method,
                self.alert,
            ]),
            v.CardActions(children=[self.btn]),
        ])

        # the clickable icon
        self.w_down = v.Btn(
            v_on="menu.on",
            color="primary",
            icon=True,
            children=[v.Icon(children=["mdi-cloud-download"])],
        )

        super().__init__(
            value=False,
            close_on_content_click=False,
            nudge_width=200,
            offset_x=True,
            children=[export_data],
            v_slots=[{
                "name": "activator",
                "variable": "menu",
                "children": self.w_down
            }],
        )

        # add js behaviour
        self.btn.on_event("click", self._apply)
示例#13
0
    def __init__(self):

        # create the different widgets
        # I will not use Io as the information doesn't need to be communicated to any other tile
        self.folder = cw.FolderSelect()
        self.out_dir = cw.OutDirSelect()
        self.tiles = cw.TilesSelect()
        self.poly = v.Select(label=cm.widget.harmonic.label,
                             v_model=3,
                             items=[i for i in range(3, 11)])
        self.freq = v.Slider(label=cm.widget.freq.label,
                             v_model=365,
                             min=1,
                             max=365,
                             thumb_label="always",
                             class_='mt-5')
        self.trend = v.Switch(v_model=False, label=cm.widget.trend.label)
        self.hfrac = v.Select(label=cm.widget.hfrac.label,
                              v_model=.25,
                              items=[.25, .5, 1.])
        self.level = v.Slider(label=cm.widget.level.label,
                              v_model=.95,
                              step=.001,
                              min=.95,
                              max=1,
                              thumb_label="always",
                              class_='mt-5')
        self.backend = cw.BackendSelect()
        self.monitoring = cw.DateRangeSlider(label=cm.widget.monitoring.label)
        self.history = cw.DateSlider(label=cm.widget.history.label)

        # stack the advance parameters in a expandpanel
        advance_params = v.ExpansionPanels(
            class_='mb-5',
            popout=True,
            children=[
                v.ExpansionPanel(children=[
                    v.ExpansionPanelHeader(
                        children=[cm.widget.advance_params]),
                    v.ExpansionPanelContent(children=[
                        v.Flex(xs12=True, children=[self.hfrac]),
                        v.Flex(xs12=True, children=[self.level]),
                        v.Flex(xs12=True, children=[self.backend])
                    ])
                ])
            ])

        # create the tile
        super().__init__(
            "bfast_tile",
            cm.bfast.
            folder,  # the title is used to describe the first section 
            inputs=[
                self.folder, self.out_dir, self.tiles,
                v.Html(tag="h2", children=[cm.bfast.process]), self.poly,
                self.freq, self.trend, advance_params,
                v.Html(tag="h2", children=[cm.bfast.periods]), self.history,
                self.monitoring
            ],
            output=cw.CustomAlert(),
            btn=sw.Btn(cm.bfast.btn))

        # add js behaviour
        self.folder.observe(self._on_folder_change, 'v_model')
        self.btn.on_event('click', self._start_process)
        self.monitoring.observe(self._check_periods, 'v_model')
        self.history.observe(self._check_periods, 'v_model')
示例#14
0
 def __init__(self, viz_model, tb_model):
     
     # gather model
     self.viz_model = viz_model
     self.tb_model = tb_model
     
     # Create alert
     
     self.alert = sw.Alert()
     
     # create the widgets
     self.driver = v.RadioGroup(
         label = cm.viz.driver,
         row= True,
         v_model = self.viz_model.driver,
         children = [
             v.Radio(key=i, label=n, value=n) for i, n 
             in enumerate(cp.drivers)
         ]
     )
     
     self.sources = v.Select(
         items=cp.sources, 
         label=cm.viz.sources, 
         v_model=self.viz_model.sources, 
         multiple=True,
         chips=True
     )
     
     self.planet_key = sw.PasswordField(
         label = cm.planet.key_label
     ).hide()
     
     self.semester = v.RadioGroup(
         label = cm.viz.semester,
         row= True,
         v_model = None,
         children = [
             v.Radio(label=cp.planet_semesters[n], value=n) for n
             in [*cp.planet_date_ranges[cp.planet_min_start_year]]
         ]
     )
     
     su.hide_component(self.semester)
     
     self.bands = v.Select(
         items=[*cp.getAvailableBands()], 
         label=cm.viz.bands, 
         v_model=self.viz_model.bands
     )
     self.start = v.Select(
         class_='mr-5 ml-5', 
         items=[
             y for y 
             in range(cp.gee_min_start_year, cp.gee_max_end_year+1)
         ], 
         label=cm.viz.start_year, 
         v_model=self.viz_model.start_year
     )
     self.end = v.Select(
         class_='ml-5 mr-5',
         items=[y for y 
                in range(cp.gee_min_start_year, cp.gee_max_end_year+1)
         ], 
         label=cm.viz.end_year, 
         v_model=self.viz_model.end_year
     )
     years = v.Layout(
         xs=12, 
         row=True,  
         children=[self.start, self.end]
     )
     
     image_size = v.Slider(
         step=500, 
         min=cp.min_image, 
         max=cp.max_image, 
         label=cm.viz.image_size, 
         v_model=self.viz_model.image_size, 
         thumb_label='always', 
         class_='mt-5'
     )
     
     square_size = v.Slider(
         step=10, 
         min=cp.min_square, 
         max=cp.max_square, 
         label=cm.viz.square_size, 
         v_model=self.viz_model.square_size, 
         thumb_label='always', 
         class_='mt-5'
     )
     
     
     # bind the inputs
     self.viz_model.bind(self.sources, 'sources') \
             .bind(self.planet_key, 'planet_key') \
             .bind(self.bands, 'bands') \
             .bind(self.start, 'start_year') \
             .bind(self.end, 'end_year') \
             .bind(self.driver, 'driver') \
             .bind(image_size, 'image_size') \
             .bind(square_size, 'square_size') \
             .bind(self.semester, 'semester')
     
     # create the tile 
     super().__init__(
         id_ = "viz_widget",
         title = cm.viz.title,
         btn = sw.Btn(cm.viz.btn),
         inputs = [
             self.driver, self.sources, 
             self.planet_key, self.bands, 
             years, self.semester, 
             image_size, square_size
         ],
         alert = self.alert
     )
     
     # js behaviour 
     self.btn.on_event('click', self._display_data) 
     self.driver.observe(self._on_driver_change, 'v_model')
示例#15
0
def statistics_tile(w_selector, statistics_io):
    def on_click(widget, event, data, path_selector, date_selector, statistic,
                 alert, out):

        # Clear output if there is something printed before
        out.clear_output()

        # Once the button is clicked, disable it
        btn.disable()

        # Clear old alert messages
        alert.clear()

        @out.capture()
        def run_process(path_selector, date_selector, statistic, alert):

            stack_composed(path_selector, date_selector, statistic, alert)

        run_process(path_selector, date_selector, statistic, alert)

        # Reactivate button
        btn.activate()

    def field_change(change, date_selector, alert):
        alert.clear()

        months_and_years = get_months_years(w_selector.get_current_path(),
                                            alert)

        if months_and_years:
            years, months = months_and_years
        else:
            # Stop the excecution
            return

        date_selector.clear_season()

        parsed_months = date_selector.numbers_to_months(months)
        date_selector.months_items = parsed_months
        date_selector.years_items = years

    alert = s.Alert()
    btn = s.Btn(text="Calculate statistics")
    out = Output()
    date_selector = DateSelector(season=True, remove_method=['Single date'])

    field_widget = w_selector.widget_field()
    field_widget.observe(
        partial(field_change, date_selector=date_selector, alert=alert),
        'v_model')

    date_tile = date_picker_tile(date_selector)

    w_stats = v.Select(
        label='Statistic',
        items=statistics_io.items,
        v_model=statistics_io.selected,
    )

    link((w_stats, 'items'), (statistics_io, 'items'))
    link((w_stats, 'v_model'), (statistics_io, 'selected'))

    w_cores = v.Slider(v_model=statistics_io.cores,
                       thumb_label='Always',
                       step=1,
                       label='Processors',
                       min=1,
                       max=statistics_io.cores)
    link((w_cores, 'v_model'), (statistics_io, 'cores'))

    w_chunk = v.Slider(v_model=200,
                       thumb_label='Always',
                       step=20,
                       label='Chunk size',
                       max=1000,
                       min=20)
    link((w_chunk, 'v_model'), (statistics_io, 'chunks'))

    advanced_settings = v.ExpansionPanels(
        flat=False,
        children=[
            v.ExpansionPanel(children=[
                v.ExpansionPanelHeader(children=['Advanced settings']),
                v.ExpansionPanelContent(children=[w_cores, w_chunk])
            ], ),
        ])

    btn.on_event(
        'click',
        partial(
            on_click,
            path_selector=w_selector,
            date_selector=date_selector,
            statistic=statistics_io,
            alert=alert,
            out=out,
        ))

    content = v.Layout(dark=True,
                       _metadata={'mount-id': 'data-input'},
                       class_="pa-5",
                       row=True,
                       align_center=True,
                       children=[
                           v.Flex(xs12=True,
                                  children=[
                                      statistics_text,
                                      v.Subheader(children=['Area selection']),
                                      v.Divider(), w_selector,
                                      v.Subheader(children=['Date selection']),
                                      v.Divider(), date_tile,
                                      v.Divider(), w_stats, advanced_settings,
                                      btn, alert, out
                                  ]),
                       ])

    return content
示例#16
0
def slider(min=None,
           max=None,
           vertical=False,
           v_model=None,
           label=None,
           hint=None,
           persistent_hint=False,
           class_='mx-6 mt-8',
           style_=None,
           thumb_size=24,
           tick_size=4,
           ticks=True,
           step=None,
           thumb_label='always',
           **kwargs):
    """
    Slider input

    Function to generate an ipyvuetify slider input widget.

    The value of the widget can be accessed or modified by the `v_model` property of the return value.

    See the vuetify documention for other arguments that can be passed as keyword arguments: https://vuetifyjs.com/en/components/sliders/

    Parameters:
    min : float
        Minimum value of slider

    max : float
        Maximum value of slider

    step : float (optional)
        Step size for slider, default: (max-min)/10

    v_model : float (optional)
        Default value of slider (defaults to min)

    label : str (optional, default None)
        Description of the input

    hint : str or callable (optional, default None)
        Hint text or function generating int based on input value for validating input

    persistent_hint : bool (optional, default False)
        Set to True to display the hint when widget is not focused

    class_ : str (optional, default None)
        ipyvuetify HTML class string

    style_ : str (optional, default None)
        ipyvuetify HTML CSS string

    thumb_size : int (optional, default 24)
        Size of thumb widget in pixels

    tick_size : int (optional, default 4)
        Size of slider ticks in pixels

    ticks : bool (default True)
        Whether to display slider ticks

    thumb_label : bool/str (optional, default 'always')
        How to display thumb label

    **kwargs
        Other arguments supported by ipyvuetify.TextField

    Returns:
    ipyvuetify.Slider
        An ipyvuetify slider
    """
    if min is None:
        min = 0
    if max is None:
        max = 1

    ret = ipyvuetify.Slider(min=min,
                            max=max,
                            thumb_size=thumb_size,
                            tick_size=tick_size,
                            ticks=ticks,
                            step=step,
                            thumb_label=thumb_label,
                            vertical=vertical,
                            class_=class_,
                            v_model=v_model,
                            label=label,
                            hint=hint,
                            persistent_hint=persistent_hint,
                            children=[])

    # Set other keyword arguments
    for arg in kwargs:
        setattr(ret, arg, kwargs[arg])

    # If no default is given, set it to the first
    if v_model is None:
        ret.v_model = min

    # If no step, divide interval by 10
    if step is None:
        ret.step = (max - min) / 10.0

    # Return widget
    return ret
import ipyvuetify as v
import ipywidgets as widgets
import numpy as np

# generate some fake data
np.random.seed(0)
n = 2000
x = np.linspace(0.0, 10.0, n)
y = np.cumsum(np.random.randn(n)*10).astype(int)

# create a bqplot figure
fig_hist = plt.figure(title='Histogram')
hist = plt.hist(y, bins=25)

# slider
slider = v.Slider(thumb_label='always', class_="px-4", v_model=30)
widgets.link((slider, 'v_model'), (hist, 'bins'))

fig_lines = plt.figure( title='Line Chart')
lines = plt.plot(x, y)

# even handling
selector = plt.brush_int_selector()
def update_range(*ignore):
    if selector.selected is not None and len(selector.selected) == 2:
        xmin, xmax = selector.selected
        mask = (x > xmin) & (x < xmax)
        hist.sample = y[mask]
selector.observe(update_range, 'selected')        

示例#18
0
parameter_scale = v.Select(items=[{
    "text": "scale 1",
    "value": 1
}, {
    "text": "scale 2",
    "value": 2
}],
                           label="Select Parameters",
                           multiple=False,
                           chips=True,
                           v_model=2)

slider_n_plant = v.Slider(max=100,
                          min=1,
                          label="#p",
                          thumb_label=True,
                          v_model="",
                          disabled=True)

box_n_plant = v.TextField(type_="number",
                          class_="mt-0 pt-0",
                          v_model='',
                          disabled=True)

plant_selection = v.Row(children=[
    v.Col(cols=12, sm=7, md=7, children=[slider_n_plant]),
    v.Col(cols=12, sm=1, md=1, children=[box_n_plant])
])

cb_allplants = v.Checkbox(v_model=False,
                          label="Select all plants",
示例#19
0
    def __init__(self):

        # init the downloadable informations
        self.geometry = None
        self.dataset = None
        self.name = None
        self.aoi_name = None

        # create the useful widgets
        self.w_scale = v.Slider(
            v_model=30,  # align on the landsat images
            min=10,
            max=300,
            thumb_label=True,
            step=10,
        )

        self.w_method = v.RadioGroup(
            v_model="gee",
            row=True,
            children=[
                v.Radio(label=cm.export.radio.sepal, value="sepal"),
                v.Radio(label=cm.export.radio.gee, value="gee"),
            ],
        )

        self.alert = sw.Alert()

        self.btn = sw.Btn(cm.export.apply, small=True)

        export_data = v.Card(children=[
            v.CardTitle(
                children=[v.Html(tag="h4", children=[cm.export.title])]),
            v.CardText(children=[
                v.Html(tag="h4", children=[cm.export.scale]),
                self.w_scale,
                v.Html(tag="h4", children=[cm.export.radio.label]),
                self.w_method,
                self.alert,
            ]),
            v.CardActions(children=[self.btn]),
        ])

        # the clickable icon
        self.download_btn = v.Btn(
            v_on="menu.on",
            color="primary",
            icon=True,
            children=[v.Icon(children=["mdi-cloud-download"])],
        )

        super().__init__(
            value=False,
            close_on_content_click=False,
            nudge_width=200,
            offset_x=True,
            children=[export_data],
            v_slots=[{
                "name": "activator",
                "variable": "menu",
                "children": self.download_btn
            }],
        )

        # add js behaviour
        self.btn.on_event("click", self._apply)
示例#20
0
              children=[
                  v.Select(label='Fruits',
                           items=['Apple', 'Pear', 'Cherry'],
                           v_model='Pear')
              ]),
        v.Col(cols=4,
              children=[
                  v.Select(label='Fruits',
                           items=['Apple', 'Pear', 'Cherry'],
                           chips=True,
                           multiple=True,
                           v_model=['Pear', 'Cherry'])
              ]),
        v.Col(cols=4,
              children=[
                  v.Select(label='Fruits',
                           items=['Apple', 'Pear', 'Cherry'],
                           outlined=True)
              ]),
    ]),
    v.Row(children=[
        v.Col(cols=4, children=[v.Slider()]),
        v.Col(cols=4, children=[v.Slider(thumb_label='always')]),
        v.Col(cols=4, children=[v.RangeSlider(value=[20, 80])]),
    ]),
    v.Row(children=[
        v.Col(cols=4, children=[v.Switch(label='switch', margin_top='0')]),
        v.Col(cols=4, children=[menu]),
        v.Col(cols=4, children=[dialog]),
    ]),
])