1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 08:17:13 +03:00

Use "Euro Caps" font with transparent theme

Addresses #412
This commit is contained in:
Jonathan Harris 2019-04-07 14:56:58 +01:00
parent 5e634266f3
commit 3b321df6b0
4 changed files with 22 additions and 14 deletions

View File

@ -156,6 +156,9 @@
<Component Guid="*"> <Component Guid="*">
<File KeyPath="yes" Source="SourceDir\EDMC.exe" /> <File KeyPath="yes" Source="SourceDir\EDMC.exe" />
</Component> </Component>
<Component Guid="*">
<File KeyPath="yes" Source="SourceDir\EUROCAPS.TTF" />
</Component>
<Component Guid="{A18814B6-B491-42AB-A433-2AD66A823AD7}"> <Component Guid="{A18814B6-B491-42AB-A433-2AD66A823AD7}">
<File KeyPath="yes" Source="SourceDir\library.zip" /> <File KeyPath="yes" Source="SourceDir\library.zip" />
</Component> </Component>
@ -514,6 +517,7 @@
<ComponentRef Id="EDMarketConnector.ico" /> <ComponentRef Id="EDMarketConnector.ico" />
<ComponentRef Id="EDMarketConnector.VisualElementsManifest.xml" /> <ComponentRef Id="EDMarketConnector.VisualElementsManifest.xml" />
<ComponentRef Id="EDMC.exe" /> <ComponentRef Id="EDMC.exe" />
<ComponentRef Id="EUROCAPS.TTF" />
<ComponentRef Id="eddb.py" /> <ComponentRef Id="eddb.py" />
<ComponentRef Id="eddn.py" /> <ComponentRef Id="eddn.py" />
<ComponentRef Id="edsm.py" /> <ComponentRef Id="edsm.py" />

View File

@ -333,6 +333,7 @@ Acknowledgements
* Uses [Sparkle](https://github.com/sparkle-project/Sparkle) by [Andy Matuschak](http://andymatuschak.org/) and the [Sparkle Project](https://github.com/sparkle-project). * Uses [Sparkle](https://github.com/sparkle-project/Sparkle) by [Andy Matuschak](http://andymatuschak.org/) and the [Sparkle Project](https://github.com/sparkle-project).
* Uses [WinSparkle](https://github.com/vslavik/winsparkle/wiki) by [Václav Slavík](https://github.com/vslavik). * Uses [WinSparkle](https://github.com/vslavik/winsparkle/wiki) by [Václav Slavík](https://github.com/vslavik).
* Uses [OneSky](http://www.oneskyapp.com/) for [translation management](https://marginal.oneskyapp.com/collaboration/project?id=52710). * Uses [OneSky](http://www.oneskyapp.com/) for [translation management](https://marginal.oneskyapp.com/collaboration/project?id=52710).
* Uses "Euro Caps" font by [Tom Oetken](https://www.dafont.com/profile.php?user=298681).
License License
------- -------

View File

@ -124,6 +124,7 @@ elif sys.platform=='win32':
requests.certs.where(), requests.certs.where(),
'WinSparkle.dll', 'WinSparkle.dll',
'WinSparkle.pdb', # For debugging - don't include in package 'WinSparkle.pdb', # For debugging - don't include in package
'EUROCAPS.TTF',
'commodity.csv', 'commodity.csv',
'rare_commodity.csv', 'rare_commodity.csv',
'snd_good.wav', 'snd_good.wav',

View File

@ -6,6 +6,7 @@
# #
from sys import platform from sys import platform
from os.path import join
import Tkinter as tk import Tkinter as tk
import ttk import ttk
@ -14,6 +15,16 @@ import tkFont
from config import appname, applongname, config from config import appname, applongname, config
if platform == 'win32':
import ctypes
from ctypes.wintypes import LPCWSTR, DWORD, LPCVOID
AddFontResourceEx = ctypes.windll.gdi32.AddFontResourceExW
AddFontResourceEx.restypes = [LPCWSTR, DWORD, LPCVOID]
FR_PRIVATE = 0x10
FR_NOT_ENUM = 0x20
AddFontResourceEx(join(config.respath, u'EUROCAPS.TTF'), FR_PRIVATE, 0)
class _Theme: class _Theme:
def __init__(self): def __init__(self):
@ -56,15 +67,6 @@ class _Theme:
style = ttk.Style() style = ttk.Style()
if platform == 'linux2': if platform == 'linux2':
style.theme_use('clam') style.theme_use('clam')
elif platform == 'darwin':
# Default ttk font spacing looks bad on El Capitan
osxfont = tkFont.Font(family='TkDefaultFont', size=13, weight=tkFont.NORMAL)
style.configure('TLabel', font=osxfont)
style.configure('TButton', font=osxfont)
style.configure('TLabelframe.Label', font=osxfont)
style.configure('TCheckbutton', font=osxfont)
style.configure('TRadiobutton', font=osxfont)
style.configure('TEntry', font=osxfont)
# Default dark theme colors # Default dark theme colors
if not config.get('dark_text'): if not config.get('dark_text'):
@ -85,8 +87,9 @@ class _Theme:
'font' : 'TkDefaultFont', 'font' : 'TkDefaultFont',
} }
# Overrides # Overrides
if platform == 'darwin': if theme > 1 and not 0x250 < ord(_('Cmdr')[0]) < 0x3000:
self.current['font'] = osxfont # Font only supports Latin 1 / Supplement / Extended, and a few General Punctuation and Mathematical Operators
self.current['font'] = tkFont.Font(family='Euro Caps', size=tkFont.Font().actual()['size'], weight=tkFont.NORMAL)
else: else:
# System colors # System colors
@ -102,7 +105,6 @@ class _Theme:
# Overrides # Overrides
if platform == 'darwin': if platform == 'darwin':
self.current['background'] = 'systemMovableModalBackground' self.current['background'] = 'systemMovableModalBackground'
self.current['font'] = osxfont
elif platform == 'win32': elif platform == 'win32':
# Menu colors # Menu colors
self.current['activebackground'] = 'SystemHighlight' self.current['activebackground'] = 'SystemHighlight'
@ -124,7 +126,8 @@ class _Theme:
elif 'cursor' in widget.keys() and str(widget['cursor']) not in ['', 'arrow']: elif 'cursor' in widget.keys() and str(widget['cursor']) not in ['', 'arrow']:
# Hack - highlight widgets like HyperlinkLabel with a non-default cursor # Hack - highlight widgets like HyperlinkLabel with a non-default cursor
widget.configure(foreground = self.current['highlight'], widget.configure(foreground = self.current['highlight'],
background = self.current['background']) background = self.current['background'],
font = self.current['font'])
elif 'activeforeground' in widget.keys(): elif 'activeforeground' in widget.keys():
# e.g. tk.Button, tk.Label, tk.Menu # e.g. tk.Button, tk.Label, tk.Menu
widget.configure(foreground = self.current['foreground'], widget.configure(foreground = self.current['foreground'],
@ -172,7 +175,6 @@ class _Theme:
window.setAppearance_(appearance) window.setAppearance_(appearance)
elif platform == 'win32': elif platform == 'win32':
import ctypes
GWL_STYLE = -16 GWL_STYLE = -16
WS_MAXIMIZEBOX = 0x00010000 WS_MAXIMIZEBOX = 0x00010000
# tk8.5.9/win/tkWinWm.c:342 # tk8.5.9/win/tkWinWm.c:342