def __init__(self, parent, informationLabel="", information=""):
        if InformationDialog._instance is not None:
            return

        InformationDialog._instance = self
        addonDir = os.path.join(os.path.dirname(__file__), "..\..").decode(
            "mbcs")  # The root of an addon folder
        curAddon = addonHandler.Addon(addonDir)  # Addon instance
        summary = curAddon.manifest["summary"]
        title = self.title % summary
        super(InformationDialog, self).__init__(parent, wx.ID_ANY, title)
        self.informationLabel = informationLabel
        self.information = information
        self.doGui()
        self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
        self.Show()
Exemple #2
0
cfgFile = globalVars.appArgs.configPath + '\\BrailleExtender.conf'
cfgFileAttribra = globalVars.appArgs.configPath + '\\attribra-BE.ini'
reviewModeApps = []
quickLaunches = OrderedDict()
backupDisplaySize = braille.handler.displaySize
conf = {}
iniGestures = {}
iniProfile = {}
confAttribra = {}
profileFileExists = gesturesFileExists = False
lang = languageHandler.getLanguage().split('_')[-1].lower()
noMessageTimeout = True if 'noMessageTimeout' in config.conf["braille"] else False
sep = ' ' if 'fr' in lang else ''
oTables = iTables = None
_addonDir = osp.join(osp.dirname(__file__), "..", "..").decode("mbcs")
_addonName = addonHandler.Addon(_addonDir).manifest['name']
_addonVersion = addonHandler.Addon(_addonDir).manifest['version']
_addonURL = addonHandler.Addon(_addonDir).manifest['url']
_addonAuthor = addonHandler.Addon(_addonDir).manifest['author']
_addonDesc = addonHandler.Addon(_addonDir).manifest['description']
profilesDir = osp.join(osp.dirname(__file__), "Profiles").decode('mbcs')
if not osp.exists(profilesDir): log.error('Profiles\' path not found')
else: log.debug('Profiles\' path (%s) found' % profilesDir)
begFileAttribra = """# Attribra for BrailleExtender
# Thanks to Alberto Zanella
# -> https://github.com/albzan/attribra/
"""
try:
	import brailleTables
	tablesFN = [t[0] for t in brailleTables.listTables()]
	tablesUFN = [t[0] for t in brailleTables.listTables() if not t.contracted and t.output]
curBD = braille.handler.display.name
backupDisplaySize = braille.handler.displaySize
backupRoleLabels = {}
iniGestures = {}
iniProfile = {}
profileFileExists = gesturesFileExists = False
lang = languageHandler.getLanguage().split('_')[-1].lower()
noMessageTimeout = True if 'noMessageTimeout' in config.conf[
    "braille"] else False
sep = ' ' if 'fr' in lang else ''
outputTables = inputTables = None
preTable = []
postTable = []
baseDir = os.path.dirname(__file__).decode("mbcs")
_addonDir = os.path.join(baseDir, "..", "..")
_addonName = addonHandler.Addon(_addonDir).manifest["name"]
_addonVersion = addonHandler.Addon(_addonDir).manifest["version"]
_addonURL = addonHandler.Addon(_addonDir).manifest["url"]
_addonAuthor = addonHandler.Addon(_addonDir).manifest["author"]
_addonDesc = addonHandler.Addon(_addonDir).manifest["description"]

profilesDir = os.path.join(baseDir, "Profiles")
if not os.path.exists(profilesDir): log.error('Profiles\' path not found')
else: log.debug('Profiles\' path (%s) found' % profilesDir)
try:
    import brailleTables
    brailleTablesDir = brailleTables.TABLES_DIR
    tables = brailleTables.listTables()
    tablesFN = [t[0] for t in brailleTables.listTables()]
    tablesUFN = [
        t[0] for t in brailleTables.listTables()
Exemple #4
0
# common.py
# Part of BrailleExtender addon for NVDA
# Copyright 2016-2020 André-Abush CLAUSE, released under GPL.

import os

import addonHandler
import globalVars
import languageHandler

configDir = "%s/brailleExtender" % globalVars.appArgs.configPath
baseDir = os.path.dirname(__file__)
addonDir = os.path.join(baseDir, "..", "..")
addonName = addonHandler.Addon(addonDir).manifest["name"]
addonSummary = addonHandler.Addon(addonDir).manifest["summary"]
addonVersion = addonHandler.Addon(addonDir).manifest["version"]
addonURL = addonHandler.Addon(addonDir).manifest["url"]
addonGitHubURL = "https://github.com/aaclause/BrailleExtender/"
addonAuthor = addonHandler.Addon(addonDir).manifest["author"]
addonDesc = addonHandler.Addon(addonDir).manifest["description"]
addonUpdateChannel = addonHandler.Addon(addonDir).manifest["updateChannel"]

lang = languageHandler.getLanguage().split('_')[-1].lower()
punctuationSeparator = ' ' if 'fr' in lang else ''


profilesDir = os.path.join(baseDir, "Profiles")

REPLACE_TEXT = 0
INSERT_AFTER = 1
INSERT_BEFORE = 2
Exemple #5
0
# docHandler: module for managing addons documentation
# See: http://community.nvda-project.org/ticket/2694

import os
import languageHandler
import addonHandler
import globalPluginHandler
import gui
import wx

addonHandler.initTranslation()

_addonDir = os.path.join(os.path.dirname(__file__),
                         "..")  # The root of an addon folder
_docFileName = "readme.html"  # The name of an addon documentation file
_curAddon = addonHandler.Addon(_addonDir)  # Addon instance
_addonSummary = _curAddon.manifest['summary']
_addonVersion = _curAddon.manifest['version']
_addonName = _curAddon.manifest['name']


def getDocFolder(addonDir=_addonDir):
    langs = [languageHandler.getLanguage(), "en"]
    for lang in langs:
        docFolder = os.path.join(addonDir, "doc", lang)
        if os.path.isdir(docFolder):
            return docFolder
        if "_" in lang:
            tryLang = lang.split("_")[0]
            docFolder = os.path.join(addonDir, "doc", tryLang)
            if os.path.isdir(docFolder):
Exemple #6
0
import braille
import config
import core
import globalVars
import gui
import languageHandler
import ui
import versionInfo
import wx
from logHandler import log

addonHandler.initTranslation()

baseDir = os.path.dirname(__file__)
_addonDir = os.path.join(baseDir, "..", "..")
addonInfos = addonHandler.Addon(_addonDir).manifest
sectionName = "brailleExtender"
checkInProgress = False


def paramsDL():
    return {
        "protocoleVersion": "3",
        "addonVersion": addonInfos["version"],
        "NVDAVersion": versionInfo.version,
        "channel": config.conf[sectionName]["updateChannel"],
        "language": languageHandler.getLanguage(),
        "brailledisplay": braille.handler.display.name,
    }

Exemple #7
0
import os
import api
from scriptHandler import getLastScriptRepeatCount
from winUser import CHILDID_SELF, OBJID_CLIENT, setFocus, mouse_event, MOUSEEVENTF_LEFTDOWN, MOUSEEVENTF_LEFTUP
from ui import message
import speech
from NVDAObjects.IAccessible import IAccessible, getNVDAObjectFromEvent

oldSpeechMode = speech.speechMode
hr, min, sec, hun, th = _('hours'), _('minutes'), _('seconds'), _(
    'hundredths'), _('thousandths')

### Constants
PROGRAM_NAME = 'mp3DirectCut'
ADDON_DIR = os.path.join(os.path.dirname(__file__), '..').decode('mbcs')
ADDON_SUMMARY = addonHandler.Addon(ADDON_DIR).manifest['summary']

announce = (
    # Translators: Message to inform that no selection has been realized.
    _('No selection'),
    # Translators: Message to inform the user that the playback cursor is at the top of the file.
    _('Beginning of the file.'),
    # Translators: Message to inform the user that the playback cursor is at the end of the file.
    _('End of the file.'),
    # Translators: Message to inform the user that not file is loaded.
    _('Not file is loaded. Please check that you are in a file, open one with Control O, or R to start recording.'
      ),
    # Translators: Message to inform the user that the current command is not available in a recording mode.
    _('This command is not available in a recording mode, it is available only in a reading mode !'
      ),
    # Translators: Message to indicate the position of the selection start marker.
Exemple #8
0
from comtypes import CLSCTX_ALL, pointer
from typing import List
from logHandler import log
from .pycaw import AudioDevice, IMMDevice, AudioUtilities, IAudioEndpointVolume, ISimpleAudioVolume

try:
    addonHandler.initTranslation()
except addonHandler.AddonError:
    log.warning(
        "Unable to init translations. This may be because the addon is running from NVDA scratchpad."
    )

_addonDir = os.path.join(os.path.dirname(__file__), "..", "..")
if isinstance(_addonDir, bytes):
    _addonDir = _addonDir.decode("mbcs")
_curAddon = addonHandler.Addon(_addonDir)
addonName: str = _curAddon.manifest['name']
addonSummary: str = _curAddon.manifest['summary']

from .settings import UnmuteSettingsPanel  # noqa E402


class GlobalPlugin(globalPluginHandler.GlobalPlugin):
    """Implementation global commands of NVDA add-on"""
    scriptCategory: str = addonSummary

    def __init__(self, *args, **kwargs) -> None:
        """Initializing initial configuration values ​​and other fields"""
        super(GlobalPlugin, self).__init__(*args, **kwargs)
        confspec = {
            "volume": "integer(default=20,min=0,max=100)",
Exemple #9
0
from gui import guiHelper
import wx
import ui
import speech
import sayAllHandler
from scriptHandler import willSayAllResume
from cursorManager import CursorManager
from logHandler import log
from .skipTranslation import translate

addonHandler.initTranslation()

### Constants
ADDON_DIR = os.path.join(os.path.dirname(__file__), "..",
                         "..")  # The root of the addon folder
ADDON_INSTANCE = addonHandler.Addon(ADDON_DIR)
ADDON_SUMMARY = ADDON_INSTANCE.manifest['summary']
PLACE_MARKERS_PATH = os.path.join(os.path.dirname(__file__),
                                  "savedPlaceMarkers").decode("mbcs")
SEARCH_FOLDER = os.path.join(PLACE_MARKERS_PATH, "search")
BOOKMARKS_FOLDER = os.path.join(PLACE_MARKERS_PATH, "bookmarks")
CONFIG_PATH = globalVars.appArgs.configPath


def createSearchFolder():
    if os.path.isdir(SEARCH_FOLDER):
        return
    try:
        os.makedirs(SEARCH_FOLDER)
    except Exception as e:
        log.debugWarning("Error creating search folder", exc_info=True)
Exemple #10
0
if py3:
    import pickle
    from urllib.request import urlopen
else:
    import cPickle as pickle
    from urllib import urlopen
import threading
import tempfile
import ctypes
import ssl
import gui
import wx
from . import splactions

# 18.09: choose default channel/update URL combination based on which channel is currently installed.
SPLAddonManifest = addonHandler.Addon(
    os.path.join(os.path.dirname(__file__), "..", "..")).manifest
devVersion = "-dev" in SPLAddonManifest['version'] or SPLAddonManifest.get(
    "updateChannel") == "dev"
# The Unix time stamp for add-on check time.
SPLAddonCheck = 0
# Update metadata storage.
SPLAddonState = {}
# Update URL (the only way to change it is installing a different version from a different branch).
SPLUpdateURL = "https://addons.nvda-project.org/files/get.php?file=spl-dev" if devVersion else "https://addons.nvda-project.org/files/get.php?file=spl"
SPLUpdateChannel = "dev" if devVersion else "stable"
# Update check timer.
_SPLUpdateT = None
# How long it should wait between automatic checks.
_updateInterval = 86400
# Set if a socket error occurs.
_retryAfterFailure = False
else:
    import cPickle as pickle
    from urllib import urlopen
import threading
import tempfile
import ctypes
import ssl
import gui
import wx
from . import splactions

# Add-on manifest routine (credit: various add-on authors including Noelia Martinez).
# Do not rely on using absolute path to open to manifest, as installation directory may change in a future NVDA Core version (highly unlikely, but...).
_addonDir = os.path.join(os.path.dirname(__file__), "..", "..")
# Move this to the main app module in case version will be queried by users.
SPLAddonVersion = addonHandler.Addon(_addonDir).manifest['version']
# The Unix time stamp for add-on check time.
SPLAddonCheck = 0
# Update metadata storage.
SPLAddonState = {}
# Update URL (the only way to change it is installing a different version from a different branch).
SPLUpdateURL = "https://addons.nvda-project.org/files/get.php?file=spl-dev"
_pendingChannelChange = False
_updateNow = False
SPLUpdateChannel = "dev"
# Update check timer.
_SPLUpdateT = None
# How long it should wait between automatic checks.
_updateInterval = 86400
# Set if a socket error occurs.
_retryAfterFailure = False
Exemple #12
0
from logHandler import log
import addonHandler
addonHandler.initTranslation()

# Add-on config database
confspec = {
    "autoUpdateCheck": "boolean(default=true)",
    "updateChannel": "string(default=dev)",
    "updateCheckTime": "integer(default=0)",
    "updateCheckTimeInterval": "integer(min=0, max=30, default=1)",
}
config.conf.spec["wintenApps"] = confspec

_addonDir = unicode(os.path.join(os.path.dirname(__file__), "..", ".."),
                    "mbcs")
addonVersion = addonHandler.Addon(unicode(_addonDir)).manifest['version']
addonUpdateCheckInterval = 86400

channels = {
    "stable": "https://addons.nvda-project.org/files/get.php?file=w10",
    "dev": "https://addons.nvda-project.org/files/get.php?file=w10-dev",
}

updateChecker = None


# To avoid freezes, a background thread will run after the global plugin constructor calls wx.CallAfter.
def autoUpdateCheck():
    currentTime = time.time()
    whenToCheck = config.conf["wintenApps"]["updateCheckTime"]
    if currentTime >= whenToCheck: