Skip to content

Commit

Permalink
Merge branch 'highRefresh' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
aaclause committed May 12, 2024
2 parents d8c8119 + ea91092 commit 138de6b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions addon/globalPlugins/brailleExtender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import tones
import ui
import virtualBuffers
import vision
import wx
from logHandler import log

Expand Down Expand Up @@ -196,6 +197,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
1 change: 1 addition & 0 deletions addon/globalPlugins/brailleExtender/addoncfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def getConfspec():
},
"advanced": {
"fixCursorPositions": "boolean(default=True)",
"refreshForegroundObjNameChange": "boolean(default=False)",
},
}

Expand Down
4 changes: 4 additions & 0 deletions addon/globalPlugins/brailleExtender/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,12 @@ def makeSettings(self, settingsSizer):
self.fixCursorPositions = sHelper.addItem(wx.CheckBox(self, label=_("Avoid &cursor positions issues with some characters such as variation selectors")))
self.fixCursorPositions.SetValue(config.conf["brailleExtender"]["advanced"]["fixCursorPositions"])

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"]["fixCursorPositions"] = self.fixCursorPositions.IsChecked()
config.conf["brailleExtender"]["advanced"]["refreshForegroundObjNameChange"] = self.refreshForegroundObjNameChange.IsChecked()


class AddonSettingsDialog(gui.settingsDialogs.MultiCategorySettingsDialog):
Expand Down

0 comments on commit 138de6b

Please sign in to comment.