|
34 | 34 |
|
35 | 35 | from ..api import Account, create, group_parser, random_secret, cryptopaths_parser, paper_wallet_available
|
36 | 36 | from ..recovery import recover, recover_bip39, produce_bip39, scan_entropy, display_entropy
|
37 |
| -from ..util import log_level, log_cfg, ordinal, commas, chunker, hue_shift, rate_dB, entropy_rating_dB, timing, avg |
| 37 | +from ..util import log_level, log_cfg, ordinal, commas, chunker, hue_shift, rate_dB, entropy_rating_dB, timing, avg, parse_scutil |
38 | 38 | from ..layout import write_pdfs, printers_available
|
39 | 39 | from ..defaults import (
|
40 | 40 | GROUPS, GROUP_THRESHOLD_RATIO, MNEM_PREFIX, CRYPTO_PATHS, BITS, BITS_BIP39, BITS_DEFAULT,
|
@@ -277,11 +277,10 @@ def groups_layout(
|
277 | 277 | visible=LO_CRE, **T_hue( B_kwds, 0/20 )),
|
278 | 278 | sg.Radio( "256-bit", "SD", key='-SD-256-RND-', visible=LO_CRE, **T_hue( B_kwds, 0/20 )),
|
279 | 279 | sg.Radio( "512-bit", "SD", key='-SD-512-RND-', visible=LO_PRO, **T_hue( B_kwds, 0/20 )),
|
280 |
| - sg.Text( "Recover:", visible=LO_BAK, **T_hue( T_kwds, 2/20 )), |
| 280 | + sg.Text( "Recover:", visible=LO_CRE, **T_hue( T_kwds, 2/20 )), |
281 | 281 | sg.Radio( "SLIP-39", "SD", key='-SD-SLIP-', visible=LO_REC, **T_hue( B_kwds, 2/20 )),
|
282 | 282 | sg.Radio( "BIP-39", "SD", key='-SD-BIP-', default=LO_BAK,
|
283 |
| - visible=LO_BAK or LO_CRE, |
284 |
| - **T_hue( B_kwds, 2/20 )), |
| 283 | + visible=LO_CRE, **T_hue( B_kwds, 2/20 )), |
285 | 284 | sg.Radio( "BIP-39 Seed", "SD", key='-SD-BIP-SEED-', visible=LO_PRO, **T_hue( B_kwds, 2/20 )),
|
286 | 285 | sg.Checkbox( 'Passphrase', key='-SD-PASS-C-', visible=False, **T_hue( B_kwds, 2/20 )),
|
287 | 286 | ],
|
@@ -350,9 +349,10 @@ def groups_layout(
|
350 | 349 | sg.Text( "", key='-SEED-', size=inlong, **T_kwds ),
|
351 | 350 | ],
|
352 | 351 | [
|
353 |
| - sg.Checkbox( "Using BIP-39:", key='-AS-BIP-CB-', default=True, |
| 352 | + sg.Checkbox( "Using BIP-39:", key='-AS-BIP-CB-', visible=LO_CRE, |
| 353 | + default=True, |
354 | 354 | size=prefix, **T_hue( B_kwds, -1/20 )),
|
355 |
| - sg.Text( '', key='-AS-BIP-', visible=True, **T_hue( T_kwds_dense, -1/20 )), |
| 355 | + sg.Text( '', key='-AS-BIP-', visible=LO_CRE, **T_hue( T_kwds_dense, -1/20 )), |
356 | 356 | ],
|
357 | 357 | [
|
358 | 358 | sg.Column( [
|
@@ -602,12 +602,12 @@ def update_seed_data( event, window, values ):
|
602 | 602 | # We're recovering the BIP-39 Seed Phrase *Entropy*, NOT the derived (decrypted) 512-bit
|
603 | 603 | # Seed Data! So, we don't deal in Passphrases, here. The Passphrase (to encrypt the Seed,
|
604 | 604 | # when "Using BIP-39") is only required to display the correct wallet addresses.
|
605 |
| - window['-SD-DATA-F-'].update( "BIP-39 Mnemonic: " ) |
| 605 | + window['-SD-DATA-F-'].update( "BIP-39 Mnemonic to Back Up: " ) |
606 | 606 | window['-SD-DATA-F-'].update( visible=True )
|
607 | 607 | window['-SD-PASS-C-'].update( visible=False )
|
608 | 608 | window['-SD-PASS-F-'].update( visible=False )
|
609 | 609 | elif 'SLIP' in update_seed_data.src:
|
610 |
| - window['-SD-DATA-F-'].update( "SLIP-39 Mnemonics: " ) |
| 610 | + window['-SD-DATA-F-'].update( "SLIP-39 Mnemonics to Back Up: " ) |
611 | 611 | window['-SD-DATA-F-'].update( visible=True )
|
612 | 612 | window['-SD-PASS-C-'].update( visible=True )
|
613 | 613 | window['-SD-PASS-F-'].update(
|
@@ -1026,11 +1026,13 @@ def user_name_full():
|
1026 | 1026 | f"{' '.join( command )!r} command failed, or no output returned"
|
1027 | 1027 |
|
1028 | 1028 | if sys.platform == 'darwin':
|
1029 |
| - for li in subproc.stdout.split( '\n' ): |
1030 |
| - if 'kCGSessionLongUserNameKey' in li: |
1031 |
| - # eg.: " kCGSessionLongUserNameKey : Perry Kundert" |
1032 |
| - full_name = li.split( ':' )[1].strip() |
1033 |
| - break |
| 1029 | + scutil = parse_scutil( subproc.stdout ) |
| 1030 | + if uid := scutil.get( 'UID' ): |
| 1031 | + for session in scutil.get( 'SessionInfo', {} ).values(): |
| 1032 | + if session.get( 'kCGSSessionUserIDKey' ) == uid: |
| 1033 | + # eg.: " kCGSessionLongUserNameKey : Perry Kundert" |
| 1034 | + full_name = session.get( 'kCGSessionLongUserNameKey' ) |
| 1035 | + break |
1034 | 1036 | elif sys.platform == 'win32':
|
1035 | 1037 | for li in subproc.stdout.split( '\n' ):
|
1036 | 1038 | if li.startswith( 'Full Name' ):
|
@@ -1352,7 +1354,9 @@ def deficiency( *deficiencies ):
|
1352 | 1354 |
|
1353 | 1355 | # Recover any passphrase, discarding any details on change. The empty passphrase b'' is the
|
1354 | 1356 | # default for both SLIP-39 and BIP-39.
|
1355 |
| - window['-AS-BIP-'].update( visible=values['-AS-BIP-CB-'] ) |
| 1357 | + if window['-AS-BIP-CB-'].visible: |
| 1358 | + # Only if the checkbox is visible in this mode, also make the BIP-39 rendering visible |
| 1359 | + window['-AS-BIP-'].update( visible=values['-AS-BIP-CB-'] ) |
1356 | 1360 | window['-PASSPHRASE-F-'].update(
|
1357 | 1361 | 'BIP-39 Passphrase' if using_bip39 else passphrase_trezor_incompatible )
|
1358 | 1362 | passphrase_now = values['-PASSPHRASE-'].strip().encode( 'UTF-8' )
|
|
0 commit comments