Skip to content

Commit

Permalink
Minor cleanup; light comment updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kdmukai committed Jan 8, 2024
1 parent becf007 commit a03940d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/seedsigner/gui/screens/psbt_screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,10 +704,15 @@ def __post_init__(self):
))
return
except UnicodeDecodeError:
# Contains data that can't be converted to UTF-8; probably encoded and not
# meant to be human readable.
chars_per_line = 16
# Contains data that can't be converted to UTF-8; it's probably just a blob
# of raw bytes that aren't meant to be human readable.

# Force the raw bytes into a display string by omitting non-decodable chars
decoded_str = self.op_return.decode(errors="ignore")

# Assume there won't be any whitespace for TextArea to auto linebreak on so
# we just manually break it up into lines here.
chars_per_line = 16
num_lines = math.ceil(len(decoded_str) / chars_per_line)
text = ""
for i in range(num_lines):
Expand All @@ -724,7 +729,6 @@ def __post_init__(self):

self.components.append(TextArea(
text=text,
# font_name=GUIConstants.FIXED_WIDTH_FONT_NAME,
font_size=font_size,
screen_y=label.screen_y + label.height + GUIConstants.COMPONENT_PADDING,
))
Expand Down
2 changes: 1 addition & 1 deletion tests/screenshot_generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def add_op_return_to_psbt(psbt: PSBT, raw_payload_data: bytes):
(psbt_views.PSBTAddressDetailsView, dict(address_num=0)),

(NotYetImplementedView, {}, "PSBTOverviewView_op_return"), # Placeholder
(NotYetImplementedView, {}, "PSBTOpReturnView_text"), # Placeholder
(NotYetImplementedView, {}, "PSBTOpReturnView_text"), # Placeholder
(NotYetImplementedView, {}, "PSBTOpReturnView_raw_bytes"), # Placeholder


Expand Down

0 comments on commit a03940d

Please sign in to comment.