Skip to content

Commit d9b29b2

Browse files
authored
Merge ad1f2ad into a232641
2 parents a232641 + ad1f2ad commit d9b29b2

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

source/gui/__init__.py

Lines changed: 19 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,14 @@ 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+
log.warning(
206+
"MainFrame.evaluateUpdatePendingUpdateMenuItemCommand is deprecated. "
207+
"Use SysTrayIcon.evaluateUpdatePendingUpdateMenuItemCommand instead.",
208+
stack_info=True,
209+
)
210+
self.sysTrayIcon.evaluateUpdatePendingUpdateMenuItemCommand()
211+
212+
214213
@blockAction.when(blockAction.Context.MODAL_DIALOG_OPEN)
215214
def onExitCommand(self, evt):
216215
if config.conf["general"]["askToExit"]:
@@ -524,8 +523,17 @@ def __init__(self, frame: MainFrame):
524523

525524
self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.onActivate)
526525
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+
528535
def onActivate(self, evt):
536+
self.evaluateUpdatePendingUpdateMenuItemCommand()
529537
mainFrame.prePopup()
530538
import appModules.nvda
531539
if not appModules.nvda.nvdaMenuIaIdentity:

0 commit comments

Comments
 (0)