From 8f3b0723193047a238c6fc2a60ef35bca0372152 Mon Sep 17 00:00:00 2001 From: Jose Manuel Delicado Date: Fri, 25 Jan 2019 13:06:03 +0100 Subject: [PATCH 1/6] InstallTasks: call conf.save() after updating default specification --- addon/installTasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addon/installTasks.py b/addon/installTasks.py index 22cb99b..52743f2 100644 --- a/addon/installTasks.py +++ b/addon/installTasks.py @@ -25,4 +25,5 @@ def onInstall(): profile.pop("useSharedComputers") except KeyError: pass - conf.spec["sharedComputer"] = confspec \ No newline at end of file + conf.spec["sharedComputer"] = confspec + conf.save() From 8a2d5dc3ca41f67a951db6cc50ba979ea1334b6e Mon Sep 17 00:00:00 2001 From: Jose Manuel Delicado Date: Fri, 25 Jan 2019 13:07:22 +0100 Subject: [PATCH 2/6] _getBaseValue function: put val1 in a try / except block to avoid errors --- addon/globalPlugins/sharedComputer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addon/globalPlugins/sharedComputer.py b/addon/globalPlugins/sharedComputer.py index 12f4241..d519a93 100644 --- a/addon/globalPlugins/sharedComputer.py +++ b/addon/globalPlugins/sharedComputer.py @@ -31,7 +31,10 @@ speakers = None def _getBaseValue(key): - val1 = config.conf.profiles[0]["sharedComputer"].get(key) + try: + val1 = config.conf.profiles[0]["sharedComputer"].get(key) + except: + val1 = None val2 = config.conf["sharedComputer"].get(key) return int(val1) if val1 is not None else int(val2) From 9fe0569a937c5e994df0ab2034bd05e629587380 Mon Sep 17 00:00:00 2001 From: Jose Manuel Delicado Date: Fri, 25 Jan 2019 13:12:25 +0100 Subject: [PATCH 3/6] Removed some unicode flags (Python 3 compatibility) --- addon/globalPlugins/sharedComputer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addon/globalPlugins/sharedComputer.py b/addon/globalPlugins/sharedComputer.py index d519a93..2183cb0 100644 --- a/addon/globalPlugins/sharedComputer.py +++ b/addon/globalPlugins/sharedComputer.py @@ -112,10 +112,10 @@ class AddonSettingsDialog(SettingsDialog): # Translators: Title of a dialog. title = _("Shared Computer Settings (F1 for Context Help)") # Translators: title of the browsable help message - helpTitle = _(u"Help") + helpTitle = _("Help") # Translators: advice on how to close the browsable help message - hint = _(u"Press escape to close this message.") - hint = u"

{}

".format(hint) + hint = _("Press escape to close this message.") + hint = "

{}

".format(hint) lastFocus = None helpDict = {} with open(helpPath,'r') as helpFile: From 7fd95ec9ce5020a5514e1bb7bdbac7a60da6a182 Mon Sep 17 00:00:00 2001 From: Jose Manuel Delicado Date: Fri, 25 Jan 2019 13:16:16 +0100 Subject: [PATCH 4/6] Remove more unicode flags --- addon/globalPlugins/sharedComputer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addon/globalPlugins/sharedComputer.py b/addon/globalPlugins/sharedComputer.py index 2183cb0..9c5dd75 100644 --- a/addon/globalPlugins/sharedComputer.py +++ b/addon/globalPlugins/sharedComputer.py @@ -160,11 +160,11 @@ def makeSettings(self, settingsSizer): self.volumeList.Bind(wx.EVT_CHOICE, self.onChoice) self.volumeLevel.Bind(wx.EVT_CHAR_HOOK, self.onKey) for number, child in enumerate([self.activateList, self.volumeList, self.volumeLevel], 1): - self.helpDict[child.GetId()] = u'\n'.join((self.sections[0], self.sections[number], self.hint, self.sections[4])) + self.helpDict[child.GetId()] = '\n'.join((self.sections[0], self.sections[number], self.hint, self.sections[4])) child.Bind(wx.EVT_HELP, self.onHelp) def onDialogActivate(self, evt): - "Ensures that the current control will be the same after switching to another window and back" + """ Ensures that the current control will be the same after switching to another window and back """ # store focus when the user switches to another window if not evt.GetActive(): self.lastFocus = self.FindFocus() From 61fe7bed8992a8cfc7a7825bd58dc018816587c2 Mon Sep 17 00:00:00 2001 From: Jose Manuel Delicado Date: Fri, 25 Jan 2019 13:18:11 +0100 Subject: [PATCH 5/6] OnOk function: call super function in last place, after saving config --- addon/globalPlugins/sharedComputer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/globalPlugins/sharedComputer.py b/addon/globalPlugins/sharedComputer.py index 9c5dd75..8a40d4e 100644 --- a/addon/globalPlugins/sharedComputer.py +++ b/addon/globalPlugins/sharedComputer.py @@ -205,7 +205,6 @@ def postInit(self): self.activateList.SetFocus() def onOk(self,evt): - super(AddonSettingsDialog, self).onOk(evt) config.conf["sharedComputer"]["numLockActivationChoice"] = self.activateList.Selection # write only to the normal configuration newSettings = {"sharedComputer": { @@ -213,6 +212,7 @@ def onOk(self,evt): "volumeLevel": self.volumeLevel.Value}} config.conf._profileCache[None].update(newSettings) config.conf.profiles[0].update(newSettings) + super(AddonSettingsDialog, self).onOk(evt) # Audio Stuff def getVolumeObject(): From 4c847cfdbe5aa6bfbdfb3265d343e4bdaa93e588 Mon Sep 17 00:00:00 2001 From: Jose Manuel Delicado Date: Fri, 25 Jan 2019 13:23:39 +0100 Subject: [PATCH 6/6] Sconstruct: use the extensions keyword when calling markdown.markdown --- sconstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sconstruct b/sconstruct index f2d9c8b..a3cd82f 100644 --- a/sconstruct +++ b/sconstruct @@ -23,7 +23,7 @@ def md2html(source, dest): mdText = f.read() for k, v in headerDic.iteritems(): mdText = mdText.replace(k, v, 1) - htmlText = markdown.markdown(mdText, ['markdown.extensions.extra']) + htmlText = markdown.markdown(mdText, extensions=['markdown.extensions.extra']) with codecs.open(dest, "w", "utf-8") as f: f.write("\n" + "