From 881fb15665ccb02f42795a1e630e9ac802e7a966 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 16:54:19 +0000 Subject: [PATCH 1/2] Pre-commit auto-update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0) - [github.com/asottile/add-trailing-comma: v3.2.0 → v4.0.0](https://github.com/asottile/add-trailing-comma/compare/v3.2.0...v4.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.12.7 → v0.15.15](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.7...v0.15.15) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 207177d..1a47b0c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: - id: check-hooks-apply - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: # Prevents commits to certain branches - id: no-commit-to-branch @@ -60,7 +60,7 @@ repos: # Avoids using reserved Windows filenames. - id: check-illegal-windows-names - repo: https://github.com/asottile/add-trailing-comma - rev: v3.2.0 + rev: v4.0.0 hooks: # Ruff preserves indent/new-line formatting of function arguments, list items, and similar iterables, # if a trailing comma is added. @@ -69,7 +69,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Matches Ruff version in pyproject. - rev: v0.12.7 + rev: v0.15.15 hooks: - id: ruff name: lint with ruff From d8ccd7397fae34b4267bd6eecfb918a02e740738 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 16:54:28 +0000 Subject: [PATCH 2/2] Pre-commit auto-fix --- .github/scripts/langCodes.py | 96 +++++++++---------- .../workflows/auto-update-translations.yaml | 1 - .github/workflows/manual-release.yaml | 4 +- addon/doc/fr/readme.md | 4 +- addon/doc/tr/readme.md | 4 +- addon/globalPlugins/askOpenRouter/__init__.py | 8 +- addon/globalPlugins/askOpenRouter/dialogs.py | 62 ++++++------ .../globalPlugins/askOpenRouter/functions.py | 85 ++++++++-------- readme.md | 4 +- site_scons/site_tools/NVDATool/__init__.py | 74 +++++++------- 10 files changed, 171 insertions(+), 171 deletions(-) diff --git a/.github/scripts/langCodes.py b/.github/scripts/langCodes.py index 044e5b5..ea2780a 100644 --- a/.github/scripts/langCodes.py +++ b/.github/scripts/langCodes.py @@ -2,59 +2,57 @@ # Mapping between Crowdin language IDs (keys) and standard NVDA directory names (values). # This dictionary acts as the symmetrical counterpart to 'languageMappings.json' implemented by @nvdaes. -# It ensures that translations exported from Crowdin are stored in the correct +# It ensures that translations exported from Crowdin are stored in the correct # local paths (e.g., 'es-ES' from Crowdin goes into the 'es' folder). CROWDIN_TO_NVDA = { - # Arabic variants - "ar-SA": "ar_SA", - - # Spanish variants - "es-ES": "es", - "es-CO": "es_CO", - - # Portuguese variants - "pt-BR": "pt_BR", - "pt-PT": "pt_PT", - - # Chinese variants - "zh-CN": "zh_CN", - "zh-HK": "zh_HK", - "zh-TW": "zh_TW", - - # Other specific mappings from the NVDA ecosystem - "af": "af_ZA", - "de-CH": "de_CH", - "nb": "nb_NO", - "nn-NO": "nn_NO", - "sr-CS": "sr" + # Arabic variants + "ar-SA": "ar_SA", + # Spanish variants + "es-ES": "es", + "es-CO": "es_CO", + # Portuguese variants + "pt-BR": "pt_BR", + "pt-PT": "pt_PT", + # Chinese variants + "zh-CN": "zh_CN", + "zh-HK": "zh_HK", + "zh-TW": "zh_TW", + # Other specific mappings from the NVDA ecosystem + "af": "af_ZA", + "de-CH": "de_CH", + "nb": "nb_NO", + "nn-NO": "nn_NO", + "sr-CS": "sr", } + def get_nvda_code(crowdin_code): - """ - Returns the appropriate local directory name for a given Crowdin language ID. - - Args: - crowdin_code (str): The language identifier from Crowdin (e.g., 'pt-BR', 'fr'). - - Returns: - str: The corresponding NVDA locale folder name (e.g., 'pt_BR', 'fr'). - """ - # 1. Direct check in our verified map (Priority) - if crowdin_code in CROWDIN_TO_NVDA: - return CROWDIN_TO_NVDA[crowdin_code] - - # 2. Automated conversion for regional variants: Crowdin "xx-YY" -> NVDA "xx_YY" - # This handles regional codes not explicitly defined in the map. - if "-" in crowdin_code: - return crowdin_code.replace("-", "_") - - # 3. Default: Return as is. - # This covers base languages that don't use regional folders in NVDA - # (e.g., 'fr', 'tr', 'bg', 'fi', 'fa'). - return crowdin_code + """ + Returns the appropriate local directory name for a given Crowdin language ID. + + Args: + crowdin_code (str): The language identifier from Crowdin (e.g., 'pt-BR', 'fr'). + + Returns: + str: The corresponding NVDA locale folder name (e.g., 'pt_BR', 'fr'). + """ + # 1. Direct check in our verified map (Priority) + if crowdin_code in CROWDIN_TO_NVDA: + return CROWDIN_TO_NVDA[crowdin_code] + + # 2. Automated conversion for regional variants: Crowdin "xx-YY" -> NVDA "xx_YY" + # This handles regional codes not explicitly defined in the map. + if "-" in crowdin_code: + return crowdin_code.replace("-", "_") + + # 3. Default: Return as is. + # This covers base languages that don't use regional folders in NVDA + # (e.g., 'fr', 'tr', 'bg', 'fi', 'fa'). + return crowdin_code + if __name__ == "__main__": - # Ensure a language code was provided as a command-line argument - if len(sys.argv) > 1: - # Standardize input and output the mapped code for PowerShell to capture - print(get_nvda_code(sys.argv[1])) \ No newline at end of file + # Ensure a language code was provided as a command-line argument + if len(sys.argv) > 1: + # Standardize input and output the mapped code for PowerShell to capture + print(get_nvda_code(sys.argv[1])) diff --git a/.github/workflows/auto-update-translations.yaml b/.github/workflows/auto-update-translations.yaml index 61d57c6..c4fd48c 100644 --- a/.github/workflows/auto-update-translations.yaml +++ b/.github/workflows/auto-update-translations.yaml @@ -11,4 +11,3 @@ on: jobs: auto_update_translations: uses: abdel792/autoUpdateTranslations/.github/workflows/l10n-updates.yaml@8ac89c644395cf2aad6e03a4bb2be5c36526d12a - \ No newline at end of file diff --git a/.github/workflows/manual-release.yaml b/.github/workflows/manual-release.yaml index 2a896f6..1482278 100644 --- a/.github/workflows/manual-release.yaml +++ b/.github/workflows/manual-release.yaml @@ -150,8 +150,8 @@ jobs: with open("changelog.md", "w", encoding="utf-8") as f: f.write(text) - - shell: python + + shell: python - name: Check if there are any changes diff --git a/addon/doc/fr/readme.md b/addon/doc/fr/readme.md index b3673bd..f1a412b 100644 --- a/addon/doc/fr/readme.md +++ b/addon/doc/fr/readme.md @@ -46,7 +46,7 @@ Dans le panneau des paramètres de NVDA, juste après le champ "OpenRouter API K "Afficher la clé API" -Si elle est cochée, les caractères de la clé API deviennent visibles. +Si elle est cochée, les caractères de la clé API deviennent visibles. Par défaut, ils sont masqués pour des raisons de sécurité. ## Paramètres de sélection du modèle @@ -138,7 +138,7 @@ Si vous préférez n'afficher que la dernière réponse au lieu de l'historique ## Scripts non assignés -Les scripts suivants n'ont pas de raccourcis assignés. +Les scripts suivants n'ont pas de raccourcis assignés. Vous pouvez les définir dans : Préférences → Gestes de commandes → Ask OpenRouter diff --git a/addon/doc/tr/readme.md b/addon/doc/tr/readme.md index aaa4c47..39d89a9 100644 --- a/addon/doc/tr/readme.md +++ b/addon/doc/tr/readme.md @@ -46,7 +46,7 @@ NVDA ayarları panelinde, "OpenRouter API Key" alanının hemen ardından şu et "Show API key" -İşaretlenirse API anahtarının karakterleri görünür hale gelir. +İşaretlenirse API anahtarının karakterleri görünür hale gelir. Varsayılan olarak güvenlik nedeniyle gizlenirler. ## Model Seçim Ayarları @@ -138,7 +138,7 @@ Konuşma geçmişinin tamamı yerine yalnızca en son yanıtı görüntülemeyi ## Atanmamış Komut Dosyaları -Aşağıdaki komutlara hareket atanmamıştır. +Aşağıdaki komutlara hareket atanmamıştır. Bunları şu yoldan tanımlayabilirsiniz: Tercihler → Girdi Hareketleri → Ask OpenRouter diff --git a/addon/globalPlugins/askOpenRouter/__init__.py b/addon/globalPlugins/askOpenRouter/__init__.py index b5d147a..42f04c3 100644 --- a/addon/globalPlugins/askOpenRouter/__init__.py +++ b/addon/globalPlugins/askOpenRouter/__init__.py @@ -33,17 +33,17 @@ def __init__(self, *args, **kwargs): "apiKey": "string(default='')", "fullHistory": "boolean(default=True)", "useAllModels": "boolean(default=False)", - "selectedModel": "string(default='')" + "selectedModel": "string(default='')", } gui.settingsDialogs.NVDASettingsDialog.categoryClasses.append( - OpenRouterSettingsPanel + OpenRouterSettingsPanel, ) def terminate(self): if OpenRouterSettingsPanel in gui.settingsDialogs.NVDASettingsDialog.categoryClasses: gui.settingsDialogs.NVDASettingsDialog.categoryClasses.remove( - OpenRouterSettingsPanel + OpenRouterSettingsPanel, ) def onChatDialog(self, evt): @@ -83,5 +83,5 @@ def script_continueChat(self, gesture): def script_showOpenRouterSettingsPanel(self, gesture): gui.mainFrame.popupSettingsDialog( NVDASettingsDialog, - OpenRouterSettingsPanel + OpenRouterSettingsPanel, ) diff --git a/addon/globalPlugins/askOpenRouter/dialogs.py b/addon/globalPlugins/askOpenRouter/dialogs.py index 621ad41..99582c0 100644 --- a/addon/globalPlugins/askOpenRouter/dialogs.py +++ b/addon/globalPlugins/askOpenRouter/dialogs.py @@ -51,34 +51,33 @@ def __init__(self, parent: wx.Window) -> None: super().__init__( parent, # Translators: Title of the dialog box. - title=_("Chat Manager") + title=_("Chat Manager"), ) mainSizer: wx.BoxSizer = wx.BoxSizer(wx.VERTICAL) sHelper: gui.guiHelper.BoxSizerHelper = gui.guiHelper.BoxSizerHelper( self, - wx.VERTICAL + wx.VERTICAL, ) - buttonGroup: gui.guiHelper.ButtonHelper = \ - gui.guiHelper.ButtonHelper(wx.HORIZONTAL) + buttonGroup: gui.guiHelper.ButtonHelper = gui.guiHelper.ButtonHelper(wx.HORIZONTAL) self.newButton: wx.Button = buttonGroup.addButton( self, # Translators: Prompt label to create a new chat. - label=_("C&reate a New Chat") + label=_("C&reate a New Chat"), ) self.continueButton: wx.Button = buttonGroup.addButton( self, # Translators: Prompt label to continue an existing chat. - label=_("Co&ntinue a Chat") + label=_("Co&ntinue a Chat"), ) self.closeButton: wx.Button = buttonGroup.addButton( self, # Translators: Label of the closing button. - label=_("&Close") + label=_("&Close"), ) self.newButton.SetDefault() @@ -93,7 +92,7 @@ def __init__(self, parent: wx.Window) -> None: mainSizer.Add( sHelper.sizer, border=gui.guiHelper.BORDER_FOR_DIALOGS, - flag=wx.ALL | wx.EXPAND + flag=wx.ALL | wx.EXPAND, ) self.SetSizerAndFit(mainSizer) @@ -116,7 +115,7 @@ def onNew(self, evt: wx.CommandEvent) -> None: inputBox( # Translators: Title of the dialog box to start a new chat. _("New Chat"), - askOpenRouter + askOpenRouter, ) def onContinue(self, evt: wx.CommandEvent) -> None: @@ -127,11 +126,10 @@ def onContinue(self, evt: wx.CommandEvent) -> None: # Translators: Title of the dialog box to continue an existing chat. _("Continue Chat"), askOpenRouter, - new=False + new=False, ) - # Settings Panel class OpenRouterSettingsPanel(SettingsPanel): """ @@ -154,8 +152,7 @@ def makeSettings(self, settingsSizer: wx.Sizer) -> None: Args: settingsSizer (wx.Sizer): Parent sizer provided by NVDA. """ - self.sHelper: gui.guiHelper.BoxSizerHelper = \ - gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer) + self.sHelper: gui.guiHelper.BoxSizerHelper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer) # ========================= # API KEY @@ -164,18 +161,18 @@ def makeSettings(self, settingsSizer: wx.Sizer) -> None: self.apiKeyLabel: wx.StaticText = wx.StaticText( self, # Translators: Label of the field that must contain the OpenRouter API key. - label=_("OpenRouter API Key:") + label=_("OpenRouter API Key:"), ) self.sHelper.addItem(self.apiKeyLabel) self.apiKeyHidden: wx.TextCtrl = wx.TextCtrl( self, - style=wx.TE_PASSWORD + style=wx.TE_PASSWORD, ) self.sHelper.addItem(self.apiKeyHidden, flag=wx.EXPAND) self.apiKeyHidden.SetValue( - config.conf["askOpenRouter"]["apiKey"] + config.conf["askOpenRouter"]["apiKey"], ) self.apiKeyVisible: wx.TextCtrl = wx.TextCtrl(self) @@ -185,13 +182,13 @@ def makeSettings(self, settingsSizer: wx.Sizer) -> None: self.showApiKeyCheckBox: wx.CheckBox = wx.CheckBox( self, # Translators: Label of the checkbox to display the OpenRouter API key. - label=_("Show API key") + label=_("Show API key"), ) self.sHelper.addItem(self.showApiKeyCheckBox) self.showApiKeyCheckBox.Bind( wx.EVT_CHECKBOX, - self.onToggleApiVisibility + self.onToggleApiVisibility, ) # ========================= @@ -201,12 +198,12 @@ def makeSettings(self, settingsSizer: wx.Sizer) -> None: self.fullHistoryCheckBox: wx.CheckBox = wx.CheckBox( self, # Translators: Label of the checkbox to display chat history. - label=_("Display the full chat history for continuous discussions") + label=_("Display the full chat history for continuous discussions"), ) self.sHelper.addItem(self.fullHistoryCheckBox) self.fullHistoryCheckBox.SetValue( - config.conf["askOpenRouter"]["fullHistory"] + config.conf["askOpenRouter"]["fullHistory"], ) # ========================= @@ -215,19 +212,19 @@ def makeSettings(self, settingsSizer: wx.Sizer) -> None: self.useAllModelsCheckBox: wx.CheckBox = wx.CheckBox( self, - # Translators: + # Translators: # Translators: Label of the checkbox to show the list of models, including paid ones. - label=_("Use all models, including paid ones.") + label=_("Use all models, including paid ones."), ) self.sHelper.addItem(self.useAllModelsCheckBox) self.useAllModelsCheckBox.SetValue( - config.conf["askOpenRouter"].get("useAllModels", False) + config.conf["askOpenRouter"].get("useAllModels", False), ) self.useAllModelsCheckBox.Bind( wx.EVT_CHECKBOX, - self.onToggleModelsList + self.onToggleModelsList, ) # ========================= @@ -289,8 +286,7 @@ def _loadModelsIfNeeded(self) -> None: return try: - models: List[Dict[str, object]] = \ - getAvailableModels(apiKey) + models: List[Dict[str, object]] = getAvailableModels(apiKey) except Exception: return @@ -309,7 +305,7 @@ def _loadModelsIfNeeded(self) -> None: savedModel: str = config.conf["askOpenRouter"].get( "selectedModel", - "" + "", ) for index, m in enumerate(models): @@ -332,17 +328,13 @@ def onSave(self) -> None: """ Save settings into NVDA configuration. """ - config.conf["askOpenRouter"]["apiKey"] = \ - self.getApiKeyValue().strip() + config.conf["askOpenRouter"]["apiKey"] = self.getApiKeyValue().strip() - config.conf["askOpenRouter"]["fullHistory"] = \ - self.fullHistoryCheckBox.GetValue() + config.conf["askOpenRouter"]["fullHistory"] = self.fullHistoryCheckBox.GetValue() - config.conf["askOpenRouter"]["useAllModels"] = \ - self.useAllModelsCheckBox.GetValue() + config.conf["askOpenRouter"]["useAllModels"] = self.useAllModelsCheckBox.GetValue() index: int = self.modelsList.GetSelection() if index != wx.NOT_FOUND and self.modelsData: - config.conf["askOpenRouter"]["selectedModel"] = \ - self.modelsData[index]["id"] \ No newline at end of file + config.conf["askOpenRouter"]["selectedModel"] = self.modelsData[index]["id"] diff --git a/addon/globalPlugins/askOpenRouter/functions.py b/addon/globalPlugins/askOpenRouter/functions.py index ef05d81..144f355 100644 --- a/addon/globalPlugins/askOpenRouter/functions.py +++ b/addon/globalPlugins/askOpenRouter/functions.py @@ -21,6 +21,7 @@ import urllib.error import time from typing import List, Dict, Callable, Optional, Any + addonHandler.initTranslation() @@ -30,9 +31,9 @@ _unavailableModels: Dict[str, float] = {} # Cooldowns (seconds) -_RATE_LIMIT_COOLDOWN: int = 300 # 429 -_POLICY_COOLDOWN: int = 180 # 404 -_PAYMENT_COOLDOWN: int = 1800 # 402 +_RATE_LIMIT_COOLDOWN: int = 300 # 429 +_POLICY_COOLDOWN: int = 180 # 404 +_PAYMENT_COOLDOWN: int = 1800 # 402 def disableInSecureMode(decoratedCls): @@ -115,10 +116,7 @@ def _cleanupUnavailableModels() -> None: """ currentTime: float = time.time() - expired = [ - model for model, expiry in _unavailableModels.items() - if currentTime > expiry - ] + expired = [model for model, expiry in _unavailableModels.items() if currentTime > expiry] for model in expired: del _unavailableModels[model] @@ -255,13 +253,15 @@ def getAvailableModels(apiKey: str) -> List[Dict[str, object]]: if not m.get("top_provider") or not m.get("context_length"): continue - availableModels.append({ - "id": m.get("id"), - "promptPricing": float(m.get("pricing", {}).get("prompt", 0)), - "completionPricing": float(m.get("pricing", {}).get("completion", 0)), - "contextLength": m.get("context_length"), - "deprecated": m.get("deprecated", False), - }) + availableModels.append( + { + "id": m.get("id"), + "promptPricing": float(m.get("pricing", {}).get("prompt", 0)), + "completionPricing": float(m.get("pricing", {}).get("completion", 0)), + "contextLength": m.get("context_length"), + "deprecated": m.get("deprecated", False), + } + ) return availableModels @@ -329,9 +329,9 @@ def getHistory(filename: str) -> str: historyLines: List[str] = [] allChat: List[Dict[str, str]] = [] # Translators: Message announcing what the user said. - userQuestion: str = _('You said:') + userQuestion: str = _("You said:") # Translators: Message announcing what the model responded. - modelResponse: str = _('Model replied:') + modelResponse: str = _("Model replied:") if os.path.exists(filename): with open(filename, "rb") as f: @@ -405,7 +405,7 @@ def askOpenRouter(prompt: str, apiKey: str, new: bool = True) -> None: # Translators: Message informing that no free models are available. _("No free model available at the moment."), # Translators: Title of the error message. - title=_("Model Error") + title=_("Model Error"), ) return @@ -423,27 +423,29 @@ def askOpenRouter(prompt: str, apiKey: str, new: bool = True) -> None: # Translators: Message informing that no free models are available. _("No free model available at the moment."), # Translators: Title of the error message. - title=_("Model Error") + title=_("Model Error"), ) return history: List[Dict[str, str]] = loadHistory(historyFile) - history.append({ - "role": "user", - "content": prompt - }) + history.append( + { + "role": "user", + "content": prompt, + } + ) headers: Dict[str, str] = { "Authorization": f"Bearer {apiKey}", "Content-Type": "application/json", "HTTP-Referer": "http://localhost", - "X-Title": "My question" + "X-Title": "My question", } data: Dict[str, Any] = { "model": model, - "messages": history + "messages": history, } maxAttempts: int = 5 @@ -456,13 +458,12 @@ def askOpenRouter(prompt: str, apiKey: str, new: bool = True) -> None: break except urllib.error.HTTPError as e: - # If the user uses their own paid model, do not fallback if useAll: ui.browseableMessage( f"HTTP Error: {e.code}, {e.read().decode('utf-8')}", # Translators: Title of the HTTP error message. - title=_("HTTP Error") + title=_("HTTP Error"), ) return @@ -483,7 +484,7 @@ def askOpenRouter(prompt: str, apiKey: str, new: bool = True) -> None: ui.browseableMessage( f"HTTP Error: {e.code}, {e.read().decode('utf-8')}", # Translators: Title of the HTTP error message. - title=_("HTTP Error") + title=_("HTTP Error"), ) return @@ -491,7 +492,7 @@ def askOpenRouter(prompt: str, apiKey: str, new: bool = True) -> None: ui.browseableMessage( # Translators: Network error message. message=f"{_('Network error:')} {e.reason}", - title="Network Error" + title="Network Error", ) return @@ -500,14 +501,16 @@ def askOpenRouter(prompt: str, apiKey: str, new: bool = True) -> None: # Translators: Message informing that no free models are available at the moment. _("All free models are currently unavailable. Please try again later."), # Translators: Title of the model unavailable error. - title=_("Model Unavailable") + title=_("Model Unavailable"), ) return - history.append({ - "role": "assistant", - "content": answer - }) + history.append( + { + "role": "assistant", + "content": answer, + } + ) saveHistory(history, historyFile) @@ -523,14 +526,14 @@ def askOpenRouter(prompt: str, apiKey: str, new: bool = True) -> None: # Translators: Title of the model response message. title=_("Model Response"), isHtml=True, - copyButton=True + copyButton=True, ) def inputBox( - title: str, - func: Callable[[str, str, bool], None], - new: bool = True + title: str, + func: Callable[[str, str, bool], None], + new: bool = True, ) -> None: """ Display a multiline input dialog and send the result to the given function. @@ -555,7 +558,7 @@ def inputBox( # Translators: Message inviting the user to enter his question. _("Please enter the question you want to ask OpenRouter"), title, - style=wx.TE_MULTILINE | wx.OK | wx.CANCEL + style=wx.TE_MULTILINE | wx.OK | wx.CANCEL, ) def callback(result: int) -> None: @@ -565,7 +568,7 @@ def callback(result: int) -> None: # Translators: Message informing the user that the field is empty, he must fill it in. message=_("You did not enter anything. Please try again."), # Translators: Title of the error message. - caption=_("Input Error") + caption=_("Input Error"), ) return @@ -576,14 +579,14 @@ def callback(result: int) -> None: # Translators: Message informing the user that no API key is configured. message=_("No API key is configured. Please configure it in settings."), # Translators: Title of the error message. - caption=_("Configuration Error") + caption=_("Configuration Error"), ) return func( dialog.Value, apiKey, - new + new, ) gui.runScriptModalDialog(dialog, callback) diff --git a/readme.md b/readme.md index e3d2f2c..d6877c8 100644 --- a/readme.md +++ b/readme.md @@ -45,7 +45,7 @@ In the NVDA settings panel, just after the "OpenRouter API Key" field, there is "Show API key" -If checked, the characters of the API key become visible. +If checked, the characters of the API key become visible. By default, they are hidden for security reasons. ## Model Selection Settings @@ -136,7 +136,7 @@ If you prefer to only display the latest response instead of the full conversati ## Unassigned Scripts -The following scripts do not have gestures assigned. +The following scripts do not have gestures assigned. You can define them in: Preferences → Input Gestures → Ask OpenRouter diff --git a/site_scons/site_tools/NVDATool/__init__.py b/site_scons/site_tools/NVDATool/__init__.py index a71857d..7de9357 100644 --- a/site_scons/site_tools/NVDATool/__init__.py +++ b/site_scons/site_tools/NVDATool/__init__.py @@ -34,12 +34,14 @@ def generate(env: Environment): env.SetDefault(excludePatterns=tuple()) addonAction = env.Action( - lambda target, source, env: createAddonBundleFromPath( - source[0].abspath, - target[0].abspath, - env["excludePatterns"], - ) - and None, + lambda target, source, env: ( + createAddonBundleFromPath( + source[0].abspath, + target[0].abspath, + env["excludePatterns"], + ) + and None + ), lambda target, source, env: f"Generating Addon {target[0]}", ) env["BUILDERS"]["NVDAAddon"] = Builder( @@ -53,15 +55,17 @@ def generate(env: Environment): env.SetDefault(speechDictionaries={}) manifestAction = env.Action( - lambda target, source, env: generateManifest( - source[0].abspath, - target[0].abspath, - addon_info=env["addon_info"], - brailleTables=env["brailleTables"], - symbolDictionaries=env["symbolDictionaries"], - speechDictionaries=env["speechDictionaries"], - ) - and None, + lambda target, source, env: ( + generateManifest( + source[0].abspath, + target[0].abspath, + addon_info=env["addon_info"], + brailleTables=env["brailleTables"], + symbolDictionaries=env["symbolDictionaries"], + speechDictionaries=env["speechDictionaries"], + ) + and None + ), lambda target, source, env: f"Generating manifest {target[0]}", ) env["BUILDERS"]["NVDAManifest"] = Builder( @@ -71,16 +75,18 @@ def generate(env: Environment): ) translatedManifestAction = env.Action( - lambda target, source, env: generateTranslatedManifest( - source[1].abspath, - target[0].abspath, - mo=source[0].abspath, - addon_info=env["addon_info"], - brailleTables=env["brailleTables"], - symbolDictionaries=env["symbolDictionaries"], - speechDictionaries=env["speechDictionaries"], - ) - and None, + lambda target, source, env: ( + generateTranslatedManifest( + source[1].abspath, + target[0].abspath, + mo=source[0].abspath, + addon_info=env["addon_info"], + brailleTables=env["brailleTables"], + symbolDictionaries=env["symbolDictionaries"], + speechDictionaries=env["speechDictionaries"], + ) + and None + ), lambda target, source, env: f"Generating translated manifest {target[0]}", ) @@ -93,14 +99,16 @@ def generate(env: Environment): env.SetDefault(mdExtensions={}) mdAction = env.Action( - lambda target, source, env: md2html( - source[0].path, - target[0].path, - moFile=env["moFile"].path if env["moFile"] else None, - mdExtensions=env["mdExtensions"], - addon_info=env["addon_info"], - ) - and None, + lambda target, source, env: ( + md2html( + source[0].path, + target[0].path, + moFile=env["moFile"].path if env["moFile"] else None, + mdExtensions=env["mdExtensions"], + addon_info=env["addon_info"], + ) + and None + ), lambda target, source, env: f"Generating {target[0]}", ) env["BUILDERS"]["md2html"] = env.Builder(