Skip to content

Commit fb27200

Browse files
committed
Attempt to sanely support Windows, MacOS and Linux GUI Mono fonts
1 parent d6a3aa7 commit fb27200

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

GNUmakefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ install: dist/slip39-$(VERSION)-py3-none-any.whl FORCE
176176

177177
# Building / Signing / Notarizing and Uploading the macOS or win32 App
178178
# o TODO: no signed and notarized package yet accepted for upload by macOS App Store
179+
#
180+
# Mac: To build the .dmg installer, run:
181+
# make clean
182+
# make installer # continue running every couple of minuts 'til the App is notarized
183+
#
179184
installer: $(INSTALLER)
180185

181186
dmg: deps app-dmg-valid

slip39/gui/main.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,32 @@ def theme_color( thing, theme=None ):
4444
theme = sg.CURRENT_LOOK_AND_FEEL
4545
return sg.LOOK_AND_FEEL_TABLE[theme][thing]
4646

47+
# Try to pick a font; Use something like this to see what's available (ya, this sucks):
48+
#
49+
# from tkinter import Tk, font
50+
# root = Tk()
51+
# font_tuple = font.families()
52+
# #Creates a Empty list to hold font names
53+
# FontList=[]
54+
# fonts = [font.Font(family=f) for f in font.families()]
55+
# monospace = [f for f in fonts if f.metrics("fixed")]
56+
# for font in monospace:
57+
# FontList.append(font.actual('family'))
58+
# root.destroy()
59+
# print( '\n'.join( FontList ))
60+
if sys.platform == 'darwin':
61+
font_name = 'Source Code Pro'
62+
elif sys.platform == 'win32':
63+
font_name = 'Consolas'
64+
else: # assume linux
65+
font_name = 'DejaVu Sans Mono'
4766

4867
font_points = 14
49-
font = ('Courier', font_points+0)
50-
font_dense = ('Courier', font_points-2)
51-
font_small = ('Courier', font_points-4)
52-
font_big = ('Courier', font_points+2)
53-
font_bold = ('Courier', font_points+2, 'bold italic')
68+
font = (font_name, font_points+0)
69+
font_dense = (font_name, font_points-2)
70+
font_small = (font_name, font_points-4)
71+
font_big = (font_name, font_points+2)
72+
font_bold = (font_name, font_points+2, 'bold italic')
5473

5574
I_kwds = dict(
5675
change_submits = True,
@@ -1018,7 +1037,7 @@ def app(
10181037

10191038
group_threshold = int( threshold ) if threshold else math.ceil( len( groups ) * GROUP_THRESHOLD_RATIO )
10201039

1021-
sg.CURRENT_LOOK_AND_FEEL = sg.theme( THEME ) # Why? This module global should have updated...
1040+
sg.CURRENT_LOOK_AND_FEEL = sg.theme( THEME ) # Why? This module global should have updated...
10221041

10231042
# Try to set a sane initial CWD (for saving generated files). If we start up in the standard
10241043
# macOS App's "Container" directory for this App, ie.:

0 commit comments

Comments
 (0)