Skip to content

Commit

Permalink
nvda addon
Browse files Browse the repository at this point in the history
  • Loading branch information
azurejoga committed Oct 14, 2024
1 parent 6f3baa7 commit 91fe06b
Show file tree
Hide file tree
Showing 13 changed files with 565 additions and 0 deletions.
8 changes: 8 additions & 0 deletions NVDA addon/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto

# Try to ensure that po files in the repo does not include
# source code line numbers.
# Every person expected to commit po files should change their personal config file as described here:
# https://mail.gnome.org/archives/kupfer-list/2010-June/msg00002.html
*.po filter=cleanpo
11 changes: 11 additions & 0 deletions NVDA addon/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
addon/doc/*.css
addon/doc/en/
*_docHandler.py
*.html
manifest.ini
*.mo
*.pot
*.py[co]
*.nvda-addon
.sconsign.dblite
/[0-9]*.[0-9]*.[0-9]*.json
21 changes: 21 additions & 0 deletions NVDA addon/addon/globalPlugins/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Azurejoga and edu-mx

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file added NVDA addon/addon/globalPlugins/aurora.exe
Binary file not shown.
68 changes: 68 additions & 0 deletions NVDA addon/addon/globalPlugins/aurora.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import globalPluginHandler
import ui
import os
import subprocess
import json
import shutil # Para mover arquivos

class GlobalPlugin(globalPluginHandler.GlobalPlugin):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.create_config() # Chama a função para criar o config.json ao inicializar o complemento
ui.message("Add-on installed successfully! Press NVDA+SHIFT+A to run Aurora and optimize your PC!") # Mensagem de sucesso

def create_config(self):
"""Cria um arquivo de configuração na pasta Documents/aurora e move os arquivos necessários."""
documentsPath = os.path.join(os.path.expanduser("~"), "Documents", "aurora")
os.makedirs(documentsPath, exist_ok=True) # Cria a pasta se não existir

config_path = os.path.join(documentsPath, "config.json") # Atualiza o caminho do config.json

# Cria o arquivo de configuração se não existir
if not os.path.exists(config_path):
with open(config_path, "w") as config_file:
json.dump({"installed": True}, config_file)

# Move os arquivos para a nova pasta
self.move_files(documentsPath)

def move_files(self, destination):
"""Move os arquivos necessários para a pasta de destino."""
addonDir = os.path.dirname(__file__) # Obtém o caminho do complemento
files_to_move = ["Aurora.exe", "commands", "version", "update.exe"]

for file_name in files_to_move:
src = os.path.join(addonDir, file_name) # Caminho original do arquivo
dst = os.path.join(destination, file_name) # Caminho de destino

if os.path.exists(src): # Verifica se o arquivo existe
try:
shutil.move(src, dst) # Move o arquivo
ui.message(f"Moved {file_name} to {destination}.")
except Exception as e:
ui.message(f"Error moving {file_name}: {str(e)}")

def script_runAurora(self, gesture):
# Mensagem de status no NVDA
ui.message("Attempting to run Aurora Windows Optimizer!")

# Caminho do executável na pasta Documents/aurora
documentsPath = os.path.join(os.path.expanduser("~"), "Documents", "aurora")
exePath = os.path.join(documentsPath, "Aurora.exe")

# Verifica se o arquivo existe
if os.path.exists(exePath):
try:
# Comando para executar o Aurora usando PowerShell com o parâmetro WD
command = f"Start-Process -FilePath '{exePath}' -WorkingDirectory '{documentsPath}'"
subprocess.Popen(["powershell", "-Command", command], shell=True)
ui.message("Aurora Windows Optimizer is running!")
except Exception as e:
ui.message(f"Error when executing Aurora: {str(e)}")
else:
ui.message(f"Executable not found: {exePath}")

# Atalho para o NVDA
__gestures = {
"kb:NVDA+SHIFT+A": "runAurora"
}
Binary file added NVDA addon/addon/globalPlugins/commands
Binary file not shown.
Binary file added NVDA addon/addon/globalPlugins/update.exe
Binary file not shown.
1 change: 1 addition & 0 deletions NVDA addon/addon/globalPlugins/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aurora18
97 changes: 97 additions & 0 deletions NVDA addon/buildVars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# -*- coding: UTF-8 -*-

# Build customizations
# Change this file instead of sconstruct or manifest files, whenever possible.


# Since some strings in `addon_info` are translatable,
# we need to include them in the .po files.
# Gettext recognizes only strings given as parameters to the `_` function.
# To avoid initializing translations in this module we simply roll our own "fake" `_` function
# which returns whatever is given to it as an argument.
def _(arg):
return arg


# Add-on information variables
addon_info = {
# add-on Name/identifier, internal for NVDA
"addon_name": "auroraWindows",
# Add-on summary, usually the user visible name of the addon.
# Translators: Summary for this add-on
# to be shown on installation and add-on information found in Add-ons Manager.
"addon_summary": _("Aurora windows optimizer"),
# Add-on description
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"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!"""),
# version
"addon_version": "18.0",
# Author(s)
"addon_author": "azurejoga azurejoga@gmail.com",
# URL for the add-on documentation support
"addon_url": "https://github.com/azurejoga/aurora-windows-optimizer",
# URL for the add-on repository where the source code can be found
"addon_sourceURL": "https://github.com/azurejoga/aurora-windows-optimizer",
# Documentation file name
"addon_docFileName": "readme.html",
# Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)
"addon_minimumNVDAVersion": 2019.3,
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
"addon_lastTestedNVDAVersion": 2024.3,
# Add-on update channel (default is None, denoting stable releases,
# and for development releases, use "dev".)
# Do not change unless you know what you are doing!
"addon_updateChannel": None,
# Add-on license such as GPL 2
"addon_license": "GPL 2",
# URL for the license document the ad-on is licensed under
"addon_licenseURL": "https://github.com/azurejoga/Aurora-Windows-Optimizer/blob/aurora/LICENSE",
}

# Define the python files that are the sources of your add-on.
# You can either list every file (using ""/") as a path separator,
# or use glob expressions.
# For example to include all files with a ".py" extension from the "globalPlugins" dir of your add-on
# the list can be written as follows:
# pythonSources = ["addon/globalPlugins/*.py"]
# For more information on SCons Glob expressions please take a look at:
# https://scons.org/doc/production/HTML/scons-user/apd.html
pythonSources = ["addon/globalPlugins/aurora.py"]

# Files that contain strings for translation. Usually your python sources
i18nSources = pythonSources + ["buildVars.py"]

# Files that will be ignored when building the nvda-addon file
# Paths are relative to the addon directory, not to the root directory of your addon sources.
excludedFiles = []

# Base language for the NVDA add-on
# If your add-on is written in a language other than english, modify this variable.
# For example, set baseLanguage to "es" if your add-on is primarily written in spanish.
baseLanguage = "en"

# Markdown extensions for add-on documentation
# Most add-ons do not require additional Markdown extensions.
# If you need to add support for markup such as tables, fill out the below list.
# Extensions string must be of the form "markdown.extensions.extensionName"
# e.g. "markdown.extensions.tables" to add tables.
markdownExtensions = []

# Custom braille translation tables
# If your add-on includes custom braille tables (most will not), fill out this dictionary.
# Each key is a dictionary named according to braille table file name,
# with keys inside recording the following attributes:
# displayName (name of the table shown to users and translatable),
# contracted (contracted (True) or uncontracted (False) braille code),
# output (shown in output table list),
# input (shown in input table list).
brailleTables = {}

# Custom speech symbol dictionaries
# Symbol dictionary files reside in the locale folder, e.g. `locale\en`, and are named `symbols-<name>.dic`.
# If your add-on includes custom speech symbol dictionaries (most will not), fill out this dictionary.
# Each key is the name of the dictionary,
# with keys inside recording the following attributes:
# displayName (name of the speech dictionary shown to users and translatable),
# mandatory (True when always enabled, False when not.
symbolDictionaries = {}
2 changes: 2 additions & 0 deletions NVDA addon/manifest-translated.ini.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
summary = "{addon_summary}"
description = """{addon_description}"""
10 changes: 10 additions & 0 deletions NVDA addon/manifest.ini.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name = {addon_name}
summary = "{addon_summary}"
description = """{addon_description}"""
author = "{addon_author}"
url = {addon_url}
version = {addon_version}
docFileName = {addon_docFileName}
minimumNVDAVersion = {addon_minimumNVDAVersion}
lastTestedNVDAVersion = {addon_lastTestedNVDAVersion}
updateChannel = {addon_updateChannel}
Loading

0 comments on commit 91fe06b

Please sign in to comment.