mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 23:18:25 +00:00
darker qr option and better bitcoin address formatting
This commit is contained in:
@@ -673,12 +673,8 @@ class Controller(Singleton):
|
||||
|
||||
address = decoder.getAddress()
|
||||
address_type = decoder.getAddressType()
|
||||
# address_parts = textwrap.wrap(address, 30)
|
||||
address_parts = [address[i:i+22] for i in range(0, len(address), 22)]
|
||||
address_part_1 = address_parts[0]
|
||||
address_part_2 = address_parts[1] if len(address_parts) >= 2 else ""
|
||||
address_part_3 = address_parts[2] if len(address_parts) >= 3 else ""
|
||||
self.menu_view.draw_modal(["Bitcoin Address", address_part_1, address_part_2, address_part_3], "", "Right to Continue")
|
||||
|
||||
self.menu_view.draw_address(address)
|
||||
self.buttons.wait_for([B.KEY_RIGHT])
|
||||
|
||||
validate_network = NETWORKS[self.settings.network]
|
||||
@@ -714,7 +710,7 @@ class Controller(Singleton):
|
||||
if not seed:
|
||||
# no valid seed yet, gather seed phrase
|
||||
# display menu to select 12 or 24 word seed for last word
|
||||
ret_val = self.menu_view.display_qr_12_24_word_menu("... [ Return to Main Menu ]")
|
||||
ret_val = self.menu_view.display_qr_12_24_word_menu("... [ Cancel ]")
|
||||
if ret_val == Path.SEED_WORD_12:
|
||||
seed.mnemonic = self.seed_tools_view.display_manual_seed_entry(12)
|
||||
elif ret_val == Path.SEED_WORD_24:
|
||||
@@ -1065,21 +1061,33 @@ class Controller(Singleton):
|
||||
elif self.current_bg_qr_color == "BBBBBB":
|
||||
self.current_bg_qr_color = "999999"
|
||||
elif self.current_bg_qr_color == "999999":
|
||||
self.current_bg_qr_color = "777777"
|
||||
elif self.current_bg_qr_color == "777777":
|
||||
self.current_bg_qr_color = "555555"
|
||||
elif self.current_bg_qr_color == "555555":
|
||||
self.current_bg_qr_color = "333333"
|
||||
elif self.current_bg_qr_color == "333333":
|
||||
self.current_bg_qr_color = "FFFFFF"
|
||||
|
||||
|
||||
self.settings.qr_background_color = self.current_bg_qr_color
|
||||
|
||||
### prev_qr_background_colors()
|
||||
|
||||
def prev_qr_background_color(self):
|
||||
if self.current_bg_qr_color == "999999":
|
||||
if self.current_bg_qr_color == "333333":
|
||||
self.current_bg_qr_color = "555555"
|
||||
elif self.current_bg_qr_color == "555555":
|
||||
self.current_bg_qr_color = "777777"
|
||||
elif self.current_bg_qr_color == "777777":
|
||||
self.current_bg_qr_color = "999999"
|
||||
elif self.current_bg_qr_color == "999999":
|
||||
self.current_bg_qr_color = "BBBBBB"
|
||||
elif self.current_bg_qr_color == "BBBBBB":
|
||||
self.current_bg_qr_color = "DDDDDD"
|
||||
elif self.current_bg_qr_color == "DDDDDD":
|
||||
self.current_bg_qr_color = "FFFFFF"
|
||||
elif self.current_bg_qr_color == "FFFFFF":
|
||||
self.current_bg_qr_color = "999999"
|
||||
self.current_bg_qr_color = "333333"
|
||||
|
||||
self.settings.qr_background_color = self.current_bg_qr_color
|
||||
|
||||
|
||||
@@ -207,6 +207,37 @@ class View:
|
||||
|
||||
return
|
||||
|
||||
def draw_address(self, address) -> None:
|
||||
|
||||
if address.startswith(tuple(['1','2','3'])):
|
||||
dividby = 14
|
||||
else:
|
||||
dividby = 18
|
||||
address_parts = [address[i:i+dividby] for i in range(0, len(address), dividby)]
|
||||
address_part_1 = address_parts[0]
|
||||
address_part_2 = address_parts[1] if len(address_parts) >= 2 else ""
|
||||
address_part_3 = address_parts[2] if len(address_parts) >= 3 else ""
|
||||
address_part_4 = address_parts[3] if len(address_parts) >= 4 else ""
|
||||
|
||||
View.draw.rectangle((0, 0, View.canvas_width, View.canvas_height), outline=0, fill=0)
|
||||
|
||||
tw, th = View.draw.textsize("Right to Continue", font=View.ASSISTANT18)
|
||||
View.draw.text(((240 - tw) / 2, 210), "Right to Continue", fill=View.color, font=View.ASSISTANT18)
|
||||
|
||||
tw, th = View.draw.textsize("Bitcoin Address", font=View.ASSISTANT22)
|
||||
View.draw.text(((240 - tw) / 2, 35), "Bitcoin Address", fill=View.color, font=View.ASSISTANT22)
|
||||
tw, th = View.draw.textsize(address_part_1, font=View.ROBOTOCONDENSED_REGULAR_22)
|
||||
View.draw.text(((240 - tw) / 2, 70), address_part_1, fill=View.color, font=View.ROBOTOCONDENSED_REGULAR_22)
|
||||
tw, th = View.draw.textsize(address_part_2, font=View.ROBOTOCONDENSED_REGULAR_22)
|
||||
View.draw.text(((240 - tw) / 2, 105), address_part_2, fill=View.color, font=View.ROBOTOCONDENSED_REGULAR_22)
|
||||
tw, th = View.draw.textsize(address_part_3, font=View.ROBOTOCONDENSED_REGULAR_22)
|
||||
View.draw.text(((240 - tw) / 2, 140), address_part_3, fill=View.color, font=View.ROBOTOCONDENSED_REGULAR_22)
|
||||
tw, th = View.draw.textsize(address_part_4, font=View.ROBOTOCONDENSED_REGULAR_22)
|
||||
View.draw.text(((240 - tw) / 2, 175), address_part_4, fill=View.color, font=View.ROBOTOCONDENSED_REGULAR_22)
|
||||
|
||||
View.DispShowImage()
|
||||
|
||||
return
|
||||
|
||||
def draw_prompt_yes_no(self, lines = [], title = "", bottom = "") -> None:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user