From d763e5931a10bfe66ea6ebad7214d99e1b08db89 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Sun, 3 Dec 2017 12:39:01 +0000 Subject: [PATCH] Correct config examples config.get() never returns int for consistency across platforms. Fixes #271 --- PLUGINS.md | 4 ++-- config.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PLUGINS.md b/PLUGINS.md index 0b653b9f..93e10967 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -64,7 +64,7 @@ def plugin_prefs(parent, cmdr, is_beta): """ Return a TK Frame for adding to the EDMC settings dialog. """ - this.mysetting = tk.IntVar(value=config.get("MyPluginSetting")) # Retrieve saved value from config + this.mysetting = tk.IntVar(value=config.getint("MyPluginSetting")) # Retrieve saved value from config frame = nb.Frame(parent) nb.Label(frame, text="Hello").grid() nb.Label(frame, text="Commander").grid() @@ -80,7 +80,7 @@ def prefs_changed(cmdr, is_beta): """ Save settings. """ - config.setint('MyPluginSetting', this.mysetting.get()) # Store new value in config + config.set('MyPluginSetting', this.mysetting.getint()) # Store new value in config ``` ## Display diff --git a/config.py b/config.py index 53c39e38..6904f5e5 100644 --- a/config.py +++ b/config.py @@ -149,7 +149,7 @@ class Config: if hasattr(val, '__iter__'): return list(val) # make writeable else: - return val + return unicode(val) def getint(self, key): try: @@ -233,7 +233,7 @@ class Config: elif typ.value == REG_MULTI_SZ: return [x for x in ctypes.wstring_at(buf, len(buf)-2).split(u'\x00')] else: - return buf.value + return unicode(buf.value) def getint(self, key): typ = DWORD()