|
1 | 1 | # -*- coding: UTF-8 -*- |
2 | 2 | # 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, |
4 | 4 | # Thomas Stivers, Babbage B.V., Accessolutions, Julien Cochuyt, Cyrille Bougot |
5 | 5 | # This file is covered by the GNU General Public License. |
6 | 6 | # See the file COPYING for more details. |
@@ -136,7 +136,6 @@ def showGui(self): |
136 | 136 | # Therefore, move the mouse to the center of the screen so that the menu will always pop up there. |
137 | 137 | location = api.getDesktopObject().location |
138 | 138 | winUser.setCursorPos(*location.center) |
139 | | - self.evaluateUpdatePendingUpdateMenuItemCommand() |
140 | 139 | self.sysTrayIcon.onActivate(None) |
141 | 140 |
|
142 | 141 | def onRevertToSavedConfigurationCommand(self,evt): |
@@ -203,14 +202,8 @@ def onExecuteUpdateCommand(self, evt): |
203 | 202 | updateCheck.executePendingUpdate() |
204 | 203 |
|
205 | 204 | 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 | + |
214 | 207 | @blockAction.when(blockAction.Context.MODAL_DIALOG_OPEN) |
215 | 208 | def onExitCommand(self, evt): |
216 | 209 | if config.conf["general"]["askToExit"]: |
@@ -524,8 +517,17 @@ def __init__(self, frame: MainFrame): |
524 | 517 |
|
525 | 518 | self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.onActivate) |
526 | 519 | 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 | + |
528 | 529 | def onActivate(self, evt): |
| 530 | + self.evaluateUpdatePendingUpdateMenuItemCommand() |
529 | 531 | mainFrame.prePopup() |
530 | 532 | import appModules.nvda |
531 | 533 | if not appModules.nvda.nvdaMenuIaIdentity: |
|
0 commit comments