Ejemplo n.º 1
0
    def _get_param_iterator(self):
        """Return ParameterGrid instance for the given param_grid"""

        iterator = super()._get_param_iterator()
        iterator = list(iterator)
        n_candidates = len(iterator)

        cv = model_selection._split.check_cv(self.cv, None)
        n_splits = getattr(cv, "n_splits", 3)
        max_value = n_candidates * n_splits  # count the amount of iterations total

        progress_label = ipywidgets.HTML()
        progress_bar = ipywidgets.FloatProgress(min=0,
                                                max=max_value,
                                                description="GridSearchCV:")
        progress_box = ipywidgets.HBox(
            children=[progress_bar,
                      progress_label])  # setup a progress label + bar

        display(progress_box)
        original_fit = self.estimator.__class__.fit

        def fit(*args, **kwargs):
            progress_bar.value += (
                1)  # every time fit is called, increase progress bar by 1
            if (progress_bar.value == max_value
                ):  # if max value is reached, display finished and turn green
                progress_label.value = "finished"
                progress_bar.bar_style = "success"

            original_fit(*args, **kwargs)

        self.estimator.__class__.fit = fit

        return iterator
Ejemplo n.º 2
0
 def __init__(self):
     apt.progress.base.InstallProgress.__init__(self)
     self._label = ipywidgets.Label()
     display(self._label)
     self._float_progress = ipywidgets.FloatProgress(
         min=0.0, max=1.0, layout={'border': '1px solid #118800'})
     display(self._float_progress)
Ejemplo n.º 3
0
def brian2_progress_reporter():
    '''
    Returns a widget and callback function to be used with Brian 2
    '''
    progress_slider = ipw.FloatProgress(description="Simulation progress",
                                        min=0,
                                        max=1)
    progress_slider.layout.width = '95%'
    progress_slider.style = {'description_width': '30%'}

    def update_progress(elapsed, complete, t_start, duration):
        progress_slider.value = complete
        if complete == 1:
            progress_slider.bar_style = 'success'
            progress_slider.description = "Simulation complete"
        elif complete == 0:
            progress_slider.bar_style = ''
            progress_slider.description = "Simulation started"
        else:
            progress_slider.bar_style = ''
            time_remaining = elapsed / complete - elapsed
            seconds_remaining = int(time_remaining)
            minutes_remaining = seconds_remaining // 60
            seconds_remaining -= 60 * minutes_remaining
            hours_remaining = minutes_remaining // 60
            minutes_remaining -= 60 * hours_remaining
            remaining = str(seconds_remaining) + 's'
            if minutes_remaining or hours_remaining:
                remaining = str(minutes_remaining) + 'm ' + remaining
            if hours_remaining:
                remaining = str(hours_remaining) + 'h ' + remaining
            progress_slider.description = "Simulating (%s remaining)" % remaining

    return progress_slider, update_progress
Ejemplo n.º 4
0
    def __init__(
        self,
        iterable_or_max,
        title='',
        format_str='%(current)d/%(max)d (%(percent)d%%) in %(elapsed).1f s, %(last_iter_time).2f s last iter; eta %(eta_avg).0f+-%(eta_stddev).0f s'
    ):
        super(ProgressBarIPyNb, self).__init__(iterable_or_max, title)
        self.format_str = format_str

        self.progress_w = iw.FloatProgress(min=0,
                                           max=100,
                                           value=30,
                                           width='100%')
        self.title_w = iw.HTML(
            '<h3 style="display: inline">%(title)s</h3>&nbsp;' % self)
        self.info_w = iw.HTML()
        self.log_last_w = iw.HTML()

        self.log_check_w = iw.Checkbox(value=False,
                                       visible=False,
                                       description='Show Log')
        self.log_w = iw.HTML()
        self.log_header_w = iw.HTML('<h2><small>Log messages</small></h2>')
        directional_link((self.log_check_w, 'value'), (self.log_w, 'visible'))
        directional_link((self.log_check_w, 'value'),
                         (self.log_header_w, 'visible'))

        self.container_w = iw.VBox([
            iw.HBox([self.title_w, self.info_w, self.log_last_w]),
            iw.HBox([self.progress_w, self.log_check_w]), self.log_header_w,
            self.log_w,
            iw.HBox(height=20)
        ])

        self.displayed = False
Ejemplo n.º 5
0
def run_colab(population_size, network_pkl):
    G = load_network(network_pkl)
    population = genetic_algo.Population(G, population_size)
    
    phenotypes = _generate_phenotypes(population, G)
    board = Box(children=phenotypes, layout=Layout(display="flex", flex_flow="row wrap"))

    mutationInput = widgets.BoundedFloatText(value=0.01,min=0.0,max=1.0,step=0.01, layout=Layout(width="100px"))
    button = widgets.Button(description="Update")
    button.on_click(lambda _: _update(population, mutationInput, G, board, loading, button))
    mutationInputBox = widgets.VBox([Label("Taxa de mutação:"), mutationInput])
    loading = widgets.FloatProgress(
      value=100,
      min=0,
      max=100,
      bar_style='info',
      style={'bar_color': '#008080'},
      orientation='horizontal'
    ) 
    bottomBox = Box(
        children=[mutationInputBox, loading, button],
        layout=Layout(
            display="flex",
            width="100%",
            justify_content="space-between",
            align_items="flex-end",
            padding="0 15% 20px 0",
        ),
    )

    app = widgets.VBox([board, bottomBox])
    display(app)
Ejemplo n.º 6
0
def read_azi_list(fn_list, range_max):
    XML_data=[]
    data=[]
    r=[]
    azi=[] 
    data_list = []
    XML_list = []
    time_list = []
    
    pbar = ipywidgets.FloatProgress(min=0, max=len(fn_list)-1)
    display(pbar)
    #print "pbar"

    for i, fn in enumerate(fn_list):
        pbar.value = i
        #try:
        #azi_data = read_npz_data(fn, range_max)
        XML_data, azi_data, r, azi = rainbow(fn, XML_data, data, r, azi)
        data_list.append(azi_data)
        XML_list.append(XML_data)
        time = XML_data['date']+' '+XML_data['endtime_round']
        time_list.append(time)
        #except MemoryError:
            #print 'MemoryError for %s' % fn
    return data_list, XML_list, time_list
Ejemplo n.º 7
0
    def __init__(self, value=0):
        self._p_bar = iwdgt.FloatProgress()

        self._p_bar.min = 0
        self._p_bar.max = 100

        self.set_value(value=value)
Ejemplo n.º 8
0
    def spark_import_table(self, line, cell=None):
        global context_id
        args = magic_arguments.parse_argstring(self.spark_import_table, line)
        contextid='"%s"'%context_id
        output = widgets.Output()
        button = widgets.Button(description="Cancel")
        progress = widgets.FloatProgress(value=0.0, min=0.0, max=1.0)
        display(widgets.VBox([output,widgets.HBox([widgets.Label("Command: Import tables"),progress,button])]))
        
        if args.dataframe!=None:
            temp_import_table=import_table(args.dataframe,args.storename,args.tablename,
                                           args.partitionpaths or ["'/'"],args.sqlquery)
            command=execute_import_table_command(eval(contextid),temp_import_table)
            stop=spark_magic(button,progress,command,None,output,self.shell.user_ns,silent=True)
            while stop[0]==0:
                time.sleep(1)

            if stop[1]==1:
                code="%s.registerTempTable('%s')"%(temp_import_table['SparkDataFrameName'],temp_import_table['SparkDataFrameName'])
                command1=execute_command(eval(contextid),'1',code)
                stop=spark_magic(button,progress,command1,None,output,self.shell.user_ns)
        else:
            for cell_line in cell.split('\n'):
                if cell_line != "":
                    command=execute_import_table_command(eval(contextid),eval(cell_line))

                    stop=spark_magic(button,progress,command,None,output,self.shell.user_ns,silent=True)
                    while stop[0]==0:
                        time.sleep(1)

                    if stop[1]==1:
                        temp_import_table=eval(cell_line)
                        code="%s.registerTempTable('%s')"%(temp_import_table['SparkDataFrameName'],temp_import_table['SparkDataFrameName'])
                        command1=execute_command(eval(contextid),'1',code)
                        stop=spark_magic(button,progress,command1,None,output,self.shell.user_ns)  
Ejemplo n.º 9
0
def save_data(data, orbits, filepath='', filename=''):
    import IO
    import ipywidgets as widgets

    IO.save_file(data, filepath=filepath, filename=filename)

    a = list(data.get())
    b = orbits

    progress = sum([b[i] in a for i, _ in enumerate(b)])
    
    percent_progress = progress/len(b)*100

    print("{} out of {} : {:.03f}%".format(progress, len(b), percent_progress )  )

    progress = widgets.FloatProgress(
        value=progress,
        min=0,
        max=len(b),
        step=1,
        description='Progress:',
        bar_style='info',
        orientation='horizontal'
    )

    display(progress)
Ejemplo n.º 10
0
    def run(self,
            output_container,
            progress_desc,
            action,
            action_args=None,
            action_kwargs=None,
            timerlength=2.0,
            timerinterval=0.2):
        """Run an action in a thread after a delay and display output to an existing container

        WARNING: widgets can NOT be displayed directly from a non-main thread!
        Ref: https://github.com/jupyter-widgets/ipywidgets/issues/1790
        Instead, we must create a container widget, and then within the thread we can
        update its .children property to contain the items we wish to display

        output_container    an ipywidgets.Box which the caller is responsible for displaying
        progress_desc       description for the progress widget
        action              a function to call when the timer elapses
                            it should NOT display widgets directly,
                            but should return a list of widgets/outputs
                            that can be append to output_container.children
        action_args         a tuple of positional arguments for action
        action_kwargs       a dict of keyword arguments for action
        timerlength         length of delay
        timerinterval       update the progress widget this often
        """

        self.progresswidget = ipywidgets.FloatProgress(
            description=progress_desc, value=0.0, min=0.0, max=timerlength)

        action_args = action_args or ()
        action_kwargs = action_kwargs or {}

        self.stopevent.set()
        if self.thread is not None:
            # block until self.thread terminates (for self.timerinterval secs or shorter)
            logger.info("Stopping old thread...")
            self.thread.join()
            logger.info("Old thread stopped")
        self.stopevent.clear()

        self.progresswidget.value = 0.0

        # Create new containers for our progress bar and thread output,
        # put those in self.container,
        # and append self.container to output_container.children,
        # thereby throwing away existing *_container objects from a previous run()
        # This lets us overwrite the children of self.container,
        # without losing any preexisting children in container
        self.progbar_container = ipywidgets.Box()
        self.container.children = (self.progbar_container, )
        output_container.children += (self.container, )

        self.progbar_container.children = (self.progresswidget, )

        self.thread = threading.Thread(target=self.timer,
                                       args=(timerinterval, timerlength,
                                             action, action_args,
                                             action_kwargs))
        self.thread.start()
Ejemplo n.º 11
0
    def _bidding(self, player, owner):
        # Remove player from player pool
        the_pick = self.player_pool.loc[player]
        the_pick['Player'] = the_pick.index
        self.player_pool = self.player_pool.drop(player)

        # Get starting bid
        the_pick['Salary'] = input(
            '{}, what would you like the starting bid to be? '.format(owner))

        # Start clock
        self.clock = widgets.FloatProgress(value=0.0, min=0.0, max=1.0)

        def work(progress):
            for i in range(100):
                time.sleep(self.clock_num_sec / 100)
                progress.value = float(i + 1) / 100

        thread = ReusableThread(target=work, args=(self.clock, ))
        display(data=self.clock)
        thread.start()

        while True:
            bid = input('Enter bid and owner index (seperated by a space): ')
            if bid == '0':
                break
            the_pick['Salary'], the_pick['Owner'] = bid.split(' ')
            thread.restart()
        return the_pick
Ejemplo n.º 12
0
 def __init__(self, name=None):
     import ipywidgets as widgets
     from IPython.display import display
     self.value = 0
     self.widget = widgets.FloatProgress(min=0, max=1)
     self.widget.description = name or 'Progress:'
     display(self.widget)
Ejemplo n.º 13
0
    def __init__(self):
        missing = []
        if not HAVE_WIDGETS:
            missing.append('ipywidgets')
        elif not HAVE_IPYTHON:
            missing.append('IPython')

        if missing:
            raise ValueError(
                "IPythonWidgetProgressPublisher needs ipywidgets and IPython:"
                "\nMissing:\n{}".format(bulleted_list(missing))
            )

        # Heading for progress display.
        self._heading = ipywidgets.HTML()

        # Percent Complete Indicator to the left of the bar.
        indicator_width = '120px'
        self._percent_indicator = ipywidgets.HTML(
            layout={'width': indicator_width},
        )

        # The progress bar itself.
        self._bar = ipywidgets.FloatProgress(
            value=0.0,
            min=0.0,
            max=100.0,
            bar_style='info',
            # Leave enough space for the percent indicator.
            layout={'width': 'calc(100% - {})'.format(indicator_width)},
        )
        bar_and_percent = ipywidgets.HBox([self._percent_indicator, self._bar])

        # Collapsable details tab underneath the progress bar.
        self._details_body = ipywidgets.HTML()
        self._details_tab = ipywidgets.Accordion(
            children=[self._details_body],
            selected_index=None,  # Start in collapsed state.
            layout={
                # Override default border settings to make details tab less
                # heavy.
                'border': '1px',
            },
        )
        # There's no public interface for setting title in the constructor :/.
        self._details_tab.set_title(0, 'Details')

        # Container for the combined widget.
        self._layout = ProgressBarContainer(
            [
                self._heading,
                bar_and_percent,
                self._details_tab,
            ],
            # Overall layout consumes 75% of the page.
            layout={'width': '75%'},
        )

        self._displayed = False
Ejemplo n.º 14
0
    def __init__(self, display=True, stop_button=True):
        self.progress_bar = ipw.FloatProgress()
        if stop_button == True:
            self.stop_button = ipw.Button(description='Stop')

        else:
            self.stop_button = None
        self.display = display
Ejemplo n.º 15
0
 def get_progress_bar(self):
     if self._bar is None:
         import ipywidgets
         self._out = ipywidgets.Text(
             value=self.status or self.sampler.status)
         self._bar = ipywidgets.FloatProgress(value=self.progress,
                                              min=0.0,
                                              max=1.0)
     return ipywidgets.VBox([self._bar, self._out])
Ejemplo n.º 16
0
 def create_running_progress(self):
     self.running_progress = ipywidgets.FloatProgress(
         value=0.0,
         min=0.0,
         max=1.0,
         description=t('running_colon'),
         bar_style='info',
         orientation='horizontal')
     display(self.running_progress)
Ejemplo n.º 17
0
def gdrive_progress(display=True):
    """Return a GDrive download progress bar."""
    progress = ipw.FloatProgress(value=0.0,
                                 min=0.0,
                                 max=1.0,
                                 description='Download')
    if display:
        ipd.display(progress)
    return progress
Ejemplo n.º 18
0
 def __init__(self):
     if ipw is None:
         raise ImportError(
             "IPython support requires the ipywidgets package.")
     self.widget = ipw.FloatProgress(value=0.0,
                                     min=0.0,
                                     max=100.0,
                                     step=0.5,
                                     description="")
Ejemplo n.º 19
0
 def __init__(self, min_value, max_value, title=None):
     super(ProgressBarWidget, self).__init__(min_value, max_value)
     import ipywidgets as widgets
     from IPython.display import display
     self.bar = widgets.FloatProgress(min=self.min_value, max=self.max_value)
     self.text = widgets.Label(value='In progress...')
     self.widget = widgets.HBox([self.bar, self.text])
     # self.widget.description = repr(self)
     display(self.widget)
Ejemplo n.º 20
0
def progress_bars():
    progress_bar_nets = widgets.FloatProgress(
        value=0.,
        max=1.,
        step=0.01,
        bar_style='info',
        description='Number of nets explored:',
        layout=widgets.Layout(display='none'),
        style=style_default)
    progress_bar_dim = widgets.FloatProgress(
        value=0.,
        max=1.,
        step=0.01,
        bar_style='info',
        description='Number of dim explored:',
        layout=widgets.Layout(display='none'),
        style=style_default)
    return BaseGUIElement(progress_bar_dim=progress_bar_dim,
                          progress_bar_nets=progress_bar_nets)
Ejemplo n.º 21
0
 def __init__(self, description):
     import ipywidgets as ipy
     import traitlets
     try:
         self.progress_bar = ipy.FloatProgress(0,
                                               min=0,
                                               max=100,
                                               description=description)
     except traitlets.TraitError:
         self.progress_bar = None
Ejemplo n.º 22
0
    def __init__(self, iquery, num_results=5, max_results=100):
        self._iquery = iquery

        self._query = widgets.Text(value='',
                                   placeholder='Your Query',
                                   description='Query:',
                                   disabled=False,
                                   layout={'width': '40em'},
                                   style=ROOT_LEVEL_STYLE,
                                   continuous_update=False)
        self._query.observe(self.on_search, 'value')

        self._submit_query = widgets.Button(description='Search',
                                            button_style='success',
                                            icon='search')
        self._submit_query.on_click(self.on_search)

        self._partition = PartitionWidget(iquery)
        self._sentence = PartitionMetricWidget(iquery)

        self._progress = widgets.FloatProgress(value=0,
                                               min=0,
                                               max=1,
                                               description='',
                                               layout=widgets.Layout(
                                                   width='100%',
                                                   visibility='hidden'))

        self._num_results_slider = widgets.IntSlider(description='Results:',
                                                     value=num_results,
                                                     min=1,
                                                     max=max_results,
                                                     step=1,
                                                     layout={'width': '40em'},
                                                     style=ROOT_LEVEL_STYLE)

        self._location_formatter = vectorian.render.location.LocationFormatter(
        )

        self._render = MatchRenderWidget(iquery)
        self._results = widgets.HTML(value='')

        self._results_format = 'excerpt'
        self._results_obj = None

        widgets.Accordion(children=[], titles=[])

        self._vbox = widgets.VBox([
            widgets.HBox([self._query,
                          self._submit_query]), self._num_results_slider,
            self._partition.widget, self._sentence.widget, self._render.widget,
            self._progress, self._results
        ])

        self._task_start_time = None
Ejemplo n.º 23
0
    def __init__(self, select_indexes_function, zip_prepend):

        self.series = {}

        self.extent = None
        self.figure_xy_ratio = None
        self.wc_pk = None

        self.zip_prepend = zip_prepend

        self.select_indexes_function = select_indexes_function

        ### -------------------------------------------
        ### Selector

        self.elem_list = []
        self.selections_vbox = ipw.VBox([])

        self.add_row_btn = ipw.Button(description='Add series row',
                                      disabled=True)
        self.add_row_btn.on_click(lambda b: self.add_selection_row())

        style = {'description_width': '80px'}
        layout = {'width': '40%'}

        self.selector_widget = ipw.VBox(
            [self.add_row_btn, self.selections_vbox])
        ### -------------------------------------------
        ### Plotter

        self.plot_btn = ipw.Button(description='Plot', disabled=True)
        self.plot_btn.on_click(self.plot_series)

        self.clear_btn = ipw.Button(description='Clear', disabled=True)
        self.clear_btn.on_click(self.full_clear)

        self.plot_output = ipw.VBox()
        ### -------------------------------------------

        self.fig_y = 4

        ### -------------------------------------------
        ### Creating a zip
        self.zip_btn = ipw.Button(description='Image zip', disabled=True)
        self.zip_btn.on_click(self.create_zip_link)

        self.zip_progress = ipw.FloatProgress(value=0,
                                              min=0,
                                              max=1.0,
                                              description='progress:',
                                              bar_style='info',
                                              orientation='horizontal')

        self.link_out = ipw.Output()
Ejemplo n.º 24
0
 def __init__(self, iterable, size=None):
     self.it = iter(iterable)
     if not size: size = len(iterable)
     self.size = size
     self.current = 0
     self.next_report_time = time.time() + MIN_REPORT_INTERVAL
     assert type(MIN_REPORT_PERCENTAGE) == float
     self.min_report_interval_count = MIN_REPORT_PERCENTAGE * size
     self.next_report_count = self.min_report_interval_count
     self.f = ipyw.FloatProgress(max=size)
     ipyd.display(self.f)
Ejemplo n.º 25
0
def integrateODSeries(ODs, parameters, start_stop=[0, 3], fignum=1):
    num_traces = len(ODs)
    integrated_ODs = np.zeros(num_traces)
    progress = widgets.FloatProgress(value=0.0, min=0.0, max=1.0)
    display(progress)
    for i in range(num_traces):
        time_ms = timeArray(parameters[i])
        integrated_ODs[i] = sliceIntegrate(ODs[i], time_ms, start_stop, fignum)
        if i == 0:
            num_traces += 1
        progress.value = float(i) / (num_traces - 1)
    return integrated_ODs
Ejemplo n.º 26
0
def make_sample_ui(width="600px"):
    """
    Construct sample UI using ipywidgets

    +-------------------------------+
    | Pick your favorite food color |
    | <===progress bar=============>|
    | [b1] [b2] [b3] ..         [bn]|
    | <<<<<<<<< dbg output >>>>>>>>>|
    +-------------------------------+

    Returns object with properties:

      .ui       -- Top level ui container `display(state.ui)`
      .color    -- None initially, set to text when user select color by pressing button
      .progress -- FloatProgress(0, 10)
      .dbg      -- ipywidgets.Output()
    """
    colors = ["lime", "olive", "tomato", "salmon", "wheat", "orange", "plum"]

    progress = w.FloatProgress(value=0,
                               min=0,
                               max=1,
                               description="",
                               layout=w.Layout(width="100%"))
    lbl = w.HTML(
        "<center><h2>Pick your favorite food color</h2></center>",
        layout=w.Layout(width="100%"),
    )

    state = SimpleNamespace(color=None,
                            progress=progress,
                            ui=None,
                            dbg=w.Output())

    def on_btn_click(btn):
        state.color = btn.description
        with state.dbg:
            print("\nClicked {}".format(btn.description))

    def mk_btn(color):
        btn = w.Button(description=color, style=dict(button_color=color))
        btn.on_click(on_btn_click)
        return btn

    state.ui = w.VBox(
        [
            lbl, progress,
            w.HBox([mk_btn(color) for color in colors]), state.dbg
        ],
        layout=w.Layout(width=width, overflow="hidden"),
    )
    return state
Ejemplo n.º 27
0
def getRawDataset_BUB(folder_path,
                      start_num,
                      stop_num,
                      print_bool,
                      skips=[],
                      initial=False,
                      alternate=False):
    stop_num += 1
    blocked_YbOH_raw = []  #ch1
    blocked_Yb_raw = []  #ch2
    blocked_params = []
    unblocked_YbOH_raw = []
    unblocked_Yb_raw = []
    unblocked_params = []

    blocked = initial
    switch_b_ub = True

    progress = widgets.FloatProgress(value=0.0, min=0.0, max=1.0)
    display(progress)
    for i in range(start_num, stop_num):
        if i in skips:
            pass
        else:
            if blocked:
                data, params = file2dataset(folder_path, i, print_bool)
                params[blocked_INDEX] = blocked
                blocked_YbOH_raw.append(data[0])
                blocked_Yb_raw.append(data[1])
                blocked_params.append(params)
                #print('blocked ',i)
            elif not blocked:
                data, params = file2dataset(folder_path, i, print_bool)
                params[blocked_INDEX] = blocked
                unblocked_YbOH_raw.append(data[0])
                unblocked_Yb_raw.append(data[1])
                unblocked_params.append(params)
                #print('unblocked ',i)
            if alternate:
                if switch_b_ub:
                    blocked = not blocked
                    switch_b_ub = False
                else:
                    switch_b_ub = True
            else:
                blocked = not blocked
        progress.value = float(i - start_num + 1) / (stop_num - start_num)
    blocked_dataset = [blocked_YbOH_raw, blocked_Yb_raw, blocked_params]
    unblocked_dataset = [
        unblocked_YbOH_raw, unblocked_Yb_raw, unblocked_params
    ]
    return [blocked_dataset, unblocked_dataset]
Ejemplo n.º 28
0
def brian2_progress_reporter():
    '''
    Returns a widget and callback function to be used with Brian 2
    '''
    progress_slider = ipw.FloatProgress(description="Simulation progress", min=0, max=1)
    progress_slider.layout.width = '100%'
    def update_progress(elapsed, complete, t_start, duration):
        progress_slider.value = complete
        if complete==1:
            progress_slider.bar_style = 'success'
        else:
            progress_slider.bar_style = ''    
    return progress_slider, update_progress
Ejemplo n.º 29
0
 def __init__(self, app):
     self.app = app
     self._ProgressWidget = widgets.FloatProgress(
         0, description=self.app.__class__.__name__, bar_style='')
     self._PauseButton = widgets.Button(description="Pause")
     self._PauseButton.on_click(self.on_pause_button_clicked)
     self._InterruptButton = widgets.Button(description="Interrupt")
     self._InterruptButton.on_click(self.on_interrupt_button_clicked)
     self._usedTimeLabel = widgets.Label(value='00:00:00')
     self.ui = widgets.HBox([
         self._PauseButton, self._InterruptButton, self._ProgressWidget,
         self._usedTimeLabel
     ])
Ejemplo n.º 30
0
 def spark(self, line, cell):
     global context_id
     args = magic_arguments.parse_argstring(self.spark, line)
     contextid='"%s"'%context_id
     out=args.out
     command=execute_command(eval(contextid),'1',cell)
     
     output = widgets.Output()
     button = widgets.Button(description="Cancel")
     progress = widgets.FloatProgress(value=0.0, min=0.0, max=1.0)
     display(widgets.VBox([output,widgets.HBox([widgets.Label("CommandId: %s"%command['CommandId']),progress,button])]))
     
     spark_magic(button,progress,command,out,output,self.shell.user_ns)