Skip to content

Commit

Permalink
Merge pull request #53 from newtonick/passphrase_qr_seeds
Browse files Browse the repository at this point in the history
Minor prerelease adjustments
  • Loading branch information
SeedSigner authored Jul 14, 2021
2 parents e2f500d + c55d682 commit be41698
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 36 deletions.
4 changes: 2 additions & 2 deletions src/seedsigner/models/generic_ur2_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def process_camera_data(self):
if not self.capture_complete():
View.draw.rectangle((0, 0, View.canvas_width, View.canvas_height), outline=0, fill=0)
tw, th = View.draw.textsize("Collecting QR Codes:", font=View.IMPACT25)
View.draw.text(((240 - tw) / 2, 15), "Collecting QR Codes:", fill="ORANGE", font=View.IMPACT25)
View.draw.text(((240 - tw) / 2, 15), "Collecting QR Codes:", fill=View.color, font=View.IMPACT25)
tw, th = View.draw.textsize(str(round(self.percentage_complete * 100)) + "% Complete", font=View.IMPACT22)
View.draw.text(((240 - tw) / 2, 125), str(round(self.percentage_complete * 100)) + "% Complete", fill="ORANGE", font=View.IMPACT22)
View.draw.text(((240 - tw) / 2, 125), str(round(self.percentage_complete * 100)) + "% Complete", fill=View.color, font=View.IMPACT22)
View.DispShowImage()

elif self.scan_started_ind == 0:
Expand Down
49 changes: 24 additions & 25 deletions src/seedsigner/views/seed_tools_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,33 +237,33 @@ def draw_gather_passphrase(self):
# Screen Title
View.draw.rectangle((0, 0, View.canvas_width, View.canvas_height), outline=0, fill=0)
tw, th = View.draw.textsize("Add Passphrase", font=View.IMPACT18)
View.draw.text(((240 - tw) / 2, 2), "Add Passphrase", fill="ORANGE", font=View.IMPACT18)
View.draw.text(((240 - tw) / 2, 2), "Add Passphrase", fill=View.color, font=View.IMPACT18)

# Screen Botton
tw, th = View.draw.textsize("use joystick to add and", font=View.IMPACT18)
View.draw.text(((240 - tw) / 2, 197), "use joystick to add and", fill="ORANGE", font=View.IMPACT18)
View.draw.text(((240 - tw) / 2, 197), "use joystick to add and", fill=View.color, font=View.IMPACT18)
tw, th = View.draw.textsize("remove passphrase characters", font=View.IMPACT18)
View.draw.text(((240 - tw) / 2, 217), "remove passphrase characters", fill="ORANGE", font=View.IMPACT18)
View.draw.text(((240 - tw) / 2, 217), "remove passphrase characters", fill=View.color, font=View.IMPACT18)

# Display passphrase selection in progress
View.draw.text((5,33), "Phrase:", fill="ORANGE", font=View.IMPACT20)
View.draw.text((72,35), self.passphrase[:14] + "▒", fill="ORANGE", font=View.COURIERNEW20)
View.draw.text((5,33), "Phrase:", fill=View.color, font=View.IMPACT20)
View.draw.text((72,35), self.passphrase[:14] + "▒", fill=View.color, font=View.COURIERNEW20)

if len(self.passphrase) >= 14:
View.draw.text((72,50), self.passphrase[14:] + "▒", fill="ORANGE", font=View.COURIERNEW20)
View.draw.text((72,50), self.passphrase[14:] + "▒", fill=View.color, font=View.COURIERNEW20)

# Display message when max passphrase length reached
if len(self.passphrase) >= 28:
View.draw.text((50,70), "Max passphrase of 28", fill="ORANGE", font=View.IMPACT18)
View.draw.text((53,90), "characters reached", fill="ORANGE", font=View.IMPACT18)
View.draw.text((50,70), "Max passphrase of 28", fill=View.color, font=View.IMPACT18)
View.draw.text((53,90), "characters reached", fill=View.color, font=View.IMPACT18)

# Save Button
c_x_offset = 240 - View.IMPACT25.getsize("Exit")[0]
View.draw.text((c_x_offset , 172), "Exit", fill="ORANGE", font=View.IMPACT22)
View.draw.text((c_x_offset , 172), "Exit", fill=View.color, font=View.IMPACT22)

# Toglle Button
x = 240 - View.IMPACT20.getsize(self.pass_case_toggle)[0]
View.draw.text((x, 110), self.pass_case_toggle, fill="ORANGE", font=View.IMPACT20)
View.draw.text((x, 110), self.pass_case_toggle, fill=View.color, font=View.IMPACT20)

# draw letter and arrows
if self.pass_case_toggle == "lower":
Expand All @@ -274,17 +274,15 @@ def draw_gather_passphrase(self):
pass_letter_disp = self.pass_letter

tw, th = View.draw.textsize(pass_letter_disp, font=View.IMPACT35)
View.draw.text((((30-tw)/2), 112), pass_letter_disp, fill="ORANGE", font=View.IMPACT35)
View.draw.polygon([(8, 105) , (14, 89) , (20, 105 )], outline="ORANGE", fill="BLACK")
View.draw.polygon([(8, 168), (14, 184), (20, 168)], outline="ORANGE", fill="BLACK")
View.draw.text((((30-tw)/2), 112), pass_letter_disp, fill=View.color, font=View.IMPACT35)
View.draw.polygon([(8, 105) , (14, 89) , (20, 105 )], outline=View.color, fill="BLACK")
View.draw.polygon([(8, 168), (14, 184), (20, 168)], outline=View.color, fill="BLACK")

View.DispShowImage()

return

def gather_passphrase_up(self):
# View.draw.polygon([(8, 105) , (14, 89) , (20, 105 )], outline="ORANGE", fill="ORANGE")
# View.DispShowImage()

pass_choice = self.get_pass_value_options()

Expand All @@ -295,8 +293,6 @@ def gather_passphrase_up(self):
self.pass_letter = pass_choice[idx-1]

def gather_passphrase_down(self):
# View.draw.polygon([(8, 168) , (14, 184) , (20, 168 )], outline="ORANGE", fill="ORANGE")
# View.DispShowImage()

pass_choice = self.get_pass_value_options()

Expand Down Expand Up @@ -357,7 +353,10 @@ def display_last_word(self, partial_seed_phrase) -> list:
self.draw.text(((240 - tw) / 2, 60), "The final word is :", fill=View.color, font=View.IMPACT23)
tw, th = self.draw.textsize(last_word, font=View.IMPACT50)
self.draw.text(((240 - tw) / 2, 90), last_word, fill=View.color, font=View.IMPACT50)
self.draw.text((73, 210), "Right to Continue", fill=View.color, font=View.IMPACT18)

tw, th = View.draw.textsize("Right to Continue", font=View.IMPACT18)
View.draw.text(((240 - tw) / 2, 210), "Right to Continue", fill=View.color, font=View.IMPACT18)

View.DispShowImage()

input = self.buttons.wait_for([B.KEY_RIGHT])
Expand Down Expand Up @@ -739,14 +738,14 @@ def seed_phrase_as_qr(self, seed_phrase):
draw.rectangle((View.canvas_width - mask_width - 1, mask_height, View.canvas_width, View.canvas_height - mask_height), fill=mask_rgba)

# Draw a box around the cutout portion of the mask for better visibility
draw.line((mask_width, mask_height, mask_width, View.canvas_height - mask_height), fill="ORANGE")
draw.line((View.canvas_width - mask_width, mask_height, View.canvas_width - mask_width, View.canvas_height - mask_height), fill="ORANGE")
draw.line((mask_width, mask_height, View.canvas_width - mask_width, mask_height), fill="ORANGE")
draw.line((mask_width, View.canvas_height - mask_height, View.canvas_width - mask_width, View.canvas_height - mask_height), fill="ORANGE")
draw.line((mask_width, mask_height, mask_width, View.canvas_height - mask_height), fill=View.color)
draw.line((View.canvas_width - mask_width, mask_height, View.canvas_width - mask_width, View.canvas_height - mask_height), fill=View.color)
draw.line((mask_width, mask_height, View.canvas_width - mask_width, mask_height), fill=View.color)
draw.line((mask_width, View.canvas_height - mask_height, View.canvas_width - mask_width, View.canvas_height - mask_height), fill=View.color)

msg = "click to exit"
tw, th = draw.textsize(msg, font=View.IMPACT18)
draw.text(((View.canvas_width - tw) / 2, View.canvas_height - th - 2), msg, fill="ORANGE", font=View.IMPACT18)
draw.text(((View.canvas_width - tw) / 2, View.canvas_height - th - 2), msg, fill=View.color, font=View.IMPACT18)

def draw_block_labels(cur_block_x, cur_block_y):
# Create overlay for block labels (e.g. "D-5")
Expand All @@ -755,8 +754,8 @@ def draw_block_labels(cur_block_x, cur_block_y):

block_labels = Image.new("RGBA", (View.canvas_width, View.canvas_height), (255,255,255,0))
draw = ImageDraw.Draw(block_labels)
draw.rectangle((mask_width, 0, View.canvas_width - mask_width, pixels_per_block), fill="ORANGE")
draw.rectangle((0, mask_height, pixels_per_block, View.canvas_height - mask_height), fill="ORANGE")
draw.rectangle((mask_width, 0, View.canvas_width - mask_width, pixels_per_block), fill=View.color)
draw.rectangle((0, mask_height, pixels_per_block, View.canvas_height - mask_height), fill=View.color)

label_font = View.COURIERNEW24
x_label = block_labels_x[cur_block_x]
Expand Down
18 changes: 9 additions & 9 deletions src/seedsigner/views/signing_tools_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ def display_transaction_information(self, wallet) -> None:
self.draw.rectangle((0, 0, View.canvas_width, View.canvas_height), outline=0, fill=0)

tw, th = self.draw.textsize("Confirm Tx Details", font=View.IMPACT25)
self.draw.text(((240 - tw) / 2, 3), "Confirm Tx Details", fill="ORANGE", font=View.IMPACT25)
self.draw.text(((240 - tw) / 2, 3), "Confirm Tx Details", fill=View.color, font=View.IMPACT25)

in_fee_outs_str = str(wallet.ins)
in_fee_outs_str += " inputs - fee = " if wallet.ins > 1 else " input - fee = "
in_fee_outs_str += str(wallet.outs)
in_fee_outs_str += " outs" if wallet.outs > 1 else " out"
tw, th = self.draw.textsize(in_fee_outs_str, font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 40), in_fee_outs_str, fill="ORANGE", font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 40), in_fee_outs_str, fill=View.color, font=View.IMPACT22)

receiving_addr_str1 = ""
receiving_addr_str2 = ""
Expand All @@ -130,32 +130,32 @@ def display_transaction_information(self, wallet) -> None:
receiving_addr_str1 += "Self-Transfer"

tw, th = self.draw.textsize(receiving_addr_str1, font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 75), receiving_addr_str1, fill="ORANGE", font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 75), receiving_addr_str1, fill=View.color, font=View.IMPACT22)
if len(receiving_addr_str2) > 0:
tw, th = self.draw.textsize(receiving_addr_str2, font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 100), receiving_addr_str2, fill="ORANGE", font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 100), receiving_addr_str2, fill=View.color, font=View.IMPACT22)


if wallet.spend > 0:
spending_str = "Spend: " + str(wallet.spend) + " sats"
tw, th = self.draw.textsize(spending_str, font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 130), spending_str, fill="ORANGE", font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 130), spending_str, fill=View.color, font=View.IMPACT22)

if wallet.change > 0 and wallet.dest_addr_cnt == 0:
change_str = "Amount: " + str(int(wallet.change)) + " sats"
tw, th = self.draw.textsize(change_str, font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 155), change_str, fill="ORANGE", font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 155), change_str, fill=View.color, font=View.IMPACT22)
elif wallet.change > 0:
change_str = "Change: " + str(int(wallet.change)) + " sats"
tw, th = self.draw.textsize(change_str, font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 155), change_str, fill="ORANGE", font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 155), change_str, fill=View.color, font=View.IMPACT22)

fee_str = "Fee: " + str(int(wallet.fee)) + " sats"
tw, th = self.draw.textsize(fee_str, font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 180), fee_str, fill="ORANGE", font=View.IMPACT22)
self.draw.text(((240 - tw) / 2, 180), fee_str, fill=View.color, font=View.IMPACT22)

tw, th = self.draw.textsize("Left to Exit, Right to Continue", font=View.IMPACT18)
self.draw.text(((240 - tw) / 2, 215), "Left to Exit, Right to Continue", fill="ORANGE", font=View.IMPACT18)
self.draw.text(((240 - tw) / 2, 215), "Left to Exit, Right to Continue", fill=View.color, font=View.IMPACT18)

View.DispShowImage()

Expand Down

0 comments on commit be41698

Please sign in to comment.