Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to check for, download, and apply add-on updates #6930

Closed
wants to merge 94 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
e6a4e32
Add-ons Manager: introduce a non-functioing add-on update button that…
josephsl Jan 27, 2017
34f69e0
Add-on handler: add a new function to check for add-on updates, add-o…
josephsl Jan 27, 2017
d2f062c
Merge branch 'master' into i3208-updateAddonsClient
josephsl Feb 7, 2017
c8ad161
Add-ons Manager: a prototype of add-on update results dialog and add-…
josephsl Feb 7, 2017
a4e8d47
Add-ons Manager: provide a function to update add-ons with no prmopts…
josephsl Feb 9, 2017
445434a
Add-on handler: introduce a blueprint of add-on update procedure that…
josephsl Feb 9, 2017
bf42394
Add-on updates: use the newly introduced curVersion variable to denot…
josephsl Feb 9, 2017
044a5e8
Merge branch 'master' into i3208-updateAddonsClient
josephsl Feb 21, 2017
e38bae3
Add-on update downloader: initial implementation, add-on download url…
josephsl Mar 4, 2017
ed7d98f
Update add-ons client: added workarounds for add-ons manager focus pr…
josephsl Mar 5, 2017
ddc9454
Add-ons Manager: introduce a non-functioing add-on update button that…
josephsl Jan 27, 2017
0e4ca58
Add-on handler: add a new function to check for add-on updates, add-o…
josephsl Jan 27, 2017
9b4d2ed
Add-ons Manager: a prototype of add-on update results dialog and add-…
josephsl Feb 7, 2017
4bbd2c5
Add-ons Manager: provide a function to update add-ons with no prmopts…
josephsl Feb 9, 2017
5d29337
Add-on handler: introduce a blueprint of add-on update procedure that…
josephsl Feb 9, 2017
e13f008
Add-on updates: use the newly introduced curVersion variable to denot…
josephsl Feb 9, 2017
996d3c5
Add-on update downloader: initial implementation, add-on download url…
josephsl Mar 4, 2017
c0d982a
Update add-ons client: added workarounds for add-ons manager focus pr…
josephsl Mar 5, 2017
947a602
Merge branch 'i3208-updateAddonsClient' of https://github.com/josephs…
josephsl Mar 21, 2017
93f8827
Add-on updates: use generators in order to update add-ons one at a ti…
josephsl Mar 24, 2017
a3c36aa
Add-on updates: continue updating even if add-on installation fails. …
josephsl Mar 24, 2017
4989c1d
GUI/Settings: add a checkbox in General Settings to check for add-on …
josephsl Mar 24, 2017
fa63a2c
Add-on updates: infrastructure to support automatic add-on update che…
josephsl Mar 24, 2017
a4edc66
User guide: documented add-on update facility and steps. re #3208
josephsl Mar 24, 2017
eb55658
Add-ons manager: docstring updates, label updates, translator comment…
josephsl Mar 24, 2017
de44a11
Add-ons manager and user guide, point add-ons address to https instea…
josephsl Mar 24, 2017
7eff6f9
Merge branch 'master' into i3208-updateAddonsClient
josephsl Jul 12, 2017
9c6b3e2
Merge branch 'master' into i3208-updateAddonsClient
josephsl Jul 25, 2017
5cf92f5
Merge branch 'master' into i3208-updateAddonsClient
josephsl Oct 6, 2017
389ea51
Merge branch 'master' into i3208-updateAddonsClient
josephsl Oct 18, 2017
34095f1
Merge branch 'master' into i3208-updateAddonsClient
josephsl Jan 4, 2018
2e19aa5
Merge branch 'master' into i3208-updateAddonsClient
josephsl Mar 30, 2018
b4dfbdd
Update copyright headers
josephsl Mar 30, 2018
64d1ce6
Merge branch 'master' into i3208-updateAddonsClient
josephsl May 8, 2018
c94f09a
User guide: anchor for add-on update checkbox in general settings panel.
josephsl May 8, 2018
9ae96e5
Merged master
josephsl Jul 18, 2018
faf6032
Settings dialog: resolve conflicts regarding add-on update check sett…
josephsl Jul 18, 2018
a7a8ec7
Merge branch 'master' into i3208-updateAddonsClient
josephsl Jul 22, 2018
405ab45
Comment typo fixed
josephsl Jul 22, 2018
f88e512
Add-ons manager: hidden while update is in progress. Re #3208.
josephsl Jul 22, 2018
51ee67d
Add-on updates client: sequence changes, installing add-ons in alphab…
josephsl Jul 22, 2018
15fbfb7
Merge branch 'master' into i3208-updateAddonsClient
josephsl Aug 4, 2018
3bf6104
Add-on handler: catch possible exceptions when add-on update fails fo…
josephsl Aug 4, 2018
cb9defc
Add-on update check interface: select the first available update entr…
josephsl Aug 4, 2018
93df03d
Merge branch 'master' into i3208-updateAddonsClient
josephsl Aug 14, 2018
150cc7f
Merge branch 'master' into i3208-updateAddonsClient
josephsl Aug 15, 2018
587f3d8
Add-on update checks: add ability to select which add-ons should be u…
josephsl Aug 23, 2018
382f620
Add-on update results: check all add-ons so update button can be show…
josephsl Aug 26, 2018
42e4a86
Merge branch 'master' into i3208-updateAddonsClient
josephsl Aug 26, 2018
d9e1a14
Update results dialog: enable update button by default, as add-on che…
josephsl Aug 27, 2018
1bd8249
Add-on update check button: leave the button disabled if update check…
josephsl Aug 27, 2018
234251a
Merge branch 'master' into i3208-updateAddonsClient
josephsl Sep 25, 2018
77bf368
Merge branch 'master' into i3208-updateAddonsClient
josephsl Nov 15, 2018
02ad573
Add-on GUI: use relative import.
josephsl Nov 16, 2018
f6a7abe
Add-on updates dialog: display add-on update results dialog on startu…
josephsl Nov 16, 2018
0ce1bbd
Add-on handler: do not check for updates for add-ons with update chec…
josephsl Nov 16, 2018
08f4a50
Add-ons manager: add a dialog to let users turn off update check for …
josephsl Nov 16, 2018
e9f07b4
User guide: document manage add-on update checks dialog, clarify word…
josephsl Nov 16, 2018
44d8d78
Merge branch 'master' into i3208-updateAddonsClient
josephsl Dec 6, 2018
c5de0f9
Add-on Handler: change line endings for compatibility with master bra…
josephsl Dec 6, 2018
b97258e
Merged master
josephsl Dec 6, 2018
b084125
Add-on updates: initialize no updates set if not present in add-on ha…
josephsl Dec 6, 2018
05a3548
Merge branch 'master' of https://github.com/nvaccess/nvda into i3208-…
josephsl Dec 12, 2018
90d364f
Update downloader: handle a case where file version for newly downloa…
josephsl Dec 12, 2018
743d60e
Add-ons Manager: handle add-on updates just like add-on installs. re …
josephsl Dec 12, 2018
a511355
Merged origin/master
josephsl Feb 13, 2019
c44bfe8
Add-on handler: remove unused import
josephsl Feb 13, 2019
d95b0ea
Update check: do not check for add-on updates if NVDA is running as a…
josephsl Feb 13, 2019
c75ca3c
Add-ons manager/update check: incorporate latest changes from master …
josephsl Feb 13, 2019
654b408
Update copyright years
josephsl Feb 15, 2019
c1b0bff
Update check/add-on downloader: file version requiremenet is no longe…
josephsl Feb 15, 2019
d1ce33f
Merged master
josephsl Apr 13, 2019
ad4d168
Merge remote-tracking branch 'origin/master' into i3208-updateAddonsC…
josephsl May 4, 2019
52ca10f
Add-on updates dialog: correct translator comments.
josephsl May 4, 2019
f3b281a
Python 3: xrange -> range, no more unicode function.
josephsl May 4, 2019
40ddd8d
Merged 'master'
josephsl Jul 2, 2019
e0893bb
Add-on GUI: remove extra parenthesis.
josephsl Jul 2, 2019
437ba48
Merge branch 'master' into i3208-updateAddonsClient
josephsl Jul 5, 2019
518402f
Add-on update check: update pseudo-code to Python 3.
josephsl Jul 5, 2019
5c2dc6d
Add-on updates dialog: fix typo on translator comments.
josephsl Jul 5, 2019
4886c48
Merged threshold
josephsl Jul 15, 2019
246d6e1
Update check: import auto add-on update check function directly from …
josephsl Jul 15, 2019
00dbe1c
Merge branch 'master' into i3208-updateAddonsClient
josephsl Jul 26, 2019
f9aefda
Merge branch 'master' into i3208-updateAddonsClient
josephsl Aug 1, 2019
e3e316b
Add-on handler: applied lint fixes.
josephsl Aug 2, 2019
a2ea300
Add-on GUI: apply lint fixes.
josephsl Aug 2, 2019
e9958d2
Merge branch 'master' into i3208-updateAddonsClient
josephsl Aug 2, 2019
001097b
GUI: add-on GUI and settings screen edited with lint fixes.
josephsl Aug 2, 2019
45ac3a8
Add-on GUI and update check: lint fixes.
josephsl Aug 2, 2019
787d34b
Merge branch 'master' into i3208-updateAddonsClient
josephsl Sep 18, 2019
55dd47e
Settings dialog: remove duplicate translator comment. Re #3208
josephsl Sep 23, 2019
4882427
Add-ons manager: enable add-on update check settings if and only if a…
josephsl Sep 23, 2019
9e9e2fb
Merge branch 'master' into i3208-updateAddonsClient
josephsl Oct 2, 2019
2e661f2
Merge branch 'master' into i3208-updateAddonsClient
josephsl Nov 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 65 additions & 3 deletions source/addonHandler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# -*- coding: UTF-8 -*-
#addonHandler.py
# addonHandler/__init__.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2012-2019 Rui Batista, NV Access Limited, Noelia Ruiz Martínez, Joseph Lee, Babbage B.V., Arnold Loubriat
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.

"""Manages add-ons
The add-on handler provides a definition of an add-on bundle,
as well as functions to install, remove, disable/enable, and update add-on bundles.
See https://addons.nvda-project.org for more information on NVDA community add-ons.
See the NVDA developer guide for more info on writing add-ons.
"""

import sys
import os.path
import gettext
Expand All @@ -19,9 +26,12 @@
from six import string_types
import globalVars
import zipfile
import threading
import wx
# #3208 todo: tentatively use JSON for exchanging add-on update data.
import json
from configobj import ConfigObj
from configobj.validate import Validator

import config
import globalVars
import languageHandler
Expand Down Expand Up @@ -57,6 +67,8 @@ def loadState():
state["pendingDisableSet"] = set()
if "pendingEnableSet" not in state:
state["pendingEnableSet"] = set()
if "noUpdates" not in state:
state["noUpdates"] = set()
except:
# Defaults.
state = {
Expand All @@ -65,6 +77,7 @@ def loadState():
"disabledAddons":set(),
"pendingEnableSet":set(),
"pendingDisableSet":set(),
"noUpdates": set(),
}

def saveState():
Expand Down Expand Up @@ -145,6 +158,54 @@ def disableAddonsIfAny():
state["pendingDisableSet"].clear()
state["pendingEnableSet"].clear()


def checkForAddonUpdates():
# Prepare to receive a record of add-ons with update checking turned off.
if "noUpdates" not in state:
state["noUpdates"] = set()
curAddons = {}
addonSummaries = {}
for addon in getAvailableAddons():
name = addon.name
# Only check for updates for add-ons that can check for updates.
if name in state["noUpdates"]:
continue
manifest = addon.manifest
curVersion = manifest["version"]
curAddons[name] = {"summary": manifest["summary"], "version": curVersion}
addonSummaries[name] = {"summary": manifest["summary"], "curVersion": curVersion}
data = json.dumps(curAddons)
# Pseudocode:
"""try:
res = urllib.request.open(someURL, data)
# Check SSL and what not.
res = json.loads(res)"""
res = json.loads(data)
for addon in res:
res[addon].update(addonSummaries[addon])
# In reality, it'll be a list of URL's to try.
res[addon]["urls"] = None
return res


def autoAddonUpdateCheck():
t = threading.Thread(target=_showAddonUpdateUI)
t.daemon = True
t.start()


def _showAddonUpdateUI():
def _showAddonUpdateUICallback(info):
# The only purpose of this callback is to force add-on updates window to show up at startup.
import gui
from gui.addonGui import AddonUpdatesDialog
gui.mainFrame.prePopup()
AddonUpdatesDialog(gui.mainFrame, info).Show()
gui.mainFrame.postPopup()
info = checkForAddonUpdates()
if info is not None:
wx.CallAfter(_showAddonUpdateUICallback, info)

def initialize():
""" Initializes the add-ons subsystem. """
if config.isAppX:
Expand All @@ -158,7 +219,8 @@ def initialize():
disableAddonsIfAny()
getAvailableAddons(refresh=True)
saveState()

# #3208 todo: Check for add-on updates unless NVDA itself is updating right now.
# checkForAddonUpdates()

def terminate():
""" Terminates the add-ons subsystem. """
Expand Down
1 change: 1 addition & 0 deletions source/config/configSpec.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
startupNotification = boolean(default=true)
allowUsageStats = boolean(default=false)
askedAllowUsageStats = boolean(default=false)
addonUpdateAtStartup = boolean(default=true)

[inputComposition]
autoReportAllCandidates = boolean(default=True)
Expand Down
Loading