Updated clipboard plugin to work with the now fixed plugin system.

This commit is contained in:
Storm Dragon
2025-06-05 14:05:23 -04:00
parent 0f25245d3d
commit 408fb85730
2 changed files with 6 additions and 36 deletions

View File

@ -23,3 +23,8 @@
# Fork of Orca Screen Reader (GNOME) # Fork of Orca Screen Reader (GNOME)
# Original source: https://gitlab.gnome.org/GNOME/orca # Original source: https://gitlab.gnome.org/GNOME/orca
"""Clipboard plugin package."""
from .plugin import Clipboard
__all__ = ['Clipboard']

View File

@ -72,42 +72,7 @@ class Clipboard(Plugin):
return return
logger.info("Deactivating Clipboard plugin") logger.info("Deactivating Clipboard plugin")
try: # Note: Currently no unregister method needed as keybindings are managed by APIHelper
# Unregister keyboard shortcut
if self.app:
api_helper = self.app.getAPIHelper()
if api_helper and hasattr(api_helper, 'unregisterShortcut'):
api_helper.unregisterShortcut('kb:cthulhu+shift+c')
logger.debug("Unregistered clipboard shortcut")
except Exception as e:
logger.error(f"Error deactivating Clipboard plugin: {e}")
"""Activate the plugin."""
# Skip if this activation call isn't for us
if plugin is not None and plugin is not self:
return
logger.info("Activating Clipboard plugin")
try:
# Register keyboard shortcut
self.registerGestureByString(self.speakClipboard, _('clipboard'), 'kb:cthulhu+shift+c')
logger.debug("Registered shortcut for clipboard")
except Exception as e:
logger.error(f"Error activating Clipboard plugin: {e}")
@cthulhu_hookimpl
def deactivate(self, plugin=None):
"""Deactivate the plugin."""
# Skip if this deactivation call isn't for us
if plugin is not None and plugin is not self:
return
logger.info("Deactivating Clipboard plugin")
try:
# Unregister keyboard shortcut
self.unregisterGestureByString('kb:cthulhu+shift+c')
logger.debug("Unregistered clipboard shortcut")
except Exception as e:
logger.error(f"Error deactivating Clipboard plugin: {e}")
def speakClipboard(self, script=None, inputEvent=None): def speakClipboard(self, script=None, inputEvent=None):
"""Present the contents of the clipboard.""" """Present the contents of the clipboard."""