From 0f09c09d43e2b32a0523bb94fc3c1ec85a611121 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Sun, 29 Sep 2019 18:58:06 +0100 Subject: [PATCH] Misc fixes for MacOS --- config.py | 4 +++- hotkey.py | 2 +- myNotebook.py | 2 +- theme.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config.py b/config.py index 47e25ba3..1d721c5e 100644 --- a/config.py +++ b/config.py @@ -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: diff --git a/hotkey.py b/hotkey.py index 1cfaf223..8ee8762d 100644 --- a/hotkey.py +++ b/hotkey.py @@ -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) diff --git a/myNotebook.py b/myNotebook.py index 88807428..d42cae17 100644 --- a/myNotebook.py +++ b/myNotebook.py @@ -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)) diff --git a/theme.py b/theme.py index 863b1fd4..7a3debf9 100644 --- a/theme.py +++ b/theme.py @@ -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