commit/readFeeds: norrumar: Cleanup of installTask, and restructured folders according with the new structure.

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Mon, 05 Dec 2016 18:04:18 -0000

1 new commit in readFeeds:

https://bitbucket.org/nvdaaddonteam/readfeeds/commits/d830b84ee396/
Changeset:   d830b84ee396
Branch:      enhancedgui
User:        norrumar
Date:        2016-12-05 18:03:52+00:00
Summary:     Cleanup of installTask, and restructured folders according with 
the new structure.

Affected #:  1 file

diff --git a/addon/installTasks.py b/addon/installTasks.py
new file mode 100644
index 0000000..4a4729e
--- /dev/null
+++ b/addon/installTasks.py
@@ -0,0 +1,50 @@
+# -*- coding: UTF-8 -*-
+
+# installTasks for the readFeeds add-on
+#Copyright (C) 2013-2016 Noelia Ruiz Martínez, other contributors
+# Released under GPL2
+
+import addonHandler
+import globalVars
+import os
+import shutil
+import glob
+import gui
+import wx
+
+ADDON_DIR = os.path.dirname(__file__).decode("mbcs")
+FEEDS_PATH = os.path.join(ADDON_DIR, "globalPlugins", "readFeeds", 
"personalFeeds")
+CONFIG_PATH = globalVars.appArgs.configPath
+
+addonHandler.initTranslation()
+
+def onInstall():
+       for addon in addonHandler.getAvailableAddons():
+               if addon.manifest['name'] == "ReadFeeds":
+                       if gui.messageBox(
+                               # Translators: the label of a message box 
dialog.
+                               _("You have installed the ReadFeeds add-on, 
probably an old and incompatible version with this one. Do you want to 
uninstall the old version?"),
+                               # Translators: the title of a message box 
dialog.
+                               _("Uninstall incompatible add-on"),
+                               wx.YES|wx.NO|wx.ICON_WARNING) == wx.YES:
+                                       addon.requestRemove()
+                       break
+       addonPath = [os.path.join(CONFIG_PATH, "RSS"), 
os.path.join(CONFIG_PATH, "personalFeeds")]
+       for path in addonPath:
+               if not os.path.isdir(path):
+                       continue
+               pathFiles = os.listdir(path)
+               validFiles = glob.glob(path+"\\*.txt")
+               if len(pathFiles) != len(validFiles):
+                       return
+               if gui.messageBox(
+                       # Translators: the label of a message box dialog.
+                       _("Your configuration folder for NVDA contains files 
that seem to be derived from a previous version of this add-on. Do you want to 
update it?"),
+                       # Translators: the title of a message box dialog.
+                       _("Install or update add-on"),
+                       wx.YES|wx.NO|wx.ICON_WARNING) == wx.YES:
+                               for file in validFiles:
+                                       try:
+                                               shutil.copy(file, FEEDS_PATH)
+                                       except IOError:
+                                               pass

Repository URL: https://bitbucket.org/nvdaaddonteam/readfeeds/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.

Other related posts:

  • » commit/readFeeds: norrumar: Cleanup of installTask, and restructured folders according with the new structure. - commits-noreply