def dbg(frame = slider(vmin=0, vmax=len(self._stack)-1-5, step_size=1, default=len(self._stack)-1-5, label='stack frame'), lines = slider(vmin=3, vmax=99, step_size=2, default=11, label='lines of context'), command = input_box("", label="", type=str), button = selector(['Evaluate'], label='', buttons=True) ): # Frame number 5 corresponds to the code which was # executed in the notebook cell. The frames 0 to 4 are # notebook code and not that interesting to the user. frame = frame + 5 if self._last is None: self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame} if self._last['lines'] != lines: # they dragged the number-of-lines slider, so done pass elif self._last['command'] != command and command.strip(): # they changed the command, so evaluate that self.evaluate(command) elif self._last['frame'] != frame: # they dragged the frame slider. self._curframe_index = frame elif command: # must have hit the evaluate button self.evaluate(command) print '<html><hr>' + self.listing(lines//2) + '</html>' # save control state for next time around self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame}
def dbg(frame = slider(vmin=0, vmax=len(self._stack)-1, step_size=1, default=len(self._stack)-1, label='stack frame'), lines = slider(vmin=3, vmax=99, step_size=2, default=11, label='lines of context'), command = input_box("", label="", type=str), button = selector(['Evaluate'], label='', buttons=True) ): if self._last is None: self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame} if self._last['lines'] != lines: # they dragged the number-of-lines slider, so done pass elif self._last['command'] != command and command.strip(): # they changed the command, so evaluate that self.evaluate(command) elif self._last['frame'] != frame: # they dragged the frame slider. self._curframe_index = frame elif command: # must have hit the evaluate button self.evaluate(command) print('<html><hr>{}</html>'.format(self.listing(lines//2))) # save control state for next time around self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame}
def dbg( frame=slider( vmin=0, vmax=len(self._stack) - 1 - 5, step_size=1, default=len(self._stack) - 1 - 5, label="stack frame", ), lines=slider(vmin=3, vmax=99, step_size=2, default=11, label="lines of context"), command=input_box("", label="", type=str), button=selector(["Evaluate"], label="", buttons=True), ): # Frame number 5 corresponds to the code which was # executed in the notebook cell. The frames 0 to 4 are # notebook code and not that interesting to the user. frame = frame + 5 if self._last is None: self._last = {"command": command, "button": button, "lines": lines, "frame": frame} if self._last["lines"] != lines: # they dragged the number-of-lines slider, so done pass elif self._last["command"] != command and command.strip(): # they changed the command, so evaluate that self.evaluate(command) elif self._last["frame"] != frame: # they dragged the frame slider. self._curframe_index = frame elif command: # must have hit the evaluate button self.evaluate(command) print "<html><hr>" + self.listing(lines // 2) + "</html>" # save control state for next time around self._last = {"command": command, "button": button, "lines": lines, "frame": frame}