Skip to content
Open
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions pudb/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -2617,10 +2617,25 @@ def interaction(self, exc_tuple, show_exc_dialog=True):
self.current_exc_tuple = exc_tuple

from pudb import VERSION
caption = [(None,
"PuDB %s - ?:help n:next s:step into b:breakpoint "
"!:python command line"
% VERSION)]
separator = " - "
info_string = separator.join(["PuDB %s" % VERSION, "?:help"])

def get_source_filename():
available_width = self.screen.get_cols_rows(
)[0] - (len(info_string) + len(separator))
full_filename = self.source_code_provider.get_source_identifier()
if (full_filename is None):
return "Source filename not available"
elif available_width > len(full_filename):
return full_filename
else:
trim_index = len(full_filename) - available_width
filename = full_filename[trim_index:]
first_dirname_index = filename.find(os.sep)
filename = filename[first_dirname_index + 1:]
return filename

caption = [(None, separator.join([info_string, get_source_filename()]))]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on that! This isn't quite the right way to do this IMO. Instead, this should be done in the repaint method for a widget, where Urwid supplies the amount of space available.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need more guidance because I'm not sure what you are referring to.

this should be done in the repaint method for a widget

Are you talking about urwid.Text.render, or some repaint code in PuDB, or something else?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm talking about subclassing urwid.Widget or Text and implementing our own render method.


if self.debugger.post_mortem:
if show_exc_dialog and exc_tuple is not None:
Expand Down