Skip to content

Commit

Permalink
Merge pull request #19 from sharkboyto/develop
Browse files Browse the repository at this point in the history
2022.1.1
  • Loading branch information
davidedec authored Jan 4, 2022
2 parents 1e415ad + 0bf0ce2 commit 74815e1
Show file tree
Hide file tree
Showing 29 changed files with 472 additions and 209 deletions.
4 changes: 2 additions & 2 deletions addon/doc/ES/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

* Autores: Alessandro Albano, Davide De Carne, Simone Dal Maso
* Descargar [versión estable][1]
* Compatibilidad con NVDA: 2021.2 y posterior
* Compatibilidad con NVDA: 2019.3 y posterior

NAO (NVDA Advanced OCR) es un complemento que mejora las funciones estándar de OCR proporcionadas por NVDA en versiones modernas de Windows.
Mientras que la orden estándar de NVDA usa el OCR de Windows para reconocer la pantalla, NAO es capaz de aplicar el OCR en archivos guardados en tu disco duro o dispositivo USB.
Expand All @@ -13,7 +13,7 @@ NAO también es capaz de manejar documentos PDF de varias páginas, por lo que s

## Requisitos del sistema
El complemento solo funciona en sistemas Windows 10 y Windows 11, ya que tienen capacidades de OCR integradas.
Nao es compatible con la versión 2021.2 de NVDA, por lo tanto, no funcionará en versiones anteriores del lector de pantalla
Nao es compatible con la versión 2019.3 de NVDA, por lo tanto, no funcionará en versiones anteriores del lector de pantalla
Ten en cuenta que NAO funciona con el explorador de Windows, en el escritorio, o con el gestor de archivos Total Commander; no uses otro software como 7-zip o WinRar, ya que no se soportan.

## Funciones y comandos
Expand Down
4 changes: 2 additions & 2 deletions addon/doc/fr/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

* Auteurs : Alessandro Albano, Davide De Carne, Simone Dal Maso
* Télécharger [version stable][1]
* Compatibilité NVDA : 2021.2 et ultérieure
* Compatibilité NVDA : 2019.3 et ultérieure

Nao (NVDA Advanced OCR) est une extension qui améliore les capacités OCR standard fournies par NVDA sur les versions modernes de Windows.
Alors que la commande standard de NVDA utilise l'OCR Windows pour reconnaître l'écran, NAO est capable d'effectuer l'OCR sur les fichiers enregistrés sur votre disque dur ou vos périphériques USB.
Expand All @@ -13,7 +13,7 @@ Nao est capable de gérer également des pdf multipages, donc si vous avez un do

## Configuration requise
L'extension fonctionne sur les systèmes Windows 10 et Windows 11, car ils ont des capacités OCR intégrées.
Nao est compatible à partir de la version 2021.2 de NVDA, donc n'utilisez pas une version plus ancienne du lecteur d'écran.
Nao est compatible à partir de la version 2019.3 de NVDA, donc n'utilisez pas une version plus ancienne du lecteur d'écran.
Veuillez noter que Nao fonctionne avec l'explorateur Windows, sur le bureau ou avec les gestionnaires de fichiers Total Commander ou xplorer² ; n'utilisez pas d'autres logiciels comme 7zip ou Winrar , car ils ne sont pas pris en charge.

## Fonctionnalités et commandes
Expand Down
10 changes: 8 additions & 2 deletions addon/doc/it/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

* Autori: Alessandro Albano, Davide De Carne, Simone Dal Maso
* Download [versione stabile][1]
* Compatibilità NVDA: 2021.2 e successive
* Compatibilità NVDA: 2019.3 e successive

Nao (NVDA Advanced OCR) è un addon che migliora le capacità OCR standard fornite da NVDA nelle versioni moderne di Windows.
Mentre il comando standard NVDA utilizza l'OCR di Windows per riconoscere lo schermo, NAO è in grado di eseguire l'OCR sui file salvati sul disco rigido o sui dispositivi USB.
Expand All @@ -13,7 +13,7 @@ Nao è in grado di gestire anche pdf multipagina, quindi se hai un documento non

## Requisiti di sistema
L'addon lavora soltanto sui sistemi Windows 10 e Windows 11, poiché dispongono di funzionalità OCR integrate.
Nao è compatibile dalla versione NVDA 2021.2, quindi non utilizzare versioni precedenti dello screen reader.
Nao è compatibile dalla versione NVDA 2019.3, quindi non utilizzare versioni precedenti dello screen reader.
Si noti che Nao funziona con Windows Explorer, sul desktop, con il file manager Total Commander o Xplorer; non utilizzare altri software come 7zip o Winrar, poiché non sono supportati.

## Funzionalità e comandi
Expand Down Expand Up @@ -41,6 +41,12 @@ Se pensi che il nostro lavoro sia buono e migliori la tua vita, a <a href="https
Vuoi segnalare un bug, suggerire nuove funzionalità, tradurre l'addon nella tua lingua? Abbiamo l'e-mail per te! Scrivi a [email protected] e saremo felici di aiutarti.

## Cronologia
### 2022.1.1
* Supporto file formato DjVu.
* Supporto file tiff multipagina.
* Risoluzione bug di encoding nel riconoscimento file PDF su sistemi operativi in lingua cinese.
* Update manuale dell'addon da menu strumenti di NVDA.
* Compatibilità a partire da NVDA 2019.3.
### 2022.1
* Update automatico dell'addon.
* Aggiornate traduzioni in spagnolo e francese.
Expand Down
4 changes: 2 additions & 2 deletions addon/doc/ru/readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Nao - NVDA Расширенное распознавание

* Авторы: Алессандро Альбано, Давиде Декарне, Симона Даль Мазо
* Совместимость с NVDA: 2021.2 и более поздние версии
* Совместимость с NVDA: 2019.3 и более поздние версии
* [Страница дополнения на GitHub](https://github.com/sharkboyto/nao/)

### Описание
Expand All @@ -14,7 +14,7 @@ Nao (NVDA Advanced OCR) - это дополнение, которое улучш
Nao также может обрабатывать многостраничный pdf-файл, поэтому, если у вас есть недоступный документ, не волнуйтесь, Windows OCR сможет выполнить всю вашу работу
### Системные требования
Дополнение работает в системах Windows 10 и Windows 11, так как в них встроены функции распознавания текста.
Nao совместим с NVDA версии 2021.2, поэтому не используйте более старые версии программы чтения с экрана.
Nao совместим с NVDA версии 2019.3, поэтому не используйте более старые версии программы чтения с экрана.
Обратите внимание, что Nao работает с проводником Windows, на рабочем столе или с Total Commander
файловый менеджер; не используйте другое программное обеспечение, такое как 7Zip или WinRar, так как они не поддерживаются.
### Функции и команды
Expand Down
4 changes: 2 additions & 2 deletions addon/doc/tr/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

* Yazarlar: Alessandro Albano, Davide De Carne, Simone Dal Maso
* [Kararlı sürümü][1] indir
* NVDA uyumluluğu: 2021.2 ve üstü
* NVDA uyumluluğu: 2019.3 ve üstü

Nao (NVDA Advanced OCR), Windows'un modern sürümlerinde NVDA tarafından sağlanan standart OCR özelliklerini geliştiren bir eklentidir.
NVDA standart komutu, ekranı tanımak için Windows OCR'yi kullanırken, NAO, sabit sürücünüzde veya USB aygıtlarınızda kayıtlı dosyalar üzerinde OCR yapabilir.
Expand All @@ -13,7 +13,7 @@ Nao aynı zamanda çok sayfalı pdf'yi de işleyebilir, bu nedenle erişilebilir

## sistem gereksinimleri
Eklenti, yerleşik OCR özelliklerine sahip oldukları için Windows 10 ve Windows 11 sistemlerinde çalışır.
Nao, NVDA 2021.2 sürümünden itibaren sonrakilerle uyumludur, bu nedenle ekran okuyucunun eski sürümlerini kullanmayın.
Nao, NVDA 2019.3 sürümünden itibaren sonrakilerle uyumludur, bu nedenle ekran okuyucunun eski sürümlerini kullanmayın.
Nao'nun Windows Gezgini, masaüstü veya Total Commander dosya yöneticisi ile çalıştığını unutmayın; 7zip veya Winrar gibi başka yazılımlar desteklenmediği için kullanmayın.

## Özellikler ve komutlar
Expand Down
4 changes: 2 additions & 2 deletions addon/doc/zh_CN/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

* 作者:Alessandro Albano、Davide De Carne、Simone Dal Maso
* 下载[稳定版][1]
* NVDA 兼容性:2021.2 及以后
* NVDA 兼容性:2019.3 及以后

Nao(NVDA Advanced OCR) 是一个 NVDA 插件,该插件改进了 Windows 的内置 OCR 功能。
虽然 NVDA 本身可以使用 Windows OCR 来识别屏幕,但 NAO 能够对保存在硬盘驱动器或 USB 设备上的文件进行 OCR。
Expand All @@ -14,7 +14,7 @@ Nao 也能够处理多页 PDF,所以,如果您有一个无法访问的扫描
## 系统要求

该插件适用于内置了 OCR 功能的 Windows 10 和 Windows 11 系统。
Nao 与 NVDA 版本 2021.2 兼容,所以也不要使用旧版本的屏幕阅读器。
Nao 与 NVDA 版本 2019.3 兼容,所以也不要使用旧版本的屏幕阅读器。
另外请注意,Nao 可与 Windows 资源管理器、桌面或 Total Commander 文件管理器配合使用;不要使用 7zip 或 Winrar 等其他软件,因为这些软件不在本插件支持范围内。

## 功能和命令
Expand Down
14 changes: 7 additions & 7 deletions addon/globalPlugins/nao/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Nao (NVDA Advanced OCR) is an addon that improves the standard OCR capabilities that NVDA provides on modern Windows versions.
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Last update 2021-12-30
#Last update 2021-12-31
#Copyright (C) 2021 Alessandro Albano, Davide De Carne and Simone Dal Maso

import globalPluginHandler
Expand All @@ -12,14 +12,15 @@
from .systray_menu import SysTrayMenu
from .nao_pickle import NaoPickle

from .framework.generic.updates import AutoUpdates
from .framework.generic.updates import AutoUpdates, ManualUpdatesCheck
from .framework.ocr.ocr_helper import OCRHelper
from .framework.generic import fileSystem
from .framework import language

language.initTranslation()

ADDON_SUMMARY = addonHandler.getCodeAddon().manifest["summary"]
UPDATES_URL = "https://nvda-nao.org/updates"

class RecognizableFileObject(ScriptableObject):
# Allow the bound gestures to be edited through the Input Gestures dialog (see L{gui.prePopup})
Expand All @@ -38,13 +39,12 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
def __init__(self):
super(GlobalPlugin, self).__init__()
self._systray = SysTrayMenu()
self._systray.create()
self._auto_updates = AutoUpdates("https://nvda-nao.org/updates", NaoPickle())
self._auto_updates.start()
self._systray.create(on_updates_check=lambda: ManualUpdatesCheck(UPDATES_URL, pickle=NaoPickle()))
self._auto_updates = AutoUpdates(UPDATES_URL, NaoPickle())

def terminate(self):
self._auto_updates.stop()
self._systray.destroy()
self._systray.terminate()
self._auto_updates.terminate()

def chooseNVDAObjectOverlayClasses(self, obj, clsList):
if obj:
Expand Down
49 changes: 49 additions & 0 deletions addon/globalPlugins/nao/framework/converters/djvu_converter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#Nao (NVDA Advanced OCR) is an addon that improves the standard OCR capabilities that NVDA provides on modern Windows versions.
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Last update 2022-01-04
#Copyright (C) 2021 Alessandro Albano, Davide De Carne and Simone Dal Maso

import os
import subprocess
from .base.converter import Converter

class DjVuConverter(Converter):
def __init__(self, clear_on_destruct=True):
super(DjVuConverter, self).__init__("tmp_djvu", clear_on_destruct)
self._to_tiff_tool = os.path.join(self._addon_path, "tools", "djvu", "ddjvu.exe")
self._info_tool = os.path.join(self._addon_path, "tools", "djvu", "djvused.exe")
self._djvu_pages = False

def convert(self, djvu_file, on_finish=None, on_progress=None, progress_timeout=1):
self._djvu_pages = False
self._convert(djvu_file, "tiff", on_finish, on_progress, progress_timeout)

@property
def count(self):
return self._djvu_pages

def _command(self, type):
return "\"{}\" -skip -eachpage -format=tiff -quality=deflate \"{}\" \"{}-%06d.tiff\"".format(self._to_tiff_tool, self.source_file, os.path.join(self.temp_path, self.instance_id))

def _thread(self):
self._fetch_info()
super(DjVuConverter, self)._thread()

def _fetch_info(self):
# The next two lines are to prevent the cmd from being displayed.
si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW

cmd = "\"{}\" -e n \"{}\"".format(self._info_tool, self.source_file)
p = subprocess.Popen(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo=si, encoding="unicode_escape", text=True)
stdout, stderr = p.communicate()
if p.returncode == 0 and stdout:
try:
self._djvu_pages = int(stdout)
except:
self._djvu_pages = False
else:
self._djvu_pages = False

DjVuConverter().clear_all()
6 changes: 3 additions & 3 deletions addon/globalPlugins/nao/framework/converters/pdf_converter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Nao (NVDA Advanced OCR) is an addon that improves the standard OCR capabilities that NVDA provides on modern Windows versions.
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Last update 2021-12-21
#Last update 2022-01-04
#Copyright (C) 2021 Alessandro Albano, Davide De Carne and Simone Dal Maso

import os
Expand All @@ -15,7 +15,7 @@ def __init__(self, clear_on_destruct=True):
self._info_tool = os.path.join(self._addon_path, "tools", "pdfinfo.exe")
self._pdf_pages = False

def to_png(self, pdf_file, on_finish=None, on_progress=None, progress_timeout=1):
def convert(self, pdf_file, on_finish=None, on_progress=None, progress_timeout=1):
self._pdf_pages = False
self._convert(pdf_file, "png", on_finish, on_progress, progress_timeout)

Expand All @@ -36,7 +36,7 @@ def _fetch_info(self):
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW

cmd = "\"{}\" \"{}\"".format(self._info_tool, self.source_file)
p = subprocess.Popen(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo=si, text=True)
p = subprocess.Popen(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo=si, encoding="unicode_escape", text=True)
stdout, stderr = p.communicate()
if p.returncode == 0 and stdout:
lines = stdout.splitlines()
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Nao (NVDA Advanced OCR) is an addon that improves the standard OCR capabilities that NVDA provides on modern Windows versions.
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Last update 2021-12-21
#Last update 2021-12-31
#Copyright (C) 2021 Alessandro Albano, Davide De Carne and Simone Dal Maso

import os
Expand All @@ -12,7 +12,7 @@ def __init__(self, clear_on_destruct=True):
super(WebpConverter, self).__init__("tmp_webp", clear_on_destruct)
self._to_png_tool = os.path.join(self._addon_path, "tools", "dwebp.exe")

def to_png(self, webp_file, on_finish=None, on_progress=None, progress_timeout=1):
def convert(self, webp_file, on_finish=None, on_progress=None, progress_timeout=1):
self._convert(webp_file, "png", on_finish, on_progress, progress_timeout)

@property
Expand Down
4 changes: 2 additions & 2 deletions addon/globalPlugins/nao/framework/generic/pickle.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Nao (NVDA Advanced OCR) is an addon that improves the standard OCR capabilities that NVDA provides on modern Windows versions.
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Last update 2021-12-29
#Last update 2021-12-31
#Copyright (C) 2021 Alessandro Albano, Davide De Carne and Simone Dal Maso

import weakref
Expand All @@ -20,7 +20,7 @@ def __new__(cls, name):
ret = None
cls._instances_lock.acquire()
if name in cls._instances:
ret = cls._instances[name]()
ret = cls._instances[name]()
cls._instances_lock.release()
if ret is None:
ret = super(Pickle, cls).__new__(cls)
Expand Down
Loading

0 comments on commit 74815e1

Please sign in to comment.