From 5dd872535da0e33fb2b15909f74de7b24eb57289 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 19 Dec 2024 09:30:59 -0500 Subject: [PATCH] Temperarily change the keyboard short fo version to cthulhu+x. --- .../plugins/DisplayVersion/DisplayVersion.py | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/cthulhu/plugins/DisplayVersion/DisplayVersion.py b/src/cthulhu/plugins/DisplayVersion/DisplayVersion.py index 894bc25..e52fee9 100644 --- a/src/cthulhu/plugins/DisplayVersion/DisplayVersion.py +++ b/src/cthulhu/plugins/DisplayVersion/DisplayVersion.py @@ -35,14 +35,27 @@ class DisplayVersion(GObject.Object, Peas.Activatable, plugin.Plugin): __gtype_name__ = 'displayversion' object = GObject.Property(type=GObject.Object) + def __init__(self): plugin.Plugin.__init__(self) + self._api = None + def do_activate(self): - API = self.object - self.registerGestureByString(self.speakText, _(f'Cthulhu screen reader version {cthulhuVersion.version}-{cthulhuVersion.codeName}'), 'kb:cthulhu+shift+v') + self._api = self.object + self.registerGestureByString( + self.speakText, + _(f'Cthulhu screen reader version {cthulhuVersion.version}-{cthulhuVersion.codeName}'), + 'kb:cthulhu+x' + ) + def do_deactivate(self): - API = self.object + self._api = None + def speakText(self, script=None, inputEvent=None): - API = self.object - API.app.getDynamicApiManager().getAPI('CthulhuState').activeScript.presentMessage(f'Cthulhu screen reader version {cthulhuVersion.version}-{cthulhuVersion.codeName}', resetStyles=False) + if not self._api: + return False + self._api.app.getDynamicApiManager().getAPI('CthulhuState').activeScript.presentMessage( + f'Cthulhu screen reader version {cthulhuVersion.version}-{cthulhuVersion.codeName}', + resetStyles=False + ) return True