From af9c44640f4d6396ca5dc307c2874b6956b1a60c Mon Sep 17 00:00:00 2001 From: Athanasius Date: Sat, 4 Jul 2020 09:37:50 +0100 Subject: [PATCH 1/2] theme.py: Check if we can actually get an Xorg/X11 display The added exception at least means we don't then segmentation fault in the next line, but it also means we then hit another exception later in the main loop as we try to create the main Tk window. Hopefully the exception messages will be clear enough to the user. closes #500 --- theme.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/theme.py b/theme.py index 515574c3..fff2daae 100644 --- a/theme.py +++ b/theme.py @@ -85,6 +85,8 @@ elif platform == 'linux': XQueryTree.argtypes = [POINTER(Display), Window, POINTER(Window), POINTER(Window), POINTER(Window), POINTER(c_uint)] XQueryTree.restype = c_int dpy = xlib.XOpenDisplay(None) + if not dpy: + raise Exception("Can't find your display, can't continue") motif_wm_hints_property = XInternAtom(dpy, b'_MOTIF_WM_HINTS', False) motif_wm_hints_normal = MotifWmHints(MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS, MWM_FUNC_RESIZE | MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE | MWM_FUNC_CLOSE, From dbc177a02c9637c82924d6603e0b628332c0211b Mon Sep 17 00:00:00 2001 From: Athanasius Date: Sat, 4 Jul 2020 11:51:01 +0100 Subject: [PATCH 2/2] Fix WinSparkle options to be under EDCD key * When I changed 'company_name' in setup.py to 'EDCD' this caused WinSparkle to store, and look for, its keys there. * There's code in config.py that attempts to set some WinSparkle options, only if they weren't already there. This is hardcoded to use the old 'Marginal' Registry Key. So, explicitly do this WinSparkle setup under 'EDCD', and *always* set the update_interval value to match what we expect. Leave the 'CheckForUpdates' under the 'is it already here?' check so that we respect the user's choice. --- config.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/config.py b/config.py index 08557637..ad131ceb 100644 --- a/config.py +++ b/config.py @@ -200,13 +200,17 @@ class Config(object): raise Exception() # set WinSparkle defaults - https://github.com/vslavik/winsparkle/wiki/Registry-Settings + edcdhkey = HKEY() + if RegCreateKeyEx(HKEY_CURRENT_USER, r'Software\EDCD\EDMarketConnector', 0, None, 0, KEY_ALL_ACCESS, None, ctypes.byref(edcdhkey), ctypes.byref(disposition)): + raise Exception() + sparklekey = HKEY() - if not RegCreateKeyEx(self.hkey, 'WinSparkle', 0, None, 0, KEY_ALL_ACCESS, None, ctypes.byref(sparklekey), ctypes.byref(disposition)): + if not RegCreateKeyEx(edcdhkey, 'WinSparkle', 0, None, 0, KEY_ALL_ACCESS, None, ctypes.byref(sparklekey), ctypes.byref(disposition)): if disposition.value == REG_CREATED_NEW_KEY: buf = ctypes.create_unicode_buffer('1') RegSetValueEx(sparklekey, 'CheckForUpdates', 0, 1, buf, len(buf)*2) - buf = ctypes.create_unicode_buffer(str(update_interval)) - RegSetValueEx(sparklekey, 'UpdateInterval', 0, 1, buf, len(buf)*2) + buf = ctypes.create_unicode_buffer(str(update_interval)) + RegSetValueEx(sparklekey, 'UpdateInterval', 0, 1, buf, len(buf)*2) RegCloseKey(sparklekey) if not self.get('outdir') or not isdir(self.get('outdir')):