Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

braille display: Add various (automatic) refreshes #94

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions addon/globalPlugins/brailleExtender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import tones
import ui
import virtualBuffers
import vision
import wx
from logHandler import log

Expand Down Expand Up @@ -195,6 +196,16 @@ def event_valueChange(self, obj, nextHandler):
log.error(e)
nextHandler()

def event_nameChange(self, obj, nextHandler):
if config.conf["brailleExtender"]["advanced"]["refreshForegroundObjNameChange"]:
fg = api.getForegroundObject()
visibleRegions = list(braille.handler.mainBuffer.visibleRegions)
if len(visibleRegions) > 1 and visibleRegions[0].obj is not api.getFocusObject() and visibleRegions[0].obj is not fg:
visibleRegions[0].obj = fg
braille.handler.handleUpdate(fg)
vision.handler.handleUpdate(fg, property="name")
nextHandler()

def createMenu(self):
self.submenu = wx.Menu()
item = self.submenu.Append(wx.ID_ANY, _("Docu&mentation"), _("Opens the addon's documentation."))
Expand Down
3 changes: 3 additions & 0 deletions addon/globalPlugins/brailleExtender/addoncfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ def getConfspec():
"enabled": "boolean(default=False)",
"inputMethod": f"option({DOT_BY_DOT}, {BOTH_SIDES}, {ONE_SIDE}, default={ONE_SIDE})",
},
"advanced": {
"refreshForegroundObjNameChange": "boolean(default=False)",
},
}

def loadPreferedTables():
Expand Down
16 changes: 16 additions & 0 deletions addon/globalPlugins/brailleExtender/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,21 @@ def onBrowseBtn(self, event):
def askCreateQuickLaunch():
gui.messageBox(_("Please create or select a quick launch first"), '%s – %s' % (addonName, _("Error")), wx.OK|wx.ICON_ERROR)


class AdvancedDlg(gui.settingsDialogs.SettingsPanel):

# Translators: title of a dialog.
title = _("Advanced")

def makeSettings(self, settingsSizer):
sHelper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer)
self.refreshForegroundObjNameChange = sHelper.addItem(wx.CheckBox(self, label="event_nameChange: " + _("force the refresh of braille region related to &foreground object")))
self.refreshForegroundObjNameChange.SetValue(config.conf["brailleExtender"]["advanced"]["refreshForegroundObjNameChange"])

def onSave(self):
config.conf["brailleExtender"]["advanced"]["refreshForegroundObjNameChange"] = self.refreshForegroundObjNameChange.IsChecked()


class AddonSettingsDialog(gui.settingsDialogs.MultiCategorySettingsDialog):
categoryClasses=[
GeneralDlg,
Expand All @@ -588,6 +603,7 @@ class AddonSettingsDialog(gui.settingsDialogs.MultiCategorySettingsDialog):
AdvancedInputModeDlg,
OneHandModeDlg,
RoleLabelsDlg,
AdvancedDlg,
]

def __init__(self, parent, initialCategory=None):
Expand Down
Loading