Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienCochuyt committed Aug 21, 2024
1 parent 2c2129a commit 1c340e1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 147 deletions.
122 changes: 6 additions & 116 deletions addon/globalPlugins/webAccess/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@


__version__ = "2021.03.12"
__author__ = (
"Yannick Plassiard <[email protected]>, "
"Frédéric Brugnot <[email protected]>, "
"Julien Cochuyt <[email protected]>"
__authors__ = (
"Yannick Plassiard <[email protected]>",
"Frédéric Brugnot <[email protected]>",
"Julien Cochuyt <[email protected]>",
"André-Abush Clause <[email protected]>",
"Gatien Bouyssou <[email protected]>",
)


Expand Down Expand Up @@ -261,118 +263,6 @@ def script_showWebAccessSettings(self, gesture): # @UnusedVariable
category=SCRIPT_CATEGORY,
gesture="kb:nvda+control+shift+w"
)
def script_debugWebModule(self, gesture): # @UnusedVariable
global activeWebApp
focus = api.getFocusObject()
if \
activeWebApp is None \
and not hasattr(focus, "_webApp") \
and not hasattr(focus, "treeInterceptor") \
and not hasattr(focus.treeInterceptor, "_webApp") \
and not hasattr(focus.treeInterceptor, "nodeManager"):
ui.message("Pas de WebModule actif")
return

diverged = False
focusModule = None
treeModule = None
msg = "Divergence :"
msg += os.linesep
msg += "activeWebApp = {webModule}".format(
webModule=activeWebApp.storeRef
if hasattr(activeWebApp, "storeRef")
else activeWebApp
)
if activeWebApp is not None:
msg += " ({id})".format(id=id(activeWebApp))
if not hasattr(focus, "_webApp"):
msg += os.linesep
msg += "focus._webApp absent"
else:
focusModule = focus._webApp
if activeWebApp is not focusModule:
diverged = True
msg += os.linesep
msg += "focus._webApp = {webModule}".format(
webModule=
focusModule.storeRef
if hasattr(focusModule, "storeRef")
else focusModule
)
if focusModule is not None:
msg += " ({id})".format(id=id(focusModule))
if not hasattr(focus, "treeInterceptor"):
diverged = True
msg += os.linesep
msg += "focus.treeInterceptor absent"
else:
if focus.treeInterceptor is None:
diverged = True
msg += os.linesep
msg += "focus.treeInterceptor None"
# if not hasattr(focusModule, "treeInterceptor"):
# diverged = True
# msg += os.linesep
# msg += u"focus._webApp.treeInterceptor absent"
# elif focusModule.treeInterceptor is None:
# diverged = True
# msg += os.linesep
# msg += u"focus._webApp.treeInterceptor None"
# elif focus.treeInterceptor is not focusModule.treeInterceptor:
# diverged = True
# msg += os.linesep
# msg += u"TreeInterceptors différents"
if hasattr(focus.treeInterceptor, "_webApp"):
treeModule = focus.treeInterceptor._webApp
if \
treeModule is not focusModule \
or treeModule is not activeWebApp:
diverged = True
msg += os.linesep
msg += "treeInterceptor._webApp = {webModule}".format(
webModule=
treeModule.storeRef
if hasattr(treeModule, "storeRef")
else treeModule
)
if treeModule is not None:
msg += " ({id})".format(id=id(treeModule))
if hasattr(focus.treeInterceptor, "nodeManager"):
if focusModule is None:
diverged = True
msg += "treeInterceptor.nodeManager "
if focus.treeInterceptor.nodeManager is None:
msg += "est None"
else:
msg += "n'est pas None"
elif \
focusModule.ruleManager.nodeManager is not \
focus.treeInterceptor.nodeManager:
diverged = True
msg += os.linesep
msg += "NodeManagers différents"
elif focusModule.ruleManager.nodeManager is None:
msg += os.linesep
msg += "NodeManagers None"


allMsg = ""

if not diverged:
try:
from six import text_type
except ImportError:
# NVDA version < 2018.3
text_type = str
msg = text_type(focusModule.storeRef)
speech.speakMessage(msg)
allMsg += msg + os.linesep

treeInterceptor = html.getTreeInterceptor()
msg = "nodeManager %d caractères, %s, %s" % (treeInterceptor.nodeManager.treeInterceptorSize, treeInterceptor.nodeManager.isReady, treeInterceptor.nodeManager.mainNode is not None)
speech.speakMessage(msg)
allMsg += msg + os.linesep
api.copyToClip(allMsg)

@script(
# Translators: Input help mode message for show Web Access menu command.
Expand Down
34 changes: 8 additions & 26 deletions addon/globalPlugins/webAccess/webAppScheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

# This file is part of Web Access for NVDA.
# Copyright (C) 2015-2021 Accessolutions (http://accessolutions.fr)
# Copyright (C) 2015-2024 Accessolutions (http://accessolutions.fr)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -22,8 +22,13 @@
# Get ready for Python 3


__version__ = "2021.03.12"
__author__ = "Frédéric Brugnot <[email protected]>"
__version__ = "2024.08.21"
__authors__ = (
"Frédéric Brugnot <[email protected]>",
"Julien Cochuyt <[email protected]>",
"André-Abush Clause <[email protected]>",
"Gatien Bouyssou <[email protected]>",
)


import threading
Expand Down Expand Up @@ -131,29 +136,6 @@ def event_treeInterceptor_gainFocus(self, treeInterceptor, firstGainFocus):
#browseMode.reportPassThrough(treeInterceptor)
self.send(eventName="updateNodeManager", treeInterceptor=treeInterceptor)

def event_checkWebAppManager(self):
# TODO: Should not be triggered anymore
log.error("event_checkWebAppManager")
focus = api.getFocusObject()
webApp = focus.webAccess.webModule if isinstance(focus, WebAccessObject) else None
TRACE("event_checkWebAppManager: webApp={webApp}".format(
webApp=id(webApp) if webApp is not None else None
))
if webApp:
treeInterceptor = focus.treeInterceptor
if treeInterceptor:
#webApp.treeInterceptor = treeInterceptor
nodeManager = getattr(treeInterceptor, "nodeManager", None)
TRACE(
"event_checkWebAppManager: "
"nodeManager={nodeManager}".format(
nodeManager=id(nodeManager)
if nodeManager is not None else None
)
)
if nodeManager:
webApp.markerManager.update(nodeManager)

def event_updateNodeManager(self, treeInterceptor):
if not (
isinstance(treeInterceptor, WebAccessBmdti)
Expand Down
6 changes: 1 addition & 5 deletions addon/globalPlugins/webAccess/webModuleHandler/webModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# See the file COPYING.txt at the root of this distribution for more details.


__version__ = "2024.08.20"
__version__ = "2024.08.21"
__authors__ = (
"Yannick Plassiard <[email protected]>",
"Frédéric Brugnot <[email protected]>",
Expand Down Expand Up @@ -281,10 +281,6 @@ def _setLayeredProperty(self, name, value):
layer.dirty = True
data["properties"][name] = overridden

def event_webApp_init(self, obj, nextHandler):
self.loadUserFile()
nextHandler()

def event_webApp_pageChanged(self, pageTitle, nextHandler):
speech.cancelSpeech()
playWebAppSound("pageChanged")
Expand Down

0 comments on commit 1c340e1

Please sign in to comment.