Misc fixes for MacOS

This commit is contained in:
Jonathan Harris authored and Athanasius committed 2020-06-21 16:31:41 +01:00
1 parent 4daaed7f0c
commit a4f4483d20
4 files changed
+6 -4

No files matched your search

+3 -1
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:
+1 -1
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)
+1 -1
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))
+1 -1
View File
@@ -331,7 +331,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