Skip to content

Commit 6dd5b83

Browse files
committed
Attempt to handle Windows HiDPI gracefully
1 parent b073e59 commit 6dd5b83

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

slip39/gui/main.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@
2424

2525
log = logging.getLogger( __package__ )
2626

27-
font = ('Courier', 14)
28-
font_small = ('Courier', 10)
29-
font_bold = ('Courier', 16, 'bold italic')
27+
28+
disp_scaling = None if sys.platform == 'darwin' else 0.5
29+
disp_points = 14 # if sys.platform == 'darwin' else 9
30+
font = ('Courier', disp_points+0)
31+
font_small = ('Courier', disp_points-4)
32+
font_bold = ('Courier', disp_points+2, 'bold italic')
3033

3134
I_kwds = dict(
3235
change_submits = True,
@@ -645,6 +648,7 @@ def app(
645648
cryptocurrency = None,
646649
edit = None,
647650
passphrase = None,
651+
scaling = None,
648652
):
649653
"""Convert sequence of group specifications into standard { "<group>": (<needs>, <size>) ... }"""
650654

@@ -739,7 +743,9 @@ def app(
739743
window['-GROUPS-F-'].expand( expand_x=True )
740744
else:
741745
window = sg.Window(
742-
f"{', '.join( names or [ 'SLIP-39' ] )} Mnemonic Cards", layout, grab_anywhere=True,
746+
f"{', '.join( names or [ 'SLIP-39' ] )} Mnemonic Cards", layout,
747+
grab_anywhere = True,
748+
scaling = scaling,
743749
)
744750
timeout = 0 # First time through w/ new window, refresh immediately
745751

@@ -1069,6 +1075,7 @@ def main( argv=None ):
10691075
cryptocurrency = args.cryptocurrency,
10701076
edit = args.path,
10711077
passphrase = args.passphrase,
1078+
scaling = disp_scaling,
10721079
)
10731080
except Exception as exc:
10741081
log.exception( f"Failed running App: {exc}" )

0 commit comments

Comments
 (0)