Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Allow PSBTOverviewScreen to truncate "self-transfer" #217

Merged
merged 3 commits into from
Jun 14, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update psbt_screens.py
Ensure that regular displays that don't have space constraints aren't unnecessarily truncated.
  • Loading branch information
kdmukai committed May 26, 2022
commit fc988418e68ed3768cb498edc784b485a19fce5c
5 changes: 4 additions & 1 deletion src/seedsigner/gui/screens/psbt_screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def __post_init__(self):
# Now let's maximize the actual destination col by adjusting our addr truncation
def calculate_destination_col_width(truncate_at: int = 0):
def truncate_destination_addr(addr):
if len(addr) <= truncate_at + len("..."):
# No point in truncating
return addr
return f"{addr[:truncate_at]}..."

destination_column = []
Expand Down Expand Up @@ -154,7 +157,7 @@ def truncate_destination_addr(addr):
(destination_text_width, destination_column) = calculate_destination_col_width()
else:
# Steadliy widen out the destination column until we run out of space
for i in range(6, 13):
for i in range(6, 14):
(new_width, new_col_text) = calculate_destination_col_width(truncate_at=i)
if new_width > max_destination_col_width:
break
Expand Down