Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

Commit c70b231

Browse files
committed
Versi├│n 1.5
1 parent a863dce commit c70b231

File tree

7 files changed

+74
-7
lines changed

7 files changed

+74
-7
lines changed

addon/globalPlugins/addonPackager/__init__.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,16 @@
1515
import sys
1616
from . import ajustes
1717
from . import main
18+
from .kill import kill_process_by_name
1819

1920
addonHandler.initTranslation()
2021

22+
def disableInSecureMode(decoratedCls):
23+
if globalVars.appArgs.secure:
24+
return globalPluginHandler.GlobalPlugin
25+
return decoratedCls
26+
27+
@disableInSecureMode
2128
class GlobalPlugin(globalPluginHandler.GlobalPlugin):
2229
def __init__(self):
2330
super(GlobalPlugin, self).__init__()
@@ -81,8 +88,9 @@ def script_menuApp(self, event, menu=False):
8188
def menuApp(self, event):
8289
wx.CallAfter(self.script_menuApp, None, True)
8390

84-
if globalVars.appArgs.secure:
85-
GlobalPlugin = globalPluginHandler.GlobalPlugin # noqa: F811
91+
@script(gesture=None, description= _("Cerrar NVDA cuando se queda bloqueado"), category= _("Utilidades para los complementos de NVDA"))
92+
def script_kill(self, event):
93+
HiloComplemento(None, 2).start()
8694

8795
class HiloComplemento(Thread):
8896
def __init__(self, frame, opcion):
@@ -98,6 +106,11 @@ def appLauncherMain():
98106
gui.mainFrame.prePopup()
99107
self._main.Show()
100108

109+
def killNVDA():
110+
kill_process_by_name("nvda.exe")
111+
101112
if self.opcion == 1:
102113
wx.CallAfter(appLauncherMain)
114+
elif self.opcion == 2:
115+
wx.CallAfter(killNVDA)
103116

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import ctypes
2+
3+
# Definición manual de tipos de datos necesarios
4+
DWORD = ctypes.c_ulong
5+
LONG = ctypes.c_long
6+
ULONG_PTR = ctypes.POINTER(DWORD)
7+
MAX_PATH = 260
8+
9+
class PROCESSENTRY32(ctypes.Structure):
10+
_fields_ = [
11+
("dwSize", DWORD),
12+
("cntUsage", DWORD),
13+
("th32ProcessID", DWORD),
14+
("th32DefaultHeapID", ULONG_PTR),
15+
("th32ModuleID", DWORD),
16+
("cntThreads", DWORD),
17+
("th32ParentProcessID", DWORD),
18+
("pcPriClassBase", LONG),
19+
("dwFlags", DWORD),
20+
("szExeFile", ctypes.c_char * MAX_PATH)
21+
]
22+
23+
def kill_process_by_name(process_name):
24+
"""
25+
Terminates a process by its name using ctypes and kernel32.
26+
"""
27+
28+
PROCESS_TERMINATE = 1
29+
handle = ctypes.windll.kernel32.CreateToolhelp32Snapshot(ctypes.c_uint32(0x2), ctypes.c_uint32(0))
30+
entry = PROCESSENTRY32()
31+
entry.dwSize = ctypes.sizeof(entry)
32+
33+
while ctypes.windll.kernel32.Process32Next(handle, ctypes.byref(entry)):
34+
if process_name.lower() == entry.szExeFile.decode('utf-8').lower():
35+
handle_process = ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, False, entry.th32ProcessID)
36+
ctypes.windll.kernel32.TerminateProcess(handle_process, 0)
37+
ctypes.windll.kernel32.CloseHandle(handle_process)

buildVars.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ def _(arg):
3232
* Modificador de manifiestos, instalados y desde archivo no instalado.
3333
* Hacer / restaurar copias de seguridad de la configuración de NVDA.
3434
* Documentación de complementos.
35+
* Cerrar NVDA cuando se queda bloqueado.
3536
3637
Todas las áreas de fácil manejo y para ahorrar tiempo respecto al gestor de complementos nativo de NVDA."""),
3738
# version
38-
"addon_version": "1.4",
39+
"addon_version": "1.5",
3940
# Author(s)
4041
"addon_author": u"Héctor J. Benítez Corredera <[email protected]>",
4142
# URL for the add-on documentation support

changelog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* Compatibilidad API 2023
1+
* Cerrar NVDA cuando se queda bloqueado.

readme.md

+16
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,22 @@ El documento principal no se modificará siendo una orientación para el usuario
226226

227227
El usuario es el responsable de revisar esta sección para estar informados de los cambios.
228228

229+
## Versión 1.5.
230+
231+
* Cerrar NVDA cuando se queda bloqueado.
232+
233+
Esta nueva opción viene sin interface ni atajo asignado.
234+
235+
Para ello tendremos que ir a Gestos de entrada / Utilidades para los complementos de NVDA / Cerrar NVDA cuando se queda bloqueado y asignarle una combinación de teclas.
236+
237+
Al pulsar esas teclas el NVDA se cerrará.
238+
239+
Esto es útil para cuando se queda bloqueado NVDA.
240+
241+
Existe un complemento llamado Kill NVDA que cierra NVDA.
242+
243+
La diferencia del complemento Kill NVDA y esta función incorporada en Utilidades para los complementos de NVDA es que el primero usa herramientas del sistema y yo uso directamente llamadas al núcleo de Windows por lo que es más robusto y más fiable.
244+
229245
## Versión 1.4.
230246

231247
* Compatibilidad API 2023.

run.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ echo Creando complemento...
44
scons --clean
55
scons
66
scons pot
7-
addonPackager-1.4.nvda-addon
7+
addonPackager-1.5.nvda-addon

run_git.bat

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
scons --clean
44
git init
55
git add --all
6-
git commit -m "Versión 1.4"
6+
git commit -m "Versión 1.5"
77
git push -u origin master
8-
git tag 1.4
8+
git tag 1.5
99
git push --tags
1010
pause

0 commit comments

Comments
 (0)