def create_usage_widgets(content_type_callback, usage_type_callback, extra_buttons): """Create widgets used for visualizing content usage.""" comparison_selector = ipywidgets.SelectMultiple( options=cfg.NODES, selected_labels=["Physics", "Biology", "Chemistry"], width="200px") comparison_selector.height = '270px' type_selector1 = widgets.create_toggle(["all", "videos", "exercises"], content_type_callback) type_selector2 = widgets.create_toggle( ["articles", "talkthroughs", "scratchpads"], content_type_callback) plot_selector = widgets.create_toggle( ["Learners", "Learning Time", "Content Nodes Learned"], usage_type_callback, style="primary", button_width="300px", orientation="vertical") title = ipywidgets.HTML( value='<div class=VizTitle><h2> Content Usage </h2> </div>') toggle_container = ipywidgets.VBox(children=[ title, widgets.gap, type_selector1, type_selector2, widgets.gap, plot_selector ], width="300px") extras = [ ipywidgets.HTML(value='<div class=VizTitle><h4> Extras: </h4> </div>') ] extras.extend(extra_buttons) extra_container = ipywidgets.VBox(extras, width="200px") usage_container = ipywidgets.HBox( children=[toggle_container, comparison_selector, extra_container]) return usage_container, comparison_selector
def create_usage_widgets( content_type_callback, usage_type_callback, extra_buttons): """Create widgets used for visualizing content usage.""" comparison_selector = ipywidgets.SelectMultiple( options=cfg.NODES, selected_labels=["Physics", "Biology", "Chemistry"], width="200px") comparison_selector.height = '270px' type_selector1 = widgets.create_toggle( ["all", "videos", "exercises"], content_type_callback) type_selector2 = widgets.create_toggle( ["articles", "talkthroughs", "scratchpads"], content_type_callback) plot_selector = widgets.create_toggle( ["Learners", "Learning Time", "Content Nodes Learned"], usage_type_callback, style="primary", button_width="300px", orientation="vertical") title = ipywidgets.HTML( value='<div class=VizTitle><h2> Content Usage </h2> </div>') toggle_container = ipywidgets.VBox( children=[title, widgets.gap, type_selector1, type_selector2, widgets.gap, plot_selector], width="300px") extras = [ipywidgets.HTML( value='<div class=VizTitle><h4> Extras: </h4> </div>')] extras.extend(extra_buttons) extra_container = ipywidgets.VBox(extras, width="200px") usage_container = ipywidgets.HBox( children=[toggle_container, comparison_selector, extra_container]) return usage_container, comparison_selector
def create_production_widgets(content_type_callback, plot_type_callback): """Create widgets used for visualizing content production.""" comparison_selector = ipywidgets.SelectMultiple( options=[c for c in cfg.NODES if c != "Core Academic"], selected_labels=["Physics", "Biology", "Chemistry"]) comparison_selector.height = '270px' type_selector1 = widgets.create_toggle(["videos", "exercises", "articles"], content_type_callback) type_selector2 = widgets.create_toggle( ["tutorials", "projects", "challenges"], content_type_callback) all_button = ipywidgets.Button(description="all", button_style="info", width="300px") all_button.on_click(content_type_callback) plot_selector = widgets.create_toggle(["Total Content", "Added Content"], plot_type_callback, style="primary", button_width="300px", orientation="vertical") title = ipywidgets.HTML( value='<div class=VizTitle><h2> Content Production </h2> </div>') toggle_container = ipywidgets.VBox(children=[ title, widgets.gap, type_selector1, type_selector2, all_button, widgets.gap, plot_selector ], width="300px") prod_container = ipywidgets.HBox( children=[toggle_container, comparison_selector]) return prod_container, comparison_selector
def create_production_widgets(content_type_callback, plot_type_callback): """Create widgets used for visualizing content production.""" comparison_selector = ipywidgets.SelectMultiple( options=[c for c in cfg.NODES if c != "Core Academic"], selected_labels=["Physics", "Biology", "Chemistry"]) comparison_selector.height = '270px' type_selector1 = widgets.create_toggle( ["videos", "exercises", "articles"], content_type_callback) type_selector2 = widgets.create_toggle( ["tutorials", "projects", "challenges"], content_type_callback) all_button = ipywidgets.Button( description="all", button_style="info", width="300px") all_button.on_click(content_type_callback) plot_selector = widgets.create_toggle( ["Total Content", "Added Content"], plot_type_callback, style="primary", button_width="300px", orientation="vertical") title = ipywidgets.HTML( value='<div class=VizTitle><h2> Content Production </h2> </div>') toggle_container = ipywidgets.VBox( children=[title, widgets.gap, type_selector1, type_selector2, all_button, widgets.gap, plot_selector], width="300px") prod_container = ipywidgets.HBox( children=[toggle_container, comparison_selector]) return prod_container, comparison_selector