def max_sidebar(w, size, key): from pudb.settings import save_config weight = 5 CONFIG["sidebar_width"] = weight save_config(CONFIG) self.columns.column_types[1] = "weight", weight self.columns._invalidate()
def shrink_sidebar(w, size, key): from pudb.settings import save_config _, weight = self.columns.column_types[1] if weight > 1/5: weight /= 1.25 CONFIG["sidebar_width"] = weight save_config(CONFIG) self.columns.column_types[1] = "weight", weight self.columns._invalidate()
def change_rhs_box(name, index, direction, w, size, key): from pudb.settings import save_config _, weight = self.rhs_col.item_types[index] if direction < 0: if weight > 1/5: weight /= 1.25 else: if weight < 5: weight *= 1.25 CONFIG[name+"_weight"] = weight save_config(CONFIG) self.rhs_col.item_types[index] = "weight", weight self.rhs_col._invalidate()
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ NUM_VERSION = (2018, 1) VERSION = ".".join(str(nv) for nv in NUM_VERSION) __version__ = VERSION from pudb.py3compat import raw_input, PY3 from pudb.settings import load_config, save_config CONFIG = load_config() save_config(CONFIG) class PudbShortcuts(object): @property def db(self): import sys dbg = _get_debugger() import threading if isinstance(threading.current_thread(), threading._MainThread): set_interrupt_handler() dbg.set_trace(sys._getframe().f_back) @property def go(self):
NUM_VERSION = (2015, 1) VERSION = ".".join(str(nv) for nv in NUM_VERSION) __version__ = VERSION from pudb.py3compat import raw_input, PY3 from pudb.settings import load_config, save_config CONFIG = load_config() save_config(CONFIG) class PudbShortcuts(object): @property def db(self): import sys dbg = _get_debugger() set_interrupt_handler() dbg.set_trace(sys._getframe().f_back) if PY3: import builtins builtins.__dict__["pu"] = PudbShortcuts() else: import __builtin__ __builtin__.__dict__["pu"] = PudbShortcuts() CURRENT_DEBUGGER = []
def event_loop(self, toplevel=None): prev_quit_loop = self.quit_event_loop try: import pygments except ImportError: if not hasattr(self, "pygments_message_shown"): self.pygments_message_shown = True self.message("Package 'pygments' not found. " "Syntax highlighting disabled.") from pudb import CONFIG WELCOME_LEVEL = "e001" if CONFIG["seen_welcome"] < WELCOME_LEVEL: CONFIG["seen_welcome"] = WELCOME_LEVEL from pudb import VERSION self.message("Welcome to PudB %s!\n\n" "PuDB is a full-screen, console-based visual debugger for Python. " " Its goal is to provide all the niceties of modern GUI-based " "debuggers in a more lightweight and keyboard-friendly package. " "PuDB allows you to debug code right where you write and test it--in " "a terminal. If you've worked with the excellent (but nowadays " "ancient) DOS-based Turbo Pascal or C tools, PuDB's UI might " "look familiar.\n\n" "If you're new here, welcome! The help screen (invoked by hitting " "'?' after this message) should get you on your way.\n" "\nNew features in version 2011.3:\n\n" "- Finer-grained string highlighting (submitted by Aaron Meurer)\n" "- Prefs tweaks, instant-apply, top-down stack (submitted by Aaron Meurer)\n" "- Size changes in sidebar boxes (submitted by Aaron Meurer)\n" "- New theme 'midnight' (submitted by Aaron Meurer)\n" "- Support for IPython 0.11 (submitted by Chris Farrow)\n" "- Suport for custom stringifiers (submitted by Aaron Meurer)\n" "\nNew features in version 2011.2:\n\n" "- Fix for post-mortem debugging (submitted by 'Sundance')\n" "\nNew features in version 2011.1:\n\n" "- Breakpoints saved between sessions\n" "- A new 'dark vim' theme\n" "(both contributed by Naveen Michaud-Agrawal)\n" "\nNew features in version 0.93:\n\n" "- Stored preferences (no more pesky IPython prompt!)\n" "- Themes\n" "- Line numbers (optional)\n" % VERSION) from pudb.settings import save_config save_config(CONFIG) self.run_edit_config() try: if toplevel is None: toplevel = self.top self.size = self.screen.get_cols_rows() self.quit_event_loop = False while not self.quit_event_loop: canvas = toplevel.render(self.size, focus=True) self.screen.draw_screen(self.size, canvas) keys = self.screen.get_input() for k in keys: if k == "window resize": self.size = self.screen.get_cols_rows() else: toplevel.keypress(self.size, k) return self.quit_event_loop finally: self.quit_event_loop = prev_quit_loop
def run_edit_config(self): from pudb.settings import edit_config, save_config edit_config(self, CONFIG) save_config(CONFIG)