|
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,14 @@ 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 | + log.warning( |
| 206 | + "MainFrame.evaluateUpdatePendingUpdateMenuItemCommand is deprecated. " |
| 207 | + "Use SysTrayIcon.evaluateUpdatePendingUpdateMenuItemCommand instead.", |
| 208 | + stack_info=True, |
| 209 | + ) |
| 210 | + self.sysTrayIcon.evaluateUpdatePendingUpdateMenuItemCommand() |
| 211 | + |
| 212 | + |
214 | 213 | @blockAction.when(blockAction.Context.MODAL_DIALOG_OPEN) |
215 | 214 | def onExitCommand(self, evt): |
216 | 215 | if config.conf["general"]["askToExit"]: |
@@ -524,8 +523,17 @@ def __init__(self, frame: MainFrame): |
524 | 523 |
|
525 | 524 | self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.onActivate) |
526 | 525 | self.Bind(wx.adv.EVT_TASKBAR_RIGHT_DOWN, self.onActivate) |
527 | | - |
| 526 | + |
| 527 | + def evaluateUpdatePendingUpdateMenuItemCommand(self): |
| 528 | + try: |
| 529 | + self.menu.Remove(self.installPendingUpdateMenuItem) |
| 530 | + except Exception: |
| 531 | + log.debug("Error while removing pending update menu item", exc_info=True) |
| 532 | + if not globalVars.appArgs.secure and updateCheck and updateCheck.isPendingUpdate(): |
| 533 | + self.menu.Insert(self.installPendingUpdateMenuItemPos, self.installPendingUpdateMenuItem) |
| 534 | + |
528 | 535 | def onActivate(self, evt): |
| 536 | + self.evaluateUpdatePendingUpdateMenuItemCommand() |
529 | 537 | mainFrame.prePopup() |
530 | 538 | import appModules.nvda |
531 | 539 | if not appModules.nvda.nvdaMenuIaIdentity: |
|
0 commit comments