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

Misc fixes for MacOS

This commit is contained in:
Jonathan Harris 2019-09-29 18:58:06 +01:00
parent 8700924bc2
commit 0f09c09d43
4 changed files with 6 additions and 4 deletions

View File

@ -143,10 +143,12 @@ class Config(object):
val = self.settings.get(key)
if val is None:
return None
elif isinstance(val, str):
return str(val)
elif hasattr(val, '__iter__'):
return list(val) # make writeable
else:
return str(val)
return None
def getint(self, key):
try:

View File

@ -57,7 +57,7 @@ if platform == 'darwin':
# Monkey-patch tk (tkMacOSXKeyEvent.c)
if not self.tkProcessKeyEvent_old:
sel = 'tkProcessKeyEvent:'
sel = b'tkProcessKeyEvent:'
cls = NSApplication.sharedApplication().class__()
self.tkProcessKeyEvent_old = NSApplication.sharedApplication().methodForSelector_(sel)
newmethod = objc.selector(self.tkProcessKeyEvent, selector = self.tkProcessKeyEvent_old.selector, signature = self.tkProcessKeyEvent_old.signature)

View File

@ -29,7 +29,7 @@ class Notebook(ttk.Notebook):
style = ttk.Style()
if platform=='darwin':
if map(int, mac_ver()[0].split('.')) >= [10,10]:
if list(map(int, mac_ver()[0].split('.'))) >= [10,10]:
# Hack for tab appearance with 8.5 on Yosemite & El Capitan. For proper fix see
# https://github.com/tcltk/tk/commit/55c4dfca9353bbd69bbcec5d63bf1c8dfb461e25
style.configure('TNotebook.Tab', padding=(12,10,12,2))

View File

@ -328,7 +328,7 @@ class _Theme(object):
from AppKit import NSApplication, NSAppearance, NSMiniaturizableWindowMask, NSResizableWindowMask
root.update_idletasks() # need main window to be created
appearance = NSAppearance.appearanceNamed_(theme and
'NSAppearanceNameVibrantDark' or
'NSAppearanceNameDarkAqua' or
'NSAppearanceNameAqua')
for window in NSApplication.sharedApplication().windows():
window.setStyleMask_(window.styleMask() & ~(NSMiniaturizableWindowMask | NSResizableWindowMask)) # disable zoom