commit/wintenApps: 4 new changesets

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: commits+int+220+6085746285340533186@xxxxxxxxxxxxxxxxxxxxx, nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Thu, 29 Nov 2018 02:25:58 +0000 (UTC)

4 new commits in wintenApps:

https://bitbucket.org/nvdaaddonteam/wintenapps/commits/bc9050a3dba5/
Changeset:   bc9050a3dba5
Branch:      None
User:        josephsl
Date:        2018-11-26 00:25:32+00:00
Summary:     Standalone update check: move the update downloader class to 
outside of try block.

In the old days, a try block was required to encapsulate update downloader 
class, particularly if using NVDA 2018.1.x. Now that this add-on requries NVDA 
2018.3, this check is no longer necessary.

Affected #:  1 file

diff --git a/addon/globalPlugins/wintenObjs/w10config.py 
b/addon/globalPlugins/wintenObjs/w10config.py
index f7f2e4f..a0c7b37 100755
--- a/addon/globalPlugins/wintenObjs/w10config.py
+++ b/addon/globalPlugins/wintenObjs/w10config.py
@@ -223,107 +223,104 @@ def onConfigDialog(evt):
 
 # Update downloader (credit: NV Access)
 # Customized for WinTenApps add-on.
-try:
-       class W10UpdateDownloader(updateCheck.UpdateDownloader):
-               """Overrides NVDA Core's downloader.)
-               No hash checking for now, and URL's and temp file paths are 
different.
+class W10UpdateDownloader(updateCheck.UpdateDownloader):
+       """Overrides NVDA Core's downloader.)
+       No hash checking for now, and URL's and temp file paths are different.
+       """
+
+       def __init__(self, urls, fileHash=None):
+               """Constructor.
+               @param urls: URLs to try for the update file.
+               @type urls: list of str
+               @param fileHash: The SHA-1 hash of the file as a hex string.
+               @type fileHash: basestring
                """
+               # In recent NVDA next snapshots (February 2018), update 
downloader was changed to take in update info dictionary.
+               try:
+                       super(W10UpdateDownloader, self).__init__(urls, 
fileHash)
+               except:
+                       pass
+               self.urls = urls
+               self.destPath = tempfile.mktemp(prefix="wintenApps_update-", 
suffix=".nvda-addon")
+               self.fileHash = fileHash
 
-               def __init__(self, urls, fileHash=None):
-                       """Constructor.
-                       @param urls: URLs to try for the update file.
-                       @type urls: list of str
-                       @param fileHash: The SHA-1 hash of the file as a hex 
string.
-                       @type fileHash: basestring
-                       """
-                       # In recent NVDA next snapshots (February 2018), update 
downloader was changed to take in update info dictionary.
-                       try:
-                               super(W10UpdateDownloader, self).__init__(urls, 
fileHash)
-                       except:
-                               pass
-                       self.urls = urls
-                       self.destPath = 
tempfile.mktemp(prefix="wintenApps_update-", suffix=".nvda-addon")
-                       self.fileHash = fileHash
+       def start(self):
+               """Start the download.
+               """
+               self._shouldCancel = False
+               # Use a timer because timers aren't re-entrant.
+               self._guiExecTimer = wx.PyTimer(self._guiExecNotify)
+               gui.mainFrame.prePopup()
+               # Translators: The title of the dialog displayed while 
downloading add-on update.
+               self._progressDialog = wx.ProgressDialog(_("Downloading Add-on 
Update"),
+                       # Translators: The progress message indicating that a 
connection is being established.
+                       _("Connecting"),
+                       # PD_AUTO_HIDE is required because 
ProgressDialog.Update blocks at 100%
+                       # and waits for the user to press the Close button.
+                       style=wx.PD_CAN_ABORT | wx.PD_ELAPSED_TIME | 
wx.PD_REMAINING_TIME | wx.PD_AUTO_HIDE,
+                       parent=gui.mainFrame)
+               self._progressDialog.Raise()
+               t = threading.Thread(target=self._bg)
+               t.daemon = True
+               t.start()
 
-               def start(self):
-                       """Start the download.
-                       """
-                       self._shouldCancel = False
-                       # Use a timer because timers aren't re-entrant.
-                       self._guiExecTimer = wx.PyTimer(self._guiExecNotify)
-                       gui.mainFrame.prePopup()
-                       # Translators: The title of the dialog displayed while 
downloading add-on update.
-                       self._progressDialog = wx.ProgressDialog(_("Downloading 
Add-on Update"),
-                               # Translators: The progress message indicating 
that a connection is being established.
-                               _("Connecting"),
-                               # PD_AUTO_HIDE is required because 
ProgressDialog.Update blocks at 100%
-                               # and waits for the user to press the Close 
button.
-                               style=wx.PD_CAN_ABORT | wx.PD_ELAPSED_TIME | 
wx.PD_REMAINING_TIME | wx.PD_AUTO_HIDE,
-                               parent=gui.mainFrame)
-                       self._progressDialog.Raise()
-                       t = threading.Thread(target=self._bg)
-                       t.daemon = True
-                       t.start()
+       def _error(self):
+               self._stopped()
+               gui.messageBox(
+                       # Translators: A message indicating that an error 
occurred while downloading an update to NVDA.
+                       _("Error downloading add-on update."),
+                       # Message included in NVDA Core
+                       translate("Error"),
+                       wx.OK | wx.ICON_ERROR)
 
-               def _error(self):
-                       self._stopped()
-                       gui.messageBox(
-                               # Translators: A message indicating that an 
error occurred while downloading an update to NVDA.
-                               _("Error downloading add-on update."),
+       def _downloadSuccess(self):
+               self._stopped()
+               # Emulate add-on update (don't prompt to install).
+               from gui import addonGui
+               closeAfter = addonGui.AddonsDialog._instance is None
+               try:
+                       try:
+                               
bundle=addonHandler.AddonBundle(self.destPath.decode("mbcs"))
+                       except:
+                               log.error("Error opening addon bundle from 
%s"%self.destPath,exc_info=True)
                                # Message included in NVDA Core
-                               translate("Error"),
-                               wx.OK | wx.ICON_ERROR)
-
-               def _downloadSuccess(self):
-                       self._stopped()
-                       # Emulate add-on update (don't prompt to install).
-                       from gui import addonGui
-                       closeAfter = addonGui.AddonsDialog._instance is None
+                               gui.messageBox(translate("Failed to open add-on 
package file at %s - missing file or invalid file format")%self.destPath,
+                                       translate("Error"),
+                                       wx.OK | wx.ICON_ERROR)
+                               return
+                       bundleName=bundle.manifest['name']
+                       for addon in addonHandler.getAvailableAddons():
+                               if not addon.isPendingRemove and 
bundleName==addon.manifest['name']:
+                                       addon.requestRemove()
+                                       break
+                       progressDialog = 
gui.IndeterminateProgressDialog(gui.mainFrame,
+                       # Translators: The title of the dialog presented while 
an Addon is being updated.
+                       _("Updating Add-on"),
+                       # Translators: The message displayed while an addon is 
being updated.
+                       _("Please wait while the add-on is being updated."))
                        try:
-                               try:
-                                       
bundle=addonHandler.AddonBundle(self.destPath.decode("mbcs"))
-                               except:
-                                       log.error("Error opening addon bundle 
from %s"%self.destPath,exc_info=True)
-                                       # Message included in NVDA Core
-                                       gui.messageBox(translate("Failed to 
open add-on package file at %s - missing file or invalid file 
format")%self.destPath,
-                                               translate("Error"),
-                                               wx.OK | wx.ICON_ERROR)
-                                       return
-                               bundleName=bundle.manifest['name']
-                               for addon in addonHandler.getAvailableAddons():
-                                       if not addon.isPendingRemove and 
bundleName==addon.manifest['name']:
-                                               addon.requestRemove()
-                                               break
-                               progressDialog = 
gui.IndeterminateProgressDialog(gui.mainFrame,
-                               # Translators: The title of the dialog 
presented while an Addon is being updated.
-                               _("Updating Add-on"),
-                               # Translators: The message displayed while an 
addon is being updated.
-                               _("Please wait while the add-on is being 
updated."))
-                               try:
-                                       
gui.ExecAndPump(addonHandler.installAddonBundle,bundle)
-                               except:
-                                       log.error("Error installing  addon 
bundle from %s"%self.destPath,exc_info=True)
-                                       if not closeAfter: 
addonGui.AddonsDialog(gui.mainFrame).refreshAddonsList()
-                                       progressDialog.done()
-                                       del progressDialog
-                                       # Translators: The message displayed 
when an error occurs when installing an add-on package.
-                                       gui.messageBox(_("Failed to update 
add-on  from %s")%self.destPath,
-                                               translate("Error"),
-                                               wx.OK | wx.ICON_ERROR)
-                                       return
-                               else:
-                                       if not closeAfter: 
addonGui.AddonsDialog(gui.mainFrame).refreshAddonsList(activeIndex=-1)
-                                       progressDialog.done()
-                                       del progressDialog
-                       finally:
-                               try:
-                                       os.remove(self.destPath)
-                               except OSError:
-                                       pass
-                               if closeAfter:
-                                       wx.CallLater(1, 
addonGui.AddonsDialog(gui.mainFrame).Close)
-except:
-       log.debugWarning("Error downloading Windows 10 App Essentials update", 
exc_info=True)
+                               
gui.ExecAndPump(addonHandler.installAddonBundle,bundle)
+                       except:
+                               log.error("Error installing  addon bundle from 
%s"%self.destPath,exc_info=True)
+                               if not closeAfter: 
addonGui.AddonsDialog(gui.mainFrame).refreshAddonsList()
+                               progressDialog.done()
+                               del progressDialog
+                               # Translators: The message displayed when an 
error occurs when installing an add-on package.
+                               gui.messageBox(_("Failed to update add-on  from 
%s")%self.destPath,
+                                       translate("Error"),
+                                       wx.OK | wx.ICON_ERROR)
+                               return
+                       else:
+                               if not closeAfter: 
addonGui.AddonsDialog(gui.mainFrame).refreshAddonsList(activeIndex=-1)
+                               progressDialog.done()
+                               del progressDialog
+               finally:
+                       try:
+                               os.remove(self.destPath)
+                       except OSError:
+                               pass
+                       if closeAfter:
+                               wx.CallLater(1, 
addonGui.AddonsDialog(gui.mainFrame).Close)
 
 # Borrowed from NVDA Core (the only difference is the URL and where structures 
are coming from).
 def _updateWindowsRootCertificates():


https://bitbucket.org/nvdaaddonteam/wintenapps/commits/a911ab2acbf9/
Changeset:   a911ab2acbf9
Branch:      None
User:        josephsl
Date:        2018-11-26 00:30:54+00:00
Summary:     Python 3: catch str.decode attribute error.

In Python 3, string objects no longer ship with a decode method. Thus catch 
this error and try obtainig add-on update bundle via pure string content.
With this commit, Windows 10 App Essentrials is Python 3 ready.

Affected #:  1 file

diff --git a/addon/globalPlugins/wintenObjs/w10config.py 
b/addon/globalPlugins/wintenObjs/w10config.py
index a0c7b37..d6bc21f 100755
--- a/addon/globalPlugins/wintenObjs/w10config.py
+++ b/addon/globalPlugins/wintenObjs/w10config.py
@@ -281,6 +281,8 @@ class W10UpdateDownloader(updateCheck.UpdateDownloader):
                try:
                        try:
                                
bundle=addonHandler.AddonBundle(self.destPath.decode("mbcs"))
+                       except AttributeError:
+                               bundle=addonHandler.AddonBundle(self.destPath)
                        except:
                                log.error("Error opening addon bundle from 
%s"%self.destPath,exc_info=True)
                                # Message included in NVDA Core


https://bitbucket.org/nvdaaddonteam/wintenapps/commits/25ce68160be4/
Changeset:   25ce68160be4
Branch:      None
User:        josephsl
Date:        2018-11-28 16:05:44+00:00
Summary:     Global plugin: do not load the global plugin if running on Windows 
releases other than 10.

Affected #:  1 file

diff --git a/addon/globalPlugins/wintenObjs/__init__.py 
b/addon/globalPlugins/wintenObjs/__init__.py
index c9d06ea..e09a003 100755
--- a/addon/globalPlugins/wintenObjs/__init__.py
+++ b/addon/globalPlugins/wintenObjs/__init__.py
@@ -23,6 +23,7 @@ except:
        w10config = None
 import addonHandler
 addonHandler.initTranslation()
+import winVersion
 
 # Extra UIA constants
 UIA_Drag_DragStartEventId = 20026
@@ -137,6 +138,8 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
 
        def __init__(self):
                super(GlobalPlugin, self).__init__()
+               # Don't do anything unless this is Windows 10.
+               if winVersion.winVersion.major < 10: return
                # #20: don't even think about proceeding in secure screens 
(especially add-on updates).
                # #40: skip over the rest if appx is in effect.
                if globalVars.appArgs.secure or config.isAppX: return


https://bitbucket.org/nvdaaddonteam/wintenapps/commits/3de9f69c6b36/
Changeset:   3de9f69c6b36
Branch:      stable
User:        josephsl
Date:        2018-11-28 16:07:30+00:00
Summary:     Shell Experience Host: align code comments and variable names with 
that of NVDA Core.

Affected #:  1 file

diff --git a/addon/appModules/shellexperiencehost.py 
b/addon/appModules/shellexperiencehost.py
index b61260f..5314323 100755
--- a/addon/appModules/shellexperiencehost.py
+++ b/addon/appModules/shellexperiencehost.py
@@ -21,15 +21,15 @@ class AppModule(AppModule):
                                obj.role = controlTypes.ROLE_BUTTON
                                obj.states.discard(controlTypes.STATE_CHECKABLE)
 
-       # Argh, somehow, item status property repeats when Action Center is 
opened more than once.
-       _itemStatusMessage = None
+       # Somehow, item status property repeats when Action Center is opened 
more than once.
+       _itemStatusMessageCache = None
 
        def event_UIA_itemStatus(self, obj, nextHandler):
                if isinstance(obj, UIA):
                        # Fetching cached item status causes a COM error to be 
logged.
                        itemStatus = obj.UIAElement.currentItemStatus
                        # And no, I don't want to hear repetitions.
-                       if itemStatus != self._itemStatusMessage:
+                       if itemStatus != self._itemStatusMessageCache:
                                ui.message(": ".join([obj.name, itemStatus]))
-                               self._itemStatusMessage = itemStatus
+                               self._itemStatusMessageCache = itemStatus
                nextHandler()

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

--

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: