Skip to content

Commit a3ebf6b

Browse files
authored
Merge d84a1c4 into f62986e
2 parents f62986e + d84a1c4 commit a3ebf6b

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

source/gui/__init__.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: UTF-8 -*-
22
# A part of NonVisual Desktop Access (NVDA)
3-
# Copyright (C) 2006-2022 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Mesar Hameed, Joseph Lee,
3+
# Copyright (C) 2006-2023 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Mesar Hameed, Joseph Lee,
44
# Thomas Stivers, Babbage B.V., Accessolutions, Julien Cochuyt, Cyrille Bougot
55
# This file is covered by the GNU General Public License.
66
# See the file COPYING for more details.
@@ -136,7 +136,6 @@ def showGui(self):
136136
# Therefore, move the mouse to the center of the screen so that the menu will always pop up there.
137137
location = api.getDesktopObject().location
138138
winUser.setCursorPos(*location.center)
139-
self.evaluateUpdatePendingUpdateMenuItemCommand()
140139
self.sysTrayIcon.onActivate(None)
141140

142141
def onRevertToSavedConfigurationCommand(self,evt):
@@ -203,14 +202,8 @@ def onExecuteUpdateCommand(self, evt):
203202
updateCheck.executePendingUpdate()
204203

205204
def evaluateUpdatePendingUpdateMenuItemCommand(self):
206-
try:
207-
self.sysTrayIcon.menu.Remove(self.sysTrayIcon.installPendingUpdateMenuItem)
208-
except:
209-
log.debug("Error while removing pending update menu item", exc_info=True)
210-
pass
211-
if not globalVars.appArgs.secure and updateCheck and updateCheck.isPendingUpdate():
212-
self.sysTrayIcon.menu.Insert(self.sysTrayIcon.installPendingUpdateMenuItemPos,self.sysTrayIcon.installPendingUpdateMenuItem)
213-
205+
self.sysTrayIcon.evaluateUpdatePendingUpdateMenuItemCommand()
206+
214207
@blockAction.when(blockAction.Context.MODAL_DIALOG_OPEN)
215208
def onExitCommand(self, evt):
216209
if config.conf["general"]["askToExit"]:
@@ -524,8 +517,17 @@ def __init__(self, frame: MainFrame):
524517

525518
self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.onActivate)
526519
self.Bind(wx.adv.EVT_TASKBAR_RIGHT_DOWN, self.onActivate)
527-
520+
521+
def evaluateUpdatePendingUpdateMenuItemCommand(self):
522+
try:
523+
self.menu.Remove(self.installPendingUpdateMenuItem)
524+
except Exception:
525+
log.debug("Error while removing pending update menu item", exc_info=True)
526+
if not globalVars.appArgs.secure and updateCheck and updateCheck.isPendingUpdate():
527+
self.menu.Insert(self.installPendingUpdateMenuItemPos, self.installPendingUpdateMenuItem)
528+
528529
def onActivate(self, evt):
530+
self.evaluateUpdatePendingUpdateMenuItemCommand()
529531
mainFrame.prePopup()
530532
import appModules.nvda
531533
if not appModules.nvda.nvdaMenuIaIdentity:

0 commit comments

Comments
 (0)