Skip to content

Commit 91fe06b

Browse files
committed
nvda addon
1 parent 6f3baa7 commit 91fe06b

File tree

13 files changed

+565
-0
lines changed

13 files changed

+565
-0
lines changed

NVDA addon/.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Set default behaviour, in case users don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Try to ensure that po files in the repo does not include
5+
# source code line numbers.
6+
# Every person expected to commit po files should change their personal config file as described here:
7+
# https://mail.gnome.org/archives/kupfer-list/2010-June/msg00002.html
8+
*.po filter=cleanpo

NVDA addon/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
addon/doc/*.css
2+
addon/doc/en/
3+
*_docHandler.py
4+
*.html
5+
manifest.ini
6+
*.mo
7+
*.pot
8+
*.py[co]
9+
*.nvda-addon
10+
.sconsign.dblite
11+
/[0-9]*.[0-9]*.[0-9]*.json
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Azurejoga and edu-mx
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
13.4 MB
Binary file not shown.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import globalPluginHandler
2+
import ui
3+
import os
4+
import subprocess
5+
import json
6+
import shutil # Para mover arquivos
7+
8+
class GlobalPlugin(globalPluginHandler.GlobalPlugin):
9+
def __init__(self, *args, **kwargs):
10+
super().__init__(*args, **kwargs)
11+
self.create_config() # Chama a função para criar o config.json ao inicializar o complemento
12+
ui.message("Add-on installed successfully! Press NVDA+SHIFT+A to run Aurora and optimize your PC!") # Mensagem de sucesso
13+
14+
def create_config(self):
15+
"""Cria um arquivo de configuração na pasta Documents/aurora e move os arquivos necessários."""
16+
documentsPath = os.path.join(os.path.expanduser("~"), "Documents", "aurora")
17+
os.makedirs(documentsPath, exist_ok=True) # Cria a pasta se não existir
18+
19+
config_path = os.path.join(documentsPath, "config.json") # Atualiza o caminho do config.json
20+
21+
# Cria o arquivo de configuração se não existir
22+
if not os.path.exists(config_path):
23+
with open(config_path, "w") as config_file:
24+
json.dump({"installed": True}, config_file)
25+
26+
# Move os arquivos para a nova pasta
27+
self.move_files(documentsPath)
28+
29+
def move_files(self, destination):
30+
"""Move os arquivos necessários para a pasta de destino."""
31+
addonDir = os.path.dirname(__file__) # Obtém o caminho do complemento
32+
files_to_move = ["Aurora.exe", "commands", "version", "update.exe"]
33+
34+
for file_name in files_to_move:
35+
src = os.path.join(addonDir, file_name) # Caminho original do arquivo
36+
dst = os.path.join(destination, file_name) # Caminho de destino
37+
38+
if os.path.exists(src): # Verifica se o arquivo existe
39+
try:
40+
shutil.move(src, dst) # Move o arquivo
41+
ui.message(f"Moved {file_name} to {destination}.")
42+
except Exception as e:
43+
ui.message(f"Error moving {file_name}: {str(e)}")
44+
45+
def script_runAurora(self, gesture):
46+
# Mensagem de status no NVDA
47+
ui.message("Attempting to run Aurora Windows Optimizer!")
48+
49+
# Caminho do executável na pasta Documents/aurora
50+
documentsPath = os.path.join(os.path.expanduser("~"), "Documents", "aurora")
51+
exePath = os.path.join(documentsPath, "Aurora.exe")
52+
53+
# Verifica se o arquivo existe
54+
if os.path.exists(exePath):
55+
try:
56+
# Comando para executar o Aurora usando PowerShell com o parâmetro WD
57+
command = f"Start-Process -FilePath '{exePath}' -WorkingDirectory '{documentsPath}'"
58+
subprocess.Popen(["powershell", "-Command", command], shell=True)
59+
ui.message("Aurora Windows Optimizer is running!")
60+
except Exception as e:
61+
ui.message(f"Error when executing Aurora: {str(e)}")
62+
else:
63+
ui.message(f"Executable not found: {exePath}")
64+
65+
# Atalho para o NVDA
66+
__gestures = {
67+
"kb:NVDA+SHIFT+A": "runAurora"
68+
}
16.3 KB
Binary file not shown.
14.5 MB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aurora18

NVDA addon/buildVars.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# -*- coding: UTF-8 -*-
2+
3+
# Build customizations
4+
# Change this file instead of sconstruct or manifest files, whenever possible.
5+
6+
7+
# Since some strings in `addon_info` are translatable,
8+
# we need to include them in the .po files.
9+
# Gettext recognizes only strings given as parameters to the `_` function.
10+
# To avoid initializing translations in this module we simply roll our own "fake" `_` function
11+
# which returns whatever is given to it as an argument.
12+
def _(arg):
13+
return arg
14+
15+
16+
# Add-on information variables
17+
addon_info = {
18+
# add-on Name/identifier, internal for NVDA
19+
"addon_name": "auroraWindows",
20+
# Add-on summary, usually the user visible name of the addon.
21+
# Translators: Summary for this add-on
22+
# to be shown on installation and add-on information found in Add-ons Manager.
23+
"addon_summary": _("Aurora windows optimizer"),
24+
# Add-on description
25+
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
26+
"addon_description": _("""Aurora windows optimizer is a powerful utility to optimize, improve and enhance your computer, security, privacy and high speed is what it promises!"""),
27+
# version
28+
"addon_version": "18.0",
29+
# Author(s)
30+
"addon_author": "azurejoga azurejoga@gmail.com",
31+
# URL for the add-on documentation support
32+
"addon_url": "https://github.com/azurejoga/aurora-windows-optimizer",
33+
# URL for the add-on repository where the source code can be found
34+
"addon_sourceURL": "https://github.com/azurejoga/aurora-windows-optimizer",
35+
# Documentation file name
36+
"addon_docFileName": "readme.html",
37+
# Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)
38+
"addon_minimumNVDAVersion": 2019.3,
39+
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
40+
"addon_lastTestedNVDAVersion": 2024.3,
41+
# Add-on update channel (default is None, denoting stable releases,
42+
# and for development releases, use "dev".)
43+
# Do not change unless you know what you are doing!
44+
"addon_updateChannel": None,
45+
# Add-on license such as GPL 2
46+
"addon_license": "GPL 2",
47+
# URL for the license document the ad-on is licensed under
48+
"addon_licenseURL": "https://github.com/azurejoga/Aurora-Windows-Optimizer/blob/aurora/LICENSE",
49+
}
50+
51+
# Define the python files that are the sources of your add-on.
52+
# You can either list every file (using ""/") as a path separator,
53+
# or use glob expressions.
54+
# For example to include all files with a ".py" extension from the "globalPlugins" dir of your add-on
55+
# the list can be written as follows:
56+
# pythonSources = ["addon/globalPlugins/*.py"]
57+
# For more information on SCons Glob expressions please take a look at:
58+
# https://scons.org/doc/production/HTML/scons-user/apd.html
59+
pythonSources = ["addon/globalPlugins/aurora.py"]
60+
61+
# Files that contain strings for translation. Usually your python sources
62+
i18nSources = pythonSources + ["buildVars.py"]
63+
64+
# Files that will be ignored when building the nvda-addon file
65+
# Paths are relative to the addon directory, not to the root directory of your addon sources.
66+
excludedFiles = []
67+
68+
# Base language for the NVDA add-on
69+
# If your add-on is written in a language other than english, modify this variable.
70+
# For example, set baseLanguage to "es" if your add-on is primarily written in spanish.
71+
baseLanguage = "en"
72+
73+
# Markdown extensions for add-on documentation
74+
# Most add-ons do not require additional Markdown extensions.
75+
# If you need to add support for markup such as tables, fill out the below list.
76+
# Extensions string must be of the form "markdown.extensions.extensionName"
77+
# e.g. "markdown.extensions.tables" to add tables.
78+
markdownExtensions = []
79+
80+
# Custom braille translation tables
81+
# If your add-on includes custom braille tables (most will not), fill out this dictionary.
82+
# Each key is a dictionary named according to braille table file name,
83+
# with keys inside recording the following attributes:
84+
# displayName (name of the table shown to users and translatable),
85+
# contracted (contracted (True) or uncontracted (False) braille code),
86+
# output (shown in output table list),
87+
# input (shown in input table list).
88+
brailleTables = {}
89+
90+
# Custom speech symbol dictionaries
91+
# Symbol dictionary files reside in the locale folder, e.g. `locale\en`, and are named `symbols-<name>.dic`.
92+
# If your add-on includes custom speech symbol dictionaries (most will not), fill out this dictionary.
93+
# Each key is the name of the dictionary,
94+
# with keys inside recording the following attributes:
95+
# displayName (name of the speech dictionary shown to users and translatable),
96+
# mandatory (True when always enabled, False when not.
97+
symbolDictionaries = {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
summary = "{addon_summary}"
2+
description = """{addon_description}"""

0 commit comments

Comments
 (0)