Skip to content

Commit 0c06b85

Browse files
authored
Merge a74d33a into a232641
2 parents a232641 + a74d33a commit 0c06b85

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

source/gui/__init__.py

Lines changed: 18 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,13 @@ 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+
214212
@blockAction.when(blockAction.Context.MODAL_DIALOG_OPEN)
215213
def onExitCommand(self, evt):
216214
if config.conf["general"]["askToExit"]:
@@ -524,8 +522,17 @@ def __init__(self, frame: MainFrame):
524522

525523
self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.onActivate)
526524
self.Bind(wx.adv.EVT_TASKBAR_RIGHT_DOWN, self.onActivate)
527-
525+
526+
def evaluateUpdatePendingUpdateMenuItemCommand(self):
527+
try:
528+
self.menu.Remove(self.installPendingUpdateMenuItem)
529+
except Exception:
530+
log.debug("Error while removing pending update menu item", exc_info=True)
531+
if not globalVars.appArgs.secure and updateCheck and updateCheck.isPendingUpdate():
532+
self.menu.Insert(self.installPendingUpdateMenuItemPos, self.installPendingUpdateMenuItem)
533+
528534
def onActivate(self, evt):
535+
self.evaluateUpdatePendingUpdateMenuItemCommand()
529536
mainFrame.prePopup()
530537
import appModules.nvda
531538
if not appModules.nvda.nvdaMenuIaIdentity:

0 commit comments

Comments
 (0)