From fe18baed4e84b80f2cd79a8e1be21bd33ab5613e Mon Sep 17 00:00:00 2001 From: Leonard de Ruijter Date: Tue, 25 Jul 2023 11:19:45 +0200 Subject: [PATCH] Add onInstall check --- addon/installTasks.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/addon/installTasks.py b/addon/installTasks.py index afb1fd0..9c4e38c 100644 --- a/addon/installTasks.py +++ b/addon/installTasks.py @@ -1,5 +1,8 @@ import typing from time import sleep +import addonHandler +import gui +import wx if typing.TYPE_CHECKING: from .lib import configuration @@ -12,6 +15,22 @@ def onInstall(): + for addon in addonHandler.getAvailableAddons(): + if addon.name == "nvdaRd": + result = gui.messageBox( + # Translators: message asking the user to remove nvdaRd add-on + _("This add-on was previously called NVDA Remote Desktop. " + "You have an installed version of that add-on. " + "Would you like to update to RDAccess?"), + # Translators: question title + _("Previous version detected"), + wx.YES_NO|wx.ICON_QUESTION, + gui.mainFrame + ) + if result == wx.YES: + addon.requestRemove() + else: + raise addonHandler.AddonError("Installed nvdaRd found that needs to be removed first") configuration.initializeConfig()