From 319bab77eaf66a5349c6a651454c8a756cde22c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9-Abush=20Clause?= Date: Thu, 25 Jul 2024 20:41:37 +0200 Subject: [PATCH 1/5] Add-on Template: update to nvdaaddons/addonTemplate@4ca17c1 --- .github/workflows/build_addon.yml | 2 +- .vscode/extensions.json | 2 +- .vscode/settings.json | 4 - pyproject.toml | 40 ++++++++++ sconstruct | 121 ++++++++---------------------- 5 files changed, 72 insertions(+), 97 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/build_addon.yml b/.github/workflows/build_addon.yml index 9b97cd9f..2ef96527 100644 --- a/.github/workflows/build_addon.yml +++ b/.github/workflows/build_addon.yml @@ -24,7 +24,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 cache: 'pip' - name: Install dependencies diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 514e061d..854ca858 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,7 +6,7 @@ "ms-python.python", "ms-python.vscode-pylance", "redhat.vscode-yaml", - "ms-python.flake8" + "charliermarsh.ruff" ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [] diff --git a/.vscode/settings.json b/.vscode/settings.json index 6126d281..057f5a3c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,9 +1,5 @@ { "editor.accessibilitySupport": "on", - "flake8.args": [ - "--config=flake8.ini" - ], - "flake8.importStrategy": "fromEnvironment", "python.autoComplete.extraPaths": [ "../nvda/source", "../nvda/miscDeps/python" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..4d76bfe5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[tool.ruff] +line-length = 110 + +builtins = [ + # translation lookup + "_", + # translation lookup + "ngettext", + # translation lookup + "pgettext", + # translation lookup + "npgettext", +] + +include = [ + "*.py", + "sconstruct", +] + +exclude = [ + ".git", + "__pycache__", +] + +[tool.ruff.format] +indent-style = "tab" + +[tool.ruff.lint.mccabe] +max-complexity = 15 + +[tool.ruff.lint] +ignore = [ + # indentation contains tabs + "W191", +] + +[tool.ruff.lint.per-file-ignores] +# sconstruct contains many inbuilt functions not recognised by the lint, +# so ignore F821. +"sconstruct" = ["F821"] diff --git a/sconstruct b/sconstruct index dde28aff..cb3639ec 100644 --- a/sconstruct +++ b/sconstruct @@ -1,5 +1,5 @@ # NVDA add-on template SCONSTRUCT file -# Copyright (C) 2012-2023 Rui Batista, Noelia Martinez, Joseph Lee +# Copyright (C) 2012-2024 Rui Batista, Noelia Martinez, Joseph Lee # This file is covered by the GNU General Public License. # See the file COPYING.txt for more details. @@ -10,12 +10,9 @@ import os.path import zipfile import sys -# While names imported below are available by default in every SConscript -# Linters aren't aware about them. -# To avoid Flake8 F821 warnings about them they are imported explicitly. -# When using other Scons functions please add them to the line below. -from SCons.Script import BoolVariable, Builder, Copy, Environment, Variables - +# Add-on localization exchange facility and the template requires Python 3.10. +# For best practice, use Python 3.11 or later to align with NVDA development. +EnsurePythonVersion(3, 10) sys.dont_write_bytecode = True # Bytecode should not be written for build vars module to keep the repository root folder clean. @@ -48,12 +45,12 @@ def md2html(source, dest): # Optimization: build resulting HTML text in one go instead of writing parts separately. docText = "\n".join([ "", - "" % lang, + f"", "", "" "", "", - "%s" % title, + f"{title}", "\n", htmlText, "\n" @@ -65,7 +62,7 @@ def md2html(source, dest): def mdTool(env): mdAction = env.Action( lambda target, source, env: md2html(source[0].path, target[0].path), - lambda target, source, env: 'Generating % s' % target[0], + lambda target, source, env: f"Generating {target[0]}", ) mdBuilder = env.Builder( action=mdAction, @@ -77,7 +74,7 @@ def mdTool(env): def validateVersionNumber(key, val, env): # Used to make sure version major.minor.patch are integers to comply with NV Access add-on store. - # Ignore all this if version number is not specified, in which case json generator will validate this info. + # Ignore all this if version number is not specified. if val == "0.0.0": return versionNumber = val.split(".") @@ -118,7 +115,7 @@ addonFile = env.File("${addon_name}-${addon_version}.nvda-addon") def addonGenerator(target, source, env, for_signature): action = env.Action( lambda target, source, env: createAddonBundleFromPath(source[0].abspath, target[0].abspath) and None, - lambda target, source, env: "Generating Addon %s" % target[0] + lambda target, source, env: f"Generating Addon {target[0]}" ) return action @@ -126,7 +123,7 @@ def addonGenerator(target, source, env, for_signature): def manifestGenerator(target, source, env, for_signature): action = env.Action( lambda target, source, env: generateManifest(source[0].abspath, target[0].abspath) and None, - lambda target, source, env: "Generating manifest %s" % target[0] + lambda target, source, env: f"Generating manifest {target[0]}" ) return action @@ -136,7 +133,7 @@ def translatedManifestGenerator(target, source, env, for_signature): lang = os.path.basename(dir) action = env.Action( lambda target, source, env: generateTranslatedManifest(source[1].abspath, lang, target[0].abspath) and None, - lambda target, source, env: "Generating translated manifest %s" % target[0] + lambda target, source, env: f"Generating translated manifest {target[0]}" ) return action @@ -170,91 +167,24 @@ def createAddonBundleFromPath(path, dest): absPath = os.path.join(dir, filename) if pathInBundle not in buildVars.excludedFiles: z.write(absPath, pathInBundle) - # Add-on store does not require submitting json files. - # createAddonStoreJson(dest) return dest -def createAddonStoreJson(bundle): - """Creates add-on store JSON file from an add-on package and manifest data.""" - import json - import hashlib - # Set different json file names and version number properties based on version number parsing results. - if env["versionNumber"] == "0.0.0": - env["versionNumber"] = buildVars.addon_info["addon_version"] - versionNumberParsed = env["versionNumber"].split(".") - if all([part.isnumeric() for part in versionNumberParsed]): - if len(versionNumberParsed) == 1: - versionNumberParsed += ["0", "0"] - elif len(versionNumberParsed) == 2: - versionNumberParsed.append("0") - else: - versionNumberParsed = [] - if len(versionNumberParsed): - major, minor, patch = [int(part) for part in versionNumberParsed] - jsonFilename = f'{major}.{minor}.{patch}.json' - else: - jsonFilename = f'{buildVars.addon_info["addon_version"]}.json' - major, minor, patch = 0, 0, 0 - print('Generating % s' % jsonFilename) - sha256 = hashlib.sha256() - with open(bundle, "rb") as f: - for byte_block in iter(lambda: f.read(65536), b""): - sha256.update(byte_block) - hashValue = sha256.hexdigest() - try: - minimumNVDAVersion = buildVars.addon_info["addon_minimumNVDAVersion"].split(".") - except AttributeError: - minimumNVDAVersion = [0, 0, 0] - minMajor, minMinor = minimumNVDAVersion[:2] - minPatch = minimumNVDAVersion[-1] if len(minimumNVDAVersion) == 3 else "0" - try: - lastTestedNVDAVersion = buildVars.addon_info["addon_lastTestedNVDAVersion"].split(".") - except AttributeError: - lastTestedNVDAVersion = [0, 0, 0] - lastTestedMajor, lastTestedMinor = lastTestedNVDAVersion[:2] - lastTestedPatch = lastTestedNVDAVersion[-1] if len(lastTestedNVDAVersion) == 3 else "0" - channel = buildVars.addon_info["addon_updateChannel"] - if channel is None: - channel = "stable" - addonStoreEntry = { - "addonId": buildVars.addon_info["addon_name"], - "displayName": buildVars.addon_info["addon_summary"], - "URL": "", - "description": buildVars.addon_info["addon_description"], - "sha256": hashValue, - "homepage": buildVars.addon_info["addon_url"], - "addonVersionName": buildVars.addon_info["addon_version"], - "addonVersionNumber": { - "major": major, - "minor": minor, - "patch": patch - }, - "minNVDAVersion": { - "major": int(minMajor), - "minor": int(minMinor), - "patch": int(minPatch) - }, - "lastTestedVersion": { - "major": int(lastTestedMajor), - "minor": int(lastTestedMinor), - "patch": int(lastTestedPatch) - }, - "channel": channel, - "publisher": "", - "sourceURL": buildVars.addon_info["addon_sourceURL"], - "license": buildVars.addon_info["addon_license"], - "licenseURL": buildVars.addon_info["addon_licenseURL"], - } - with open(jsonFilename, "w") as addonStoreJson: - json.dump(addonStoreEntry, addonStoreJson, indent="\t") - - def generateManifest(source, dest): + # Prepare the root manifest section addon_info = buildVars.addon_info with codecs.open(source, "r", "utf-8") as f: manifest_template = f.read() manifest = manifest_template.format(**addon_info) + # Add additional manifest sections such as custom braile tables + # Custom braille translation tables + if getattr(buildVars, "brailleTables", {}): + manifest_brailleTables = ["\n[brailleTables]"] + for table in buildVars.brailleTables.keys(): + manifest_brailleTables.append(f"[[{table}]]") + for key, val in buildVars.brailleTables[table].items(): + manifest_brailleTables.append(f"{key} = {val}") + manifest += "\n".join(manifest_brailleTables) + "\n" with codecs.open(dest, "w", "utf-8") as f: f.write(manifest) @@ -267,6 +197,15 @@ def generateTranslatedManifest(source, language, out): with codecs.open(source, "r", "utf-8") as f: manifest_template = f.read() result = manifest_template.format(**vars) + # Add additional manifest sections such as custom braile tables + # Custom braille translation tables + if getattr(buildVars, "brailleTables", {}): + result_brailleTables = ["\n[brailleTables]"] + for table in buildVars.brailleTables.keys(): + result_brailleTables.append(f"[[{table}]]") + # Fetch display name only. + result_brailleTables.append(f"displayName = {buildVars.brailleTables[table]['displayName']}") + result += "\n".join(result_brailleTables) + "\n" with codecs.open(out, "w", "utf-8") as f: f.write(result) From 158ec22fcd3dc9e9b4bd74415b77c8b03e63fbec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9-Abush=20Clause?= Date: Thu, 25 Jul 2024 20:48:02 +0200 Subject: [PATCH 2/5] .gitignore: exclude .venv/ and .env/ directories --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 0be8af1c..09a1818c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.venv/ +.env/ addon/doc/*.css addon/doc/en/ *_docHandler.py From 39b924843ee5443bd2ea4708c123ca3b17d65e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9-Abush=20Clause?= Date: Thu, 25 Jul 2024 20:55:12 +0200 Subject: [PATCH 3/5] requirements: add linter and pre-commit hooks --- requirements.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/requirements.txt b/requirements.txt index 15f5cbaf..8a73a68c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,9 @@ SCons==4.5.2 # Building user documentation Markdown==3.5.1 + +# Linter and code formatting tool +ruff==0.5.5 + +# Git hook scripts to automate tasks +pre-commit==3.7.1 From 6e33b5ba6483533819e64cc55e8a5c3b09ffd8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9-Abush=20Clause?= Date: Thu, 25 Jul 2024 21:11:13 +0200 Subject: [PATCH 4/5] ruff: apply automatic fixes (130 remaining) --- addon/globalPlugins/webAccess/__init__.py | 2 -- addon/globalPlugins/webAccess/config.py | 1 - addon/globalPlugins/webAccess/gui/__init__.py | 2 +- addon/globalPlugins/webAccess/gui/criteriaEditor.py | 1 - addon/globalPlugins/webAccess/gui/menu.py | 1 - addon/globalPlugins/webAccess/gui/ruleEditor.py | 3 +-- addon/globalPlugins/webAccess/gui/rulesManager.py | 1 - addon/globalPlugins/webAccess/gui/webModuleEditor.py | 3 --- addon/globalPlugins/webAccess/gui/webModulesManager.py | 3 --- addon/globalPlugins/webAccess/overlay.py | 1 - addon/globalPlugins/webAccess/ruleHandler/ruleTypes.py | 1 - addon/globalPlugins/webAccess/store/__init__.py | 2 +- addon/globalPlugins/webAccess/store/addons.py | 2 +- addon/globalPlugins/webAccess/store/webModule.py | 5 +---- addon/globalPlugins/webAccess/webAppLib/__init__.py | 1 - addon/globalPlugins/webAccess/webAppScheduler.py | 1 - addon/globalPlugins/webAccess/webModuleHandler/__init__.py | 4 ++-- .../globalPlugins/webAccess/webModuleHandler/dataRecovery.py | 2 -- addon/globalPlugins/webAccess/webModuleHandler/webModule.py | 5 ----- 19 files changed, 7 insertions(+), 34 deletions(-) diff --git a/addon/globalPlugins/webAccess/__init__.py b/addon/globalPlugins/webAccess/__init__.py index a9078b16..21dd1e17 100644 --- a/addon/globalPlugins/webAccess/__init__.py +++ b/addon/globalPlugins/webAccess/__init__.py @@ -152,7 +152,6 @@ def __init__(self): # FIXME: # After the above import, it appears that the `gui` name now points to the `.gui` module # rather that NVDA's `gui`… No clue why… - import gui settings_initialize() global scheduler @@ -252,7 +251,6 @@ def script_showWebAccessSettings(self, gesture): # @UnusedVariable # FIXME: # After the above import, it appears that the `gui` name now points to the `.gui` module # rather that NVDA's `gui`… No clue why… - import gui gui.mainFrame._popupSettingsDialog(WebAccessSettingsDialog) @script( diff --git a/addon/globalPlugins/webAccess/config.py b/addon/globalPlugins/webAccess/config.py index aa093804..4dae3c7f 100644 --- a/addon/globalPlugins/webAccess/config.py +++ b/addon/globalPlugins/webAccess/config.py @@ -25,7 +25,6 @@ import config -from logHandler import log from . import webModuleHandler diff --git a/addon/globalPlugins/webAccess/gui/__init__.py b/addon/globalPlugins/webAccess/gui/__init__.py index 8c1b3779..cd16b92b 100644 --- a/addon/globalPlugins/webAccess/gui/__init__.py +++ b/addon/globalPlugins/webAccess/gui/__init__.py @@ -104,7 +104,7 @@ def __init__(self, *args, **kwargs): super(ContextualSettingsPanel, self).__init__(*args, **kwargs) def initData(self, context): - raise NotImplemented() + raise NotImplementedError() # Set to True if the view depends on data that can be edited on other panels of the same dialog initData.onPanelActivated = False diff --git a/addon/globalPlugins/webAccess/gui/criteriaEditor.py b/addon/globalPlugins/webAccess/gui/criteriaEditor.py index 1b1c3483..973059c4 100644 --- a/addon/globalPlugins/webAccess/gui/criteriaEditor.py +++ b/addon/globalPlugins/webAccess/gui/criteriaEditor.py @@ -32,7 +32,6 @@ import controlTypes import gui -from logHandler import log from ..ruleHandler import ruleTypes from ..utils import guarded, updateOrDrop diff --git a/addon/globalPlugins/webAccess/gui/menu.py b/addon/globalPlugins/webAccess/gui/menu.py index 826d4b3a..022887cb 100644 --- a/addon/globalPlugins/webAccess/gui/menu.py +++ b/addon/globalPlugins/webAccess/gui/menu.py @@ -35,7 +35,6 @@ from ... import webAccess from .. import ruleHandler from .. import webModuleHandler -from . import webModulesManager def show(context): diff --git a/addon/globalPlugins/webAccess/gui/ruleEditor.py b/addon/globalPlugins/webAccess/gui/ruleEditor.py index d0a867c0..49490825 100644 --- a/addon/globalPlugins/webAccess/gui/ruleEditor.py +++ b/addon/globalPlugins/webAccess/gui/ruleEditor.py @@ -25,7 +25,7 @@ __author__ = "Shirley Noël " -from collections import OrderedDict, namedtuple +from collections import OrderedDict import wx # TODO: Work-arround ExpandoTextCtrl mishandling maxHeight and vscroll # from wx.lib.expando import EVT_ETC_LAYOUT_NEEDED, ExpandoTextCtrl @@ -36,7 +36,6 @@ import inputCore from logHandler import log -from .. import ruleHandler from ..ruleHandler import ruleTypes from ..ruleHandler.controlMutation import ( MUTATIONS_BY_RULE_TYPE, diff --git a/addon/globalPlugins/webAccess/gui/rulesManager.py b/addon/globalPlugins/webAccess/gui/rulesManager.py index 94cc391f..76e5d9e0 100644 --- a/addon/globalPlugins/webAccess/gui/rulesManager.py +++ b/addon/globalPlugins/webAccess/gui/rulesManager.py @@ -635,7 +635,6 @@ def onTreeKeyDown(self, evt): evt.Skip() def onTreeSelChanged(self, evt): - from logHandler import log if ( evt is not None and (evt.EventObject is None or evt.EventObject.IsBeingDeleted()) diff --git a/addon/globalPlugins/webAccess/gui/webModuleEditor.py b/addon/globalPlugins/webAccess/gui/webModuleEditor.py index 5e480a40..16b178b5 100644 --- a/addon/globalPlugins/webAccess/gui/webModuleEditor.py +++ b/addon/globalPlugins/webAccess/gui/webModuleEditor.py @@ -32,10 +32,7 @@ import os import wx -from NVDAObjects import NVDAObject, IAccessible import addonHandler -import api -import controlTypes import config import gui from logHandler import log diff --git a/addon/globalPlugins/webAccess/gui/webModulesManager.py b/addon/globalPlugins/webAccess/gui/webModulesManager.py index 82caabe3..a0a68344 100644 --- a/addon/globalPlugins/webAccess/gui/webModulesManager.py +++ b/addon/globalPlugins/webAccess/gui/webModulesManager.py @@ -30,10 +30,7 @@ import addonHandler addonHandler.initTranslation() import config -import core -import globalVars import gui -import languageHandler from logHandler import log from gui.nvdaControls import AutoWidthColumnListCtrl diff --git a/addon/globalPlugins/webAccess/overlay.py b/addon/globalPlugins/webAccess/overlay.py index 80cc5782..ea68c0b5 100644 --- a/addon/globalPlugins/webAccess/overlay.py +++ b/addon/globalPlugins/webAccess/overlay.py @@ -51,7 +51,6 @@ from six import iteritems -from six.moves import xrange from garbageHandler import TrackedObject diff --git a/addon/globalPlugins/webAccess/ruleHandler/ruleTypes.py b/addon/globalPlugins/webAccess/ruleHandler/ruleTypes.py index 8986d738..42906a9c 100644 --- a/addon/globalPlugins/webAccess/ruleHandler/ruleTypes.py +++ b/addon/globalPlugins/webAccess/ruleHandler/ruleTypes.py @@ -24,7 +24,6 @@ __author__ = "Julien Cochuyt " -from collections import OrderedDict import addonHandler diff --git a/addon/globalPlugins/webAccess/store/__init__.py b/addon/globalPlugins/webAccess/store/__init__.py index f1954b32..824ef6fc 100644 --- a/addon/globalPlugins/webAccess/store/__init__.py +++ b/addon/globalPlugins/webAccess/store/__init__.py @@ -141,7 +141,7 @@ def route(self, ref=None, item=None, **kwargs): if len(ref) == 1: ref = ref[0] else: - ValueError("Unexpected ref format: {ref}".format(ref)) + ValueError("Unexpected ref format: {ref}".format()) else: storeKey = ref store = None diff --git a/addon/globalPlugins/webAccess/store/addons.py b/addon/globalPlugins/webAccess/store/addons.py index 6f7f3eae..a84a85ee 100644 --- a/addon/globalPlugins/webAccess/store/addons.py +++ b/addon/globalPlugins/webAccess/store/addons.py @@ -36,7 +36,7 @@ class AddonsStore(DispatchStore): def __init__(self, *args, **kwargs): - if not "name" in kwargs: + if "name" not in kwargs: kwargs["name"] = "addons" self.addonStoreFactory = kwargs["addonStoreFactory"] super(AddonsStore, self).__init__(*args, **kwargs) diff --git a/addon/globalPlugins/webAccess/store/webModule.py b/addon/globalPlugins/webAccess/store/webModule.py index 34041f82..a35b0858 100644 --- a/addon/globalPlugins/webAccess/store/webModule.py +++ b/addon/globalPlugins/webAccess/store/webModule.py @@ -28,10 +28,8 @@ from collections import OrderedDict import errno -import imp import os import os.path -from pprint import pformat import re import sys @@ -39,8 +37,7 @@ import globalVars from logHandler import log -from ..lib.packaging import version -from ..webModuleHandler import InvalidApiVersion, WebModule, WebModuleDataLayer, getWebModuleFactory +from ..webModuleHandler import WebModule, WebModuleDataLayer, getWebModuleFactory from . import DispatchStore from . import DuplicateRefError from . import MalformedRefError diff --git a/addon/globalPlugins/webAccess/webAppLib/__init__.py b/addon/globalPlugins/webAccess/webAppLib/__init__.py index 1b3b34f3..a3393a8f 100644 --- a/addon/globalPlugins/webAccess/webAppLib/__init__.py +++ b/addon/globalPlugins/webAccess/webAppLib/__init__.py @@ -88,7 +88,6 @@ def trace (msg="trace"): speech.speakMessage (msg) def beep (freq=1000, dur=50): - import tones tones.beep (freq, dur) def reportFocus (obj): diff --git a/addon/globalPlugins/webAccess/webAppScheduler.py b/addon/globalPlugins/webAccess/webAppScheduler.py index 8c597769..1490b66a 100644 --- a/addon/globalPlugins/webAccess/webAppScheduler.py +++ b/addon/globalPlugins/webAccess/webAppScheduler.py @@ -30,7 +30,6 @@ import wx import api -import textInfos from .overlay import WebAccessBmdti, WebAccessObject from .webAppLib import * diff --git a/addon/globalPlugins/webAccess/webModuleHandler/__init__.py b/addon/globalPlugins/webAccess/webModuleHandler/__init__.py index 9c935898..fa44252a 100644 --- a/addon/globalPlugins/webAccess/webModuleHandler/__init__.py +++ b/addon/globalPlugins/webAccess/webModuleHandler/__init__.py @@ -215,7 +215,7 @@ def save(webModule, layerName=None, prompt=True, force=False, fromRuleEditor=Fal ) else: store.update(webModule, layerName=layer.name, force=force) - except DuplicateRefError as e: + except DuplicateRefError: if not prompt or force: return False from ..gui import webModuleEditor @@ -303,7 +303,7 @@ def showEditor(context, new=False): force=force ) keepShowing = keepTrying = False - except DuplicateRefError as e: + except DuplicateRefError: if webModuleEditor.promptOverwrite(): force = True else: diff --git a/addon/globalPlugins/webAccess/webModuleHandler/dataRecovery.py b/addon/globalPlugins/webAccess/webModuleHandler/dataRecovery.py index 22f800a5..6b34439d 100644 --- a/addon/globalPlugins/webAccess/webModuleHandler/dataRecovery.py +++ b/addon/globalPlugins/webAccess/webModuleHandler/dataRecovery.py @@ -27,8 +27,6 @@ from collections import OrderedDict import datetime import inspect -import os -from pprint import pformat import addonHandler addonHandler.initTranslation() diff --git a/addon/globalPlugins/webAccess/webModuleHandler/webModule.py b/addon/globalPlugins/webAccess/webModuleHandler/webModule.py index 0ac19ec7..4192990d 100644 --- a/addon/globalPlugins/webAccess/webModuleHandler/webModule.py +++ b/addon/globalPlugins/webAccess/webModuleHandler/webModule.py @@ -29,18 +29,13 @@ from collections import OrderedDict -import datetime -import json -import os import addonHandler addonHandler.initTranslation() import api import baseObject -import braille import config import controlTypes -import globalVars from logHandler import log import scriptHandler import speech From dd30ea28a9a2d539e36fadc4aeacc44dde3a5730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9-Abush=20Clause?= Date: Thu, 25 Jul 2024 21:22:43 +0200 Subject: [PATCH 5/5] fixup: restore missing import statement for 'gui' module in __init__.py --- addon/globalPlugins/webAccess/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addon/globalPlugins/webAccess/__init__.py b/addon/globalPlugins/webAccess/__init__.py index 21dd1e17..a9078b16 100644 --- a/addon/globalPlugins/webAccess/__init__.py +++ b/addon/globalPlugins/webAccess/__init__.py @@ -152,6 +152,7 @@ def __init__(self): # FIXME: # After the above import, it appears that the `gui` name now points to the `.gui` module # rather that NVDA's `gui`… No clue why… + import gui settings_initialize() global scheduler @@ -251,6 +252,7 @@ def script_showWebAccessSettings(self, gesture): # @UnusedVariable # FIXME: # After the above import, it appears that the `gui` name now points to the `.gui` module # rather that NVDA's `gui`… No clue why… + import gui gui.mainFrame._popupSettingsDialog(WebAccessSettingsDialog) @script(