Compare commits

..

4 Commits

Author SHA1 Message Date
Storm Dragon
ec90906052 Maybe finally solved the plugin keybinding issue... 2025-04-18 13:00:31 -04:00
Storm Dragon
f01374d15e One more try before sleep. 2025-04-14 05:04:59 -04:00
Storm Dragon
0347b7feea Another attempt at fixing plugin keyboard shortcuts. 2025-04-14 04:54:48 -04:00
Storm Dragon
0580dda131 A few documentation updates. 2025-04-11 13:17:26 -04:00
5 changed files with 45 additions and 28 deletions

View File

@ -1 +0,0 @@
See http://wiki.gnome.org/Projects/Cthulhu

View File

@ -1,5 +1,10 @@
# Cthulhu
## Note
If you somehow stumbled across this while looking for a desktop screen reader for Linux, you most likely want [Orca](https://orca.gnome.org/) instead. Cthulhu is currently a supplemental screen reader that fills a nitch for some advanced users. E.g. some older QT based programs may work with Cthulhu, and if you use certain window managers like i3, Mozilla applications like Firefox and Thunderbird may work better.
## Introduction
Cthulhu is a free, open source, flexible, and extensible screen reader
@ -20,7 +25,7 @@ Cthulhu has the following dependencies:
* Python 3 - Python platform
* pygobject-3.0 - Python bindings for the GObject library
* libpeas - GObject based Plugin engine
* pluggy - Plugin and hook calling mechanisms for python
* gtk+-3.0 - GTK+ toolkit
* json-py - a JSON (<https://json.org/>) reader and writer in Python
* python-speechd - Python bindings for Speech Dispatcher (optional)
@ -30,7 +35,6 @@ Cthulhu has the following dependencies:
* py-setproctitle - Python library to set the process title (optional)
* gstreamer-1.0 - GStreamer - Streaming media framework (optional)
* socat - Used for self-voicing functionality.
* libpeas - For the plugin system.
You are strongly encouraged to also have the latest stable versions
of AT-SPI2 and ATK.

View File

@ -47,9 +47,7 @@ class APIHelper:
self.app = app
self._gestureBindings = {}
def registerGestureByString(self, function, name, gestureString,
inputEventType='default', normalizer='cthulhu',
learnModeEnabled=True, contextName=None):
def registerGestureByString(self, function, name, gestureString, inputEventType='default', normalizer='cthulhu', learnModeEnabled=True, contextName=None):
"""Register a gesture by string.
Arguments:
@ -95,7 +93,12 @@ class APIHelper:
self.description = description
def __call__(self, script, inputEvent):
return self.function(script, inputEvent)
try:
return function(script, inputEvent)
except Exception as e:
import logging
logging.getLogger(__name__).error(f"Error in keybinding handler: {e}")
return True
handler = GestureHandler(function, name)
@ -108,6 +111,8 @@ class APIHelper:
keybindings.defaultModifierMask,
modifiers,
handler)
# Add the binding to the active script
bindings.add(binding)
# Store binding for later reference
@ -115,6 +120,13 @@ class APIHelper:
self._gestureBindings[contextName] = []
self._gestureBindings[contextName].append(binding)
# Register key grab at the system level
grab_ids = self.app.addKeyGrab(binding)
# For later removal
if grab_ids:
binding._grab_ids = grab_ids
return binding
return None
@ -132,10 +144,17 @@ class APIHelper:
bindings = cthulhu_state.activeScript.getKeyBindings()
bindings.remove(binding)
# Remove from our tracking
# Remove key grab at system level
if hasattr(binding, '_grab_ids'):
for grab_id in binding._grab_ids:
self.app.removeKeyGrab(grab_id)
# Remove from tracking
if contextName in self._gestureBindings:
if binding in self._gestureBindings[contextName]:
self._gestureBindings[contextName].remove(binding)
import gi
import importlib
import os

View File

@ -23,5 +23,5 @@
# Fork of Orca Screen Reader (GNOME)
# Original source: https://gitlab.gnome.org/GNOME/orca
version = "2025.04.04"
version = "2025.04.18"
codeName = "testing"

View File

@ -1,9 +1,6 @@
#!/usr/bin/env python3
#
# Copyright (c) 2024 Stormux
# Copyright (c) 2010-2012 The Orca Team
# Copyright (c) 2012 Igalia, S.L.
# Copyright (c) 2005-2010 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -20,8 +17,6 @@
# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
# Boston MA 02110-1301 USA.
#
# Fork of Orca Screen Reader (GNOME)
# Original source: https://gitlab.gnome.org/GNOME/orca
"""Self Voice plugin for Cthulhu screen reader."""