Ejemplo n.º 1
0
    def __init__(self,
                 tiles=[''],
                 appBar=None,
                 footer=None,
                 navDrawer=None,
                 **kwargs):

        self.tiles = None if tiles == [''] else tiles

        app_children = []

        #add the navDrawer if existing
        if navDrawer:
            app_children.append(navDrawer)

        #create a false appBar if necessary
        if not appBar:
            appBar = AppBar()
        app_children.append(appBar)

        #add the content of the app
        content = v.Content(children=[v.Container(fluid=True, children=tiles)])
        app_children.append(content)

        #create a false footer if necessary
        if not footer:
            footer = Footer()
        app_children.append(footer)

        super().__init__(v_model=None, children=app_children, **kwargs)
def construct_selects_container(selects_meta: dict, title=None):
    """
    Constructs a group of selector dropdowns
    
    Accepts:
        - selects_meta: dict
            Mapping from the select labels to their respective 
            lists from which the selection will be pre-populated
        - title: str
            Label which will be added as a p tag at the top of
            the section container
            
    Returns:
        - selects_container
            Container object with each select as a child
    
    """

    selects_list = [
        v.Select(label=label, items=prepop_list, v_model="")
        for label, prepop_list in selects_meta.items()
    ]

    if title is not None:
        assert isinstance(title,
                          str), f"Title must be a string, not {type(title)}"
        selects_list = [v.Html(tag="p", children=[title])] + selects_list

    selects_container = v.Container(children=selects_list)

    return selects_container
def df_items_to_tooltip(df, text_key: str, tool_tip_key: str):
    """
    Turns df into dictionary with rows as lists items and 
    passes specified keys to item text and tooltip respectively.
    Returns:
        list of rows with containers with text and tooltips 
    """

    df_dict = df.to_dict(orient="records")

    row_conts = []

    for row in df_dict:
        container = v.Container(children=[
            v.Tooltip(
                bottom=True,
                v_slots=[{
                    "name":
                    "activator",
                    "variable":
                    "tooltip",
                    "children":
                    v.Html(
                        tag="t2",
                        v_on="tooltip.on",
                        children=[str(row[text_key])],
                    ),
                }],
                children=[str(row[tool_tip_key])],
            )
        ])

        row_conts.append(field)

    return row_conts
Ejemplo n.º 4
0
def container(
    children=[],
    fluid=False,
    class_="icon ma-2",
    style_="",
):
    """
    Creates a button and activates a dialog on click

    Useful to display application documentation/help

    Parameters
    ----------
    children : list
        List of elements to display in container
    fluid : bool (default False)
        Removes viewport maximum-width size breakpoints
    _class : str (optional, default 'icon ma-2')
        CSS classes of button
    _style: str
        CSS style of button
    """

    ret = ipyvuetify.Container(
        class_=class_,
        style_=style_,
        children=children,
        fluid=fluid,
    )

    return ret
Ejemplo n.º 5
0
def App (tiles=[''], appBar=None, footer=None, navDrawer=None):
    """
    Create an app display with the tiles created by the user. Display false footer and appBar if not filled. navdrawer is fully optionnal
    
    Args:
        tiles ([v.Layout]) : the list of tiles the user want to display in step order. 
        appBar (v.appBar, optionnal) : the custom appBar of the module
        footer (v.Footer, optionnal) : the custom footer of the module
        navDrawer (v.NavigationDrawer, optional) : the navigation drawer to allow the display of specific tiles
        
    Returns:
        app (v.App) : the complete app to display
        toolBarButton (v.Btn) : the created toolbarButton, None if the appBar was already existing
    """
    
    app = v.App(v_model=None)
    app_children = []
    
    #add the navDrawer if existing
    if navDrawer:
        app_children.append(navDrawer)
    
    #create a false appBar if necessary
    toolBarButton = None
    if not appBar:
        appBar, toolBarButton = AppBar()
    app_children.append(appBar)

    #add the content of the app
    content = v.Content(children=[v.Container(fluid=True,children = tiles)])
    app_children.append(content)
    
    app.children = app_children
    
    return (app, toolBarButton)
Ejemplo n.º 6
0
    def show_problem(self):

        # show statement
        display(self.statement)

        # put answer radio buttons, submit button, and feedback area into a container and show
        con = v.Container(children=[self.choice_buttons, self.check_button])
        display(con)

        display(self.feedback)
Ejemplo n.º 7
0
Archivo: view.py Proyecto: xinhen/vaex
 def __init__(self, **kwargs):
     super(ViewBase, self).__init__(**kwargs)
     self.df = self.model.df
     self.progress_indicator = vw.ProgressCircularNoAnimation(size=30, width=5, height=20, color=C0, value=10.4, text='')
     self.progress_text = vw.Status(value=self.model.status_text)
     traitlets.dlink((self.model, 'status_text'), (self.progress_text, 'value'))
     self.progress_widget = v.Container(children=[self.progress_indicator, self.progress_text])
     # self.progress_widget.layout.width = "95%"
     # self.progress_widget.layout.max_width = '500px'
     # self.progress_widget.description = "progress"
     self.model.signal_grid_progress.connect(self.on_grid_progress)
    def __init__(self, pages, proj_dir, first_page):
        self.page_name_to_page = {page.page_name: page for page in pages}

        for page_name, page in self.page_name_to_page.items():
            page.proj_dir = proj_dir
            page.view()
            self.page_name_to_page[page_name] = page

        self.page = self.page_name_to_page[first_page]

        self.container = v.Container(children=["Loading..."],
                                     _metadata={"mount_id": "content-main"})
        self.container.children = [self.page.container]
def construct_nav(gui, page_change_func):
    page_buttons = []

    for page_name in gui.page_name_to_page.keys():

        btn = v.Btn(text=True, block=False, children=[page_name])

        btn.on_event("click", page_change_func)
        page_buttons += [btn]

    navigation = v.Container(_metadata={"mount_id": "content-nav"},
                             children=page_buttons)

    return navigation
Ejemplo n.º 10
0
    def __init__(self,
                 tiles=[''],
                 appBar=None,
                 footer=None,
                 navDrawer=None,
                 **kwargs):

        self.tiles = None if tiles == [''] else tiles

        app_children = []

        # create a false appBar if necessary
        if not appBar:
            appBar = AppBar()
        self.appBar = appBar
        app_children.append(self.appBar)

        # add the navDrawer if existing
        self.navDrawer = None
        if navDrawer:
            # bind app tile list to the navdrawer
            for di in navDrawer.items:
                di.display_tile(tiles)

            # link it with the appbar
            navDrawer.display_drawer(self.appBar.toggle_button)

            # add the drawers to the children
            self.navDrawer = navDrawer
            app_children.append(self.navDrawer)

        # add the content of the app
        self.content = v.Content(
            children=[v.Container(fluid=True, children=tiles)])
        app_children.append(self.content)

        # add the footer if existing
        if footer:
            self.footer = footer
            app_children.append(self.footer)

        # create a negative overlay to force the background color
        bg = v.Overlay(color=color.bg,
                       opacity=1,
                       style_='transition:unset',
                       z_index=-1)

        super().__init__(v_model=None, children=[bg, *app_children], **kwargs)
Ejemplo n.º 11
0
class CoreController(AbstrController, Subscriber):
    __layout = v.Container(_metadata={"mount_id": "content-main"},
                           class_="my-4 mx-5",
                           fluid=True,
                           children=[])

    def __init__(self, dialog_ctrlr=None):
        super().__init__("core")
        self.__init_dialog(dialog_ctrlr)
        self.__init_event_reactions()

    def __init_dialog(self, dialog_ctrlr):
        if dialog_ctrlr is None:
            dialog_ctrlr = DialogController()

        self.__dialog = dialog_ctrlr

    def __init_event_reactions(self):
        self.__on_message = {
            "change_view": self.__on_change_view,
            "show_dialog": self.__on_show_dialog,
            "hide_dialog": self.__on_hide_dialog
        }

    def __on_change_view(self, arg):
        children = self.__dialog.render() + arg.render()
        self.__layout.children = children

    def __on_show_dialog(self, arg):
        self.__dialog.show(arg["title"], arg["content"])

    def __on_hide_dialog(self, arg):
        self.__dialog.hide()

    def _get_layout(self):
        return self.__layout

    def on_message(self, message, arg):
        self.__on_message[message](arg)
Ejemplo n.º 12
0
    def __init__(self, test_case_widget, lb_scheme_widget, discret_widget):
        """
        Widget definition for parametric study of lattice Boltzmann methods.

        Parameters
        ==========

        - test_case_widget:
            widget of the test case (see test_case.py).

        - lb_scheme_widget:
            widget of the lattice Boltzmann scheme (see lb_scheme.py).

        This widget is composed by a menu where you can define the design space of the parametric study,
        the responses computed on each sample and the method used to generate the sampling as well as
        the number of points.

        This widget is also composed by a main widget where the result of the parametric study is
        represented by a parallel coordinates plot using plotly.

        """
        self.test_case_widget = test_case_widget
        self.lb_scheme_widget = lb_scheme_widget
        self.discret_widget = discret_widget
        self.tmp_dir = tempfile.TemporaryDirectory()

        ##
        ## The menu
        ##
        self.study_name = v.TextField(label='Study name', v_model='PS_0')

        # self.space_step = v.TextField(label='Space step', v_model=0.01, type='number')
        self.codegen = v.Select(label='Code generator',
                                items=['auto', 'numpy', 'cython'],
                                v_model='auto')

        self.design = DesignWidget(test_case_widget, lb_scheme_widget,
                                   discret_widget)
        self.responses = ResponsesWidget(test_case_widget, lb_scheme_widget)

        self.sampling_method = v.Select(label='Method',
                                        items=list(skopt_method.keys()),
                                        v_model=list(skopt_method.keys())[0])
        self.sample_size = v.TextField(label='Number of samples',
                                       v_model=10,
                                       type='number')

        self.run = v.Btn(v_model=True,
                         children=['Run parametric study'],
                         class_="ma-5",
                         color='success')

        self.menu = [
            self.study_name,
            # self.space_step,
            self.codegen,
            v.ExpansionPanels(children=[
                v.ExpansionPanel(children=[
                    v.ExpansionPanelHeader(children=['Design space']),
                    v.ExpansionPanelContent(children=[self.design.widget]),
                ]),
                v.ExpansionPanel(children=[
                    v.ExpansionPanelHeader(children=['Responses']),
                    v.ExpansionPanelContent(children=[self.responses.widget]),
                ]),
                v.ExpansionPanel(children=[
                    v.ExpansionPanelHeader(children=['Sampling method']),
                    v.ExpansionPanelContent(
                        children=[self.sampling_method, self.sample_size]),
                ]),
            ],
                              multiple=True),
            v.Row(children=[self.run], align='center', justify='center'),
        ]

        ##
        ## The main
        ##
        self.dialog = DialogPath()
        self.plotly_plot = v.Container(align_content_center=True)
        self.main = [v.Row(children=[self.plotly_plot]), self.dialog]

        ##
        ## Widget events
        ##
        self.run.on_event('click', self.start_PS)
        self.test_case_widget.select_case.observe(self.purge, 'v_model')
        self.lb_scheme_widget.select_case.observe(self.purge, 'v_model')
        self.codegen.observe(self.purge, 'v_model')
Ejemplo n.º 13
0
    def vue(self):
        import jinja2

        try:
            import ipyvuetify as v
            import ipywidgets as widgets
        except ImportError:
            raise ImportError("Please install ipyvuetify")

        t, x, y, z, U, Fx, Fy, Fz, Delta = sp.symbols('t, x, y, z, U, F_x, F_y, F_z, Delta_t')
        Bxx, Bxy, Bxz = sp.symbols('B_{xx}, B_{xy}, B_{xz}')
        Byx, Byy, Byz = sp.symbols('B_{yx}, B_{yy}, B_{yz}')
        Bzx, Bzy, Bzz = sp.symbols('B_{zx}, B_{zy}, B_{zz}')

        phys_equation = sp.Derivative(U, t) + sp.Derivative(Fx, x)
        if self.dim > 1:
            phys_equation += sp.Derivative(Fy, y)
        if self.dim == 3:
            phys_equation += sp.Derivative(Fz, z)

        order2 = []
        space = [x, y, z]
        B = [[Bxx, Bxy, Bxz],
             [Byx, Byy, Byz],
             [Bzx, Bzy, Bzz],
            ]

        phys_equation_rhs = 0
        for i in range(self.dim):
            for j in range(self.dim):
                phys_equation_rhs += sp.Derivative(B[i][j]*sp.Derivative(U, space[j]), space[i])

        order1_dict = {}
        F = [Fx, Fy, Fz]
        for d in range(self.dim):
            order1_dict[sp.latex(F[d])] = [sp.latex(c) for c in self.coeff_order1[d]]

        order0_template = jinja2.Template("""
        {%- macro coeff(order) %}
            {%- for o in order %}
                $$ {{ o }} $$
            {% endfor %}
        {%- endmacro %}
        {{ coeff(consm) }}
        """)

        order1_template = jinja2.Template("""
        {%- macro coeff_dict(consm, order) %}
            \\begin{align*}
            {%- for key, value in order.items() %}
                {%- for i in range(consm|length) %}
                    {{ key }}^{ {{ consm[i] }} } &= {{ value[i] }} \\\\ \\\\
                {% endfor %}
            {% endfor %}
            \\end{align*}
        {%- endmacro %}
        {{ coeff_dict(consm, order1_dict) }}
        """)

        order2_template = jinja2.Template("""
        {%- macro coeff_dict_2(consm, order) %}
            \\begin{align*}
            {%- for key, value in order.items() %}
                {%- for i in range(consm|length) %}
                    {%- for j in range(consm|length) %}
                        {{ key }}^{ {{ consm[i] }}, {{ consm[j] }} } &= {{ value[i*(consm|length) + j] }} \\\\ \\\\
                    {% endfor %}
                {% endfor %}
            {% endfor %}
            \\end{align*}
        {%- endmacro %}
        {{ coeff_dict_2(consm, order2_dict) }}
        """)

        order2_dict = {}
        for i in range(self.dim):
            for j in range(self.dim):
                order2_dict[sp.latex(B[i][j])] = [sp.latex(-Delta*c) for c in self.coeff_order2[i][j]]

        consm = [sp.latex(c) for c in self.consm]
        return v.Container(children=[
            v.Row(children=['The equivalent equation is given by']),
            v.Row(children=[
                widgets.HTMLMath(sp.latex(sp.Eq(phys_equation, phys_equation_rhs), mode='equation*'))
                ],
                justify='center',
            ),
            v.ExpansionPanels(children=[
                v.ExpansionPanel(children=[
                    v.ExpansionPanelHeader(children=['Conserved moments'], class_="title"),
                    v.ExpansionPanelContent(children=[
                        v.Row(children=[
                            widgets.HTMLMath(order0_template.render(consm=consm))
                            ],
                            justify='center'
                        )
                    ])
                ], class_="ma-2"),
                v.ExpansionPanel(children=[
                    v.ExpansionPanelHeader(children=['Order 1'], class_="title"),
                    v.ExpansionPanelContent(children=[
                        v.Row(children=[
                            widgets.HTMLMath(order1_template.render(consm=consm, order1_dict=order1_dict))
                            ],
                            justify='center'
                        )
                    ])
                ], class_="ma-2"),
                v.ExpansionPanel(children=[
                    v.ExpansionPanelHeader(children=['Order 2'], class_="title"),
                    v.ExpansionPanelContent(children=[
                        v.Row(children=[
                            widgets.HTMLMath(order2_template.render(consm=consm, order2_dict=order2_dict))
                            ],
                            justify='center'
                        )
                    ])
                ], class_="ma-2"),
            ])
        ])
Ejemplo n.º 14
0
                                  v.Spacer(),
                              ]),
                              v.CardText(children=[details['description']]),
                          ])
               ]) for i, details in enumerate(items)
    ]

    tab_children.append(v.Tab(children=[stage]))
    tab_children.append(
        v.TabItem(children=[v.Layout(ma_5=True, wrap=True, children=cards)]))

# + {"Collapsed": "false"}
tabs = v.Tabs(v_model='tab',
              color='grey lighten-5',
              fixed_tabs=True,
              children=tab_children)

app = v.App(style_="background: white",
            children=[
                toolbar,
                v.Container(
                    fluid=True,
                    mt_3=True,
                    children=[v.Layout(children=[v.Flex(children=[tabs])])])
            ])

# + {"Collapsed": "false"}
app

# + {"Collapsed": "false"}
Ejemplo n.º 15
0
                                          chips=True,
                                          multiple=True,
                                          counter=True,
                                          v_model="",
                                          label="Select Genotypes",
                                          truncate_length=22)

menu_plant_extraction = v.Col(
    cols=12,
    sm=3,
    md=3,
    children=[genotypes_selection_extraction, export_extraction])

df_modulescale = create_grid()

panel_df = v.Container(fluid=True, children=[df_modulescale])

df_description = create_grid()

panel_description = v.Container(fluid=True, children=[df_description])

tab_extraction_content = v.Row(children=[
    v.Card(style_=layout_card, children=[info.p4_doc_extraction]),
    v.Col(cols=12,
          sm=12,
          md=12,
          children=[
              menu_plant_extraction,
              panel_df,
              panel_description,
          ]),
Ejemplo n.º 16
0
    def init_widgets(self, tag_type):
        self.all_check = v.Checkbox(v_on='tooltip.on',
                                    prepend_icon='fa-globe',
                                    label="All",
                                    v_model=True,
                                    class_='ma-0 mt-1 pa-0')
        self.all_check_tp = v.Tooltip(bottom=True,
                                      v_slots=[{
                                          'name': 'activator',
                                          'variable': 'tooltip',
                                          'children': self.all_check
                                      }],
                                      children=["Select all"])
        self.all_check.on_event('change', self.check_all)
        all_row = [v.Row(children=[self.all_check_tp], class_='ml-7')]

        tag_rows = []
        treenodelabel = v.Html(
            tag='style',
            children=
            [(".vuetify-styles .v-treeview-node__label {"
              "margin-left: 0px;"
              "overflow: visible;"
              "}"
              ".vuetify-styles .v-input--selection-controls:not(.v-input--hide-details) .v-input__slot {"
              "margin-bottom: 0px;"
              "}"
              ".vuetify-styles .v-treeview-node__root .v-icon.v-icon.v-icon--link {"
              "margin-bottom: 10px;"
              "}"
              ".vuetify-styles .v-treeview-node--leaf {"
              "margin-left: 0px;"
              "}"
              ".vuetify-styles .v-treeview--dense .v-treeview-node__root {"
              "min-height: 21px;"
              "}")])

        for tag in self.model.curr_trace.tags:
            if tag.tag_type == tag_type:
                chk = Checkbox(tag)
                self.checkboxes.append(chk)
                chk.widget.on_event('change', self.update_all_checkbox)
                stats = self.get_stats(tag)
                btn, tooltip = self.create_zoom_button(tag, stats=stats)
                statss = self.tag_tooltip(tag, stats).splitlines()

                tag_row = v.Row(children=[btn, chk.widget], class_='ml-0')
                items = [{
                    'id':
                    1,
                    'name':
                    '',
                    'children': [{
                        'id': i + 2,
                        'name': stat
                    } for i, stat in enumerate(statss)],
                }]
                treeview = v.Treeview(items=items, dense=True)
                tag_rows.append(
                    v.Container(row=False,
                                class_="d-flex justify-start ma-0 pa-0",
                                children=[
                                    v.Col(cols=1,
                                          children=[treeview],
                                          class_="ma-0 pa-0"),
                                    v.Col(cols=12,
                                          children=[tag_row],
                                          class_="pt-0 pb-0")
                                ]))
        tag_rows.append(v.Container(row=False, children=[treenodelabel]))
        return VBox([
            v.List(children=(all_row + tag_rows),
                   dense=True,
                   nav=True,
                   max_height="300px",
                   max_width="300px")
        ])
Ejemplo n.º 17
0
def date_picker_tile(Dates):

    import ipywidgets as widgets

    def bind_change(change, obj, attr):
        setattr(obj, attr, change['new'])

    # Date unique widget
    w_unique_date = widgets.DatePicker(description='Date', )
    w_unique_cont = v.Container(class_='pa-5 d-none', children=[w_unique_date])
    # Create two-way-binding with Dates object
    link((w_unique_date, 'value'), (Dates, 'single_date'))

    # Date range widget
    w_ini_date = widgets.DatePicker(description='Start date', )
    w_ini_date_cont = v.Container(class_='pa-5 d-none', children=[w_ini_date])
    link((w_ini_date, 'value'), (Dates, 'start_date'))

    w_end_date = widgets.DatePicker(description='End date', )
    w_end_date_cont = v.Container(class_='pa-5 d-none', children=[w_end_date])
    link((w_end_date, 'value'), (Dates, 'end_date'))

    # Season pickerr

    w_mmonths = v.Select(
        class_='d-none',
        multiple=True,
        chips=True,
        label='Months',
        deletable_chips=True,
        v_model=Dates.selected_months,
        items=Dates.months_items,
    )

    link((w_mmonths, 'v_model'), (Dates, 'selected_months'))
    link((w_mmonths, 'items'), (Dates, 'months_items'))

    w_myears = v.Select(
        class_='d-none',
        multiple=True,
        chips=True,
        label='Years',
        deletable_chips=True,
        v_model=Dates.selected_years,
        items=Dates.years_items,
    )

    link((w_myears, 'v_model'), (Dates, 'selected_years'))
    link((w_myears, 'items'), (Dates, 'years_items'))

    # Selector date method
    w_date_method = v.Select(v_model='',
                             label='Specify the selection date method',
                             items=Dates.selection_methods)

    # Bind the selected value to the object
    link((w_date_method, 'v_model'), (Dates, 'date_method'))

    widgets = [
        w_unique_cont, w_ini_date_cont, w_end_date_cont, w_mmonths, w_myears
    ]

    # Create a behavior after change the clicked value of w_date_method
    wb.bind_dates(w_date_method, widgets, Dates)

    dates_content = v.Layout(
        _metadata={'mount-id': 'data-input'},
        class_="pa-5",
        row=True,
        align_center=True,
        children=[
            v.Flex(xs12=True, children=[w_date_method]),
            v.Flex(xs12=True, children=[w_unique_cont]),
            v.Flex(
                xs12=True,
                children=[
                    v.Layout(
                        class_='flex-column',
                        children=[
                            v.Flex(children=[w_ini_date_cont, w_end_date_cont])
                        ])
                ]),
            v.Flex(xs12=True,
                   children=[
                       v.Layout(
                           class_='flex-column',
                           children=[v.Flex(children=[
                               w_myears,
                               w_mmonths,
                           ])])
                   ])
        ])

    return dates_content
Ejemplo n.º 18
0
    def play(self):

        #labels = widgets.HBox([widgets.Label(value="Option"), widgets.Label(value="Topics")])
        #options = widgets.SelectMultiple(options=['--clock', '--loop', '--keep-alive', '--wait-for-subscribers'])
        #topics = widgets.SelectMultiple(options=self.topics.keys(), value=self.topics.keys())

        options = [
            vue.Checkbox(label='--clock',
                         value='--clock',
                         v_model=None,
                         class_='mx-0 px-0'),
            vue.Checkbox(label='--loop',
                         value='--loop',
                         v_model=None,
                         class_='mx-0 px-0'),
            vue.Checkbox(label='--keep-alive',
                         value='--keep-alive',
                         v_model=None,
                         class_='mx-0 px-0'),
            vue.Checkbox(label='--wait-for-subscribers',
                         value='--wait-for-subscribers',
                         v_model=None,
                         class_='mx-0 px-0')
        ]

        topics = [
            vue.Checkbox(label=t, value=t, v_model=t, class_='mx-0 px-0')
            for t in self.topics.keys()
        ]

        config = vue.Html(tag='div',
                          class_='d-flex flex-row',
                          children=[
                              vue.Html(tag='div',
                                       class_='d-flex flex-column',
                                       children=[
                                           vue.Html(tag='h3',
                                                    children=['Options']),
                                           vue.Container(children=options)
                                       ]),
                              vue.Html(tag='div',
                                       class_='d-flex flex-column',
                                       children=[
                                           vue.Html(tag='h3',
                                                    children=['Topics']),
                                           vue.Container(children=topics)
                                       ]),
                          ])

        #config = widgets.HBox([options, topics])

        #btn_init = widgets.Button(description="Initialize", button_style='warning')
        #btn_play = widgets.Button(description="Play", icon='play', button_style='success')
        #btn_pause = widgets.Button(description="Pause", icon='pause', disabled=True)
        #btn_step = widgets.Button(description="Step", icon='step-forward')
        #btn_stop = widgets.Button(description="Stop", icon='stop', button_style='danger', disabled=True)

        btn_init = vue.Btn(color='warning',
                           children=['Initialize'],
                           class_='mx-2')
        btn_play = vue.Btn(
            color='success',
            disabled=True,
            children=[vue.Icon(left=True, children=['play']), 'Play'],
            class_='mx-2')
        btn_pause = vue.Btn(
            color='primary',
            disabled=True,
            children=[vue.Icon(left=True, children=['pause']), 'Pause'],
            class_='mx-2')
        btn_step = vue.Btn(
            color='primary',
            disabled=True,
            children=[vue.Icon(left=True, children=['step-forward']), 'Step'],
            class_='mx-2')
        btn_stop = vue.Btn(
            color='error',
            disabled=True,
            children=[vue.Icon(left=True, children=['stop']), 'Stop'],
            class_='mx-2')

        #output = widgets.widgets.Text()
        output = vue.TextField(label='Output')

        def btn_init_on_click(widget, event, data):
            btn_init.disabled = True
            btn_play.disabled = False
            btn_pause.disabled = False
            btn_step.disabled = True
            btn_stop.disabled = False

            opt = [o.value for o in options if o.v_model != None]
            top = [t.value for t in topics if t.v_model != None]

            command = ' '.join(['rosbag', 'play', '--pause'] + list(opt) +
                               ['--topics'] + [' '.join(top)] +
                               ['--bags=' + self.bag.filename])
            self.cmd = Command(command, output)
            self.cmd.start()

        def btn_play_on_click(widget, event, data):
            btn_init.disabled = True
            btn_play.disabled = True
            btn_pause.disabled = False
            btn_step.disabled = True
            btn_stop.disabled = False

            if self.cmd != None:
                print("cmd.play")
                self.cmd.play()
            else:
                output.value = "You should initialize the command."

        def btn_pause_on_click(widget, event, data):
            btn_init.disabled = True
            btn_play.disabled = False
            btn_pause.disabled = True
            btn_step.disabled = False
            btn_stop.disabled = False

            if self.cmd != None:
                self.cmd.pause()
            else:
                output.value = "You should initialize the command."

        def btn_step_on_click(widget, event, data):
            btn_init.disabled = True
            btn_play.disabled = False
            btn_pause.disabled = True
            btn_step.disabled = False
            btn_stop.disabled = False

            if self.cmd != None:
                self.cmd.step()
            else:
                output.value = "You should initialize the command."

        def btn_stop_on_click(widget, event, data):
            btn_init.disabled = False
            btn_play.disabled = True
            btn_pause.disabled = True
            btn_step.disabled = True
            btn_stop.disabled = True

            if self.cmd != None:
                self.cmd.stop()
            else:
                output.value = "You should initialize the command."

        #btn_init.on_click(btn_init_on_click)
        #btn_play.on_click(btn_play_on_click)
        #btn_pause.on_click(btn_pause_on_click)
        #btn_step.on_click(btn_step_on_click)
        #btn_stop.on_click(btn_stop_on_click)

        btn_init.on_event('click', btn_init_on_click)
        btn_play.on_event('click', btn_play_on_click)
        btn_pause.on_event('click', btn_pause_on_click)
        btn_step.on_event('click', btn_step_on_click)
        btn_stop.on_event('click', btn_stop_on_click)

        #btns = widgets.VBox([widgets.HBox([btn_init, btn_play, btn_pause, btn_step, btn_stop]), output])

        btns = vue.Html(
            tag='div',
            class_='d-flex flex-row',
            children=[btn_init, btn_play, btn_pause, btn_step, btn_stop])

        #display( widgets.VBox([labels, config, btns]) )
        display(vue.Container(children=[config, btns, output]))
Ejemplo n.º 19
0
                                          chips=True,
                                          multiple=True,
                                          counter=True,
                                          v_model="",
                                          label="Select Genotypes",
                                          truncate_length=22)

menu_plant_extraction = v.Col(
    cols=12,
    sm=12,
    md=12,
    children=[genotypes_selection_extraction, export_extraction])

df_plantscale = create_grid()

panel_df = v.Container(fluid=True, children=[df_plantscale])

df_description = create_grid()

panel_description = v.Container(fluid=True, children=[df_description])

tab_extraction_content = v.Row(children=[
    v.Card(style_=layout_card, children=[info.p3_doc_extraction]),
    v.Col(cols=12,
          sm=12,
          md=12,
          children=[
              menu_plant_extraction,
              panel_df,
              panel_description,
          ]),
Ejemplo n.º 20
0
 def _get_layout(self):
     return v.Container(
         pa_4=True,
         _metadata={"mount_id": "content-nav"},
         column=True,
         children=[v.List(dense=True, children=self.__elements)])
    v.Col(children=[genotype_selection_3d]),
    v.Col(children=[parameter_color])
])

row_param2d = v.Row(children=[
    v.Col(children=[genotype_selection_2d]),
    v.Col(children=[id_selection_2d])
])

plot3d_growth_developement = widgets.Output(layout=layout_output_wgt)

plot3d_floral_intensity = widgets.Output(layout=layout_output_wgt)

panel_3d = v.Row(children=[
    v.Col(children=[
        v.Container(fluid=True, children=[plot3d_growth_developement])
    ]),
    v.Col(
        children=[v.Container(fluid=True, children=[plot3d_floral_intensity])])
])

tab_3d_content = v.Row(children=[
    v.Card(style_=layout_card, children=[info.p2_doc_visu3d]),
    v.Col(col=12, sm=12, md=12, children=[menu_plant_3d, panel_3d])
])

plot2d_single_p = widgets.Output(layout=layout_output_wgt)

plot2d_most_central = widgets.Output(layout=layout_output_wgt)

panel_2d = v.Row(children=[
Ejemplo n.º 22
0
 def render(self):
     children = self.__menu.render() + self.__res.render()
     return v.Container(children=children)
Ejemplo n.º 23
0
 def __init__(self, app_dir="."):
     self.app_dir = app_dir
     self.main_loading = v.ProgressLinear(indeterminate=False)
     self.main_toolbar = self.create_main_toolbar()
     self.heatmap_plot = v.Container()
Ejemplo n.º 24
0
])

waffle = widgets.Output(layout=layout_output_wgt)

tab_waffle_content = v.Row(children=[
    v.Card(style_=layout_card, children=[info.p5_doc_waffle]),
    v.Col(col=12, sm=12, md=12, children=[
        menu_plant_waffle,
        waffle,
    ]),
])

p5 = v.Tabs(children=[
    v.Tab(children=['Waffle']),
    v.TabItem(children=[tab_waffle_content]),
])

container_main = v.Container(fluid=True,
                             class_='grid-list-md box',
                             children=[p5])

# # ----------------------------------------------------------------
# # Link widgets - event
# # ----------------------------------------------------------------

genotypes_selection_waffle.on_event('change', on_change_node_waffle_genotype)
date_selection_waffle.on_event('change', on_change_node_waffle_date)
variable_selection_waffle.on_event('change', on_change_node_waffle_parameter)
plot_type_waffle.on_event('change', on_change_node_plot_type)
order_selection_waffle.on_event('change', on_change_node_order)
Ejemplo n.º 25
0
v.Container(children=[
    v.Row(children=[
        v.Btn(class_='ma-2', color='primary', children=['button']),
        v.Btn(
            class_='ma-2', color='primary', outlined=True, children=['button'
                                                                     ]),
        v.Btn(
            class_='ma-2', color='primary', rounded=True, children=['button']),
        v.Btn(class_='ma-2',
              color='primary',
              fab=True,
              children=[
                  v.Icon(children=['mdi-pencil']),
              ]),
        v.Btn(class_='ma-2',
              color='primary',
              icon=True,
              children=[
                  v.Icon(children=['mdi-pencil']),
              ]),
        v.Btn(class_='ma-2', color='primary', text=True, children=['button']),
    ]),
    v.Row(children=[
        v.Btn(
            class_='ma-2', color='primary', x_small=True, children=['button']),
        v.Btn(class_='ma-2',
              color='primary',
              x_small=True,
              outlined=True,
              children=['button']),
        v.Btn(class_='ma-2',
              color='primary',
              x_small=True,
              rounded=True,
              children=['button']),
        v.Btn(class_='ma-2',
              color='primary',
              x_small=True,
              fab=True,
              children=[
                  v.Icon(children=['mdi-pencil']),
              ]),
        v.Btn(class_='ma-2',
              color='primary',
              x_small=True,
              icon=True,
              children=[
                  v.Icon(children=['mdi-pencil']),
              ]),
        v.Btn(class_='ma-2',
              color='primary',
              x_small=True,
              text=True,
              children=['button']),
    ]),
    v.Row(children=[
        v.Col(cols=4,
              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]),
    ]),
])
Ejemplo n.º 26
0
                   sm=3,
                   md=3,
                   children=[
                       files_upload,
                       v.Divider(), files_selection,
                       v.Divider(), genotypes_selection,
                       v.Divider(), plant_selection,
                       v.Divider(), cb_allplants,
                       v.Divider(), parameter_scale,
                       v.Divider(), export_all
                   ])

tableMTG = create_grid()

panel_tableMTG = v.Container(label="The MTG as a table",
                             fluid=True,
                             children=[tableMTG])

graphMTG = create_grid()

panel_graphMTG = v.Container(label="The MTG as a graph",
                             fluid=True,
                             children=[graphMTG])

panel_MTG = v.Col(cols=12,
                  sm=8,
                  md=8,
                  children=[
                      panel_tableMTG,
                      v.Divider(),
                      panel_graphMTG,
Ejemplo n.º 27
0
    def __init__(self, spark_controller, ipywidget_factory, ipython_display,
                 endpoints, refresh_method, state, db):
        super(AddEndpointWidget,
              self).__init__(spark_controller, ipywidget_factory,
                             ipython_display, True)
        self.endpoints = endpoints
        self.refresh_method = refresh_method
        self.state = state
        self.delete_pressed = False
        self.db = db
        self.auth = GoogleAuth()

        add_endpoint_button = v.Btn(class_='ma-2',
                                    color='primary',
                                    children=['Add Endpoint'])
        add_endpoint_button.on_event('click', self._add_endpoint)
        cancel_button = v.Btn(class_='ma-2',
                              color='primary',
                              children=['Cancel'])
        cancel_button.on_event('click', self._on_cancel_click)

        backicon = v.Icon(children=['mdi-arrow-left'])
        backicon.on_event('click', self._on_back_click)
        back_toolbar = v.Toolbar(
            elevation="0",
            children=[
                v.ToolbarItems(children=[backicon]),
                v.ToolbarTitle(children=['Create new endpoint']),
                v.Spacer()
            ],
            app=True,  # If true, the other widgets float under on scroll
        )

        self.create_endpoint_widget = v.Container(
            style_=f'width: {WIDGET_WIDTH};',
            class_='ma-2',
            children=[
                back_toolbar,
                v.Row(class_='ma-2',
                      children=[
                          v.Col(children=[self.auth.account_widget]),
                          v.Col(children=[self.auth.project_widget]),
                          v.Col(children=[self.auth.region_widget])
                      ]),
                v.Row(class_='ma-2',
                      children=[
                          v.Col(children=[self.auth.cluster_widget]),
                          v.Col(children=[self.auth.filter_widget]),
                          v.Col(children=[v.Spacer()]),
                      ]),
                v.Row(class_='ma-2',
                      children=[add_endpoint_button, cancel_button])
            ])

        endpoint_table_values = self._generate_endpoint_values()
        new_endpoint = v.Btn(class_='ma-2',
                             color='primary',
                             children=['New Endpoint'])
        new_endpoint.on_event('click', self._on_new_endpoint_click)

        no_back_toolbar = v.Toolbar(
            elevation="0",
            children=[
                v.ToolbarTitle(titleMarginStart='12dp',
                               contentInsetStartWithNavigation="56dp",
                               children=['Endpoints']),
                v.Spacer()
            ],
            app=True,  # If true, the other widgets float under on scroll
        )
        toolbar = v.Row(children=[no_back_toolbar, new_endpoint])
        delete_icon = v.Icon(children=['mdi-delete'])
        delete_icon.on_event('click', self._on_delete_icon_pressed)

        endpoint_table = v.DataTable(style_=f'width: {WIDGET_WIDTH};',
                                     no_data_text='No endpoints',
                                     hide_default_footer=True,
                                     disable_pagination=True,
                                     item_key='url',
                                     headers=[
                                         {
                                             'text': 'Cluster',
                                             'align': 'start',
                                             'sortable': False,
                                             'value': 'name'
                                         },
                                         {
                                             'text': 'Project',
                                             'sortable': False,
                                             'value': 'project'
                                         },
                                         {
                                             'text': 'Region',
                                             'sortable': False,
                                             'value': 'region'
                                         },
                                         {
                                             'text': 'Account',
                                             'sortable': False,
                                             'value': 'account'
                                         },
                                         {
                                             'text': 'Url',
                                             'sortable': False,
                                             'value': 'url'
                                         },
                                         {
                                             'text': '',
                                             'sortable': False,
                                             'value': 'actions'
                                         },
                                     ],
                                     items=endpoint_table_values,
                                     dense=False,
                                     v_slots=[{
                                         'name': 'item.actions',
                                         'children': [delete_icon]
                                     }, {
                                         'name': 'no-data',
                                         'children': ['No endpoints']
                                     }])
        endpoint_table.on_event('click:row', self._remove_row_from_table)

        self.toolbar_with_table = v.Container(
            style_=f'width: {WIDGET_WIDTH};',
            class_='mx-auto',
            children=[
                v.Row(class_='mx-auto', children=[toolbar]),
                v.Row(class_='mx-auto', children=[endpoint_table])
            ])

        self.children = [self.create_endpoint_widget, self.toolbar_with_table]
        for child in self.children:
            child.parent_widget = self
        self._update_view()