From 35acddeb8f1199be61a512e76a8b00f5d63f9237 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 19 Dec 2024 08:20:21 -0500 Subject: [PATCH] Added Display Version plugin, cthul+shift=V. --- src/cthulhu/cthulhuVersion.py | 2 +- .../DisplayVersion/DisplayVersion.plugin | 6 +++ .../plugins/DisplayVersion/DisplayVersion.py | 48 +++++++++++++++++++ .../plugins/DisplayVersion/Makefile.am | 7 +++ .../plugins/DisplayVersion/__init__.py | 25 ++++++++++ src/cthulhu/plugins/Makefile.am | 2 +- 6 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 src/cthulhu/plugins/DisplayVersion/DisplayVersion.plugin create mode 100644 src/cthulhu/plugins/DisplayVersion/DisplayVersion.py create mode 100644 src/cthulhu/plugins/DisplayVersion/Makefile.am create mode 100644 src/cthulhu/plugins/DisplayVersion/__init__.py diff --git a/src/cthulhu/cthulhuVersion.py b/src/cthulhu/cthulhuVersion.py index 139579c..ffe2d21 100644 --- a/src/cthulhu/cthulhuVersion.py +++ b/src/cthulhu/cthulhuVersion.py @@ -23,5 +23,5 @@ # Fork of Orca Screen Reader (GNOME) # Original source: https://gitlab.gnome.org/GNOME/orca -version = "2024.12.18" +version = "2024.12.19" codeName = "testing" diff --git a/src/cthulhu/plugins/DisplayVersion/DisplayVersion.plugin b/src/cthulhu/plugins/DisplayVersion/DisplayVersion.plugin new file mode 100644 index 0000000..4529805 --- /dev/null +++ b/src/cthulhu/plugins/DisplayVersion/DisplayVersion.plugin @@ -0,0 +1,6 @@ +[Plugin] +Module=DisplayVersion +Loader=python3 +Name=Display Version +Description=Announce the current version of Cthulhu +Authors=Storm Dragon diff --git a/src/cthulhu/plugins/DisplayVersion/DisplayVersion.py b/src/cthulhu/plugins/DisplayVersion/DisplayVersion.py new file mode 100644 index 0000000..a008407 --- /dev/null +++ b/src/cthulhu/plugins/DisplayVersion/DisplayVersion.py @@ -0,0 +1,48 @@ +#!/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 +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the +# 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 + +from cthulhu import plugin + +import gi +gi.require_version('Peas', '1.0') +from gi.repository import GObject +from gi.repository import Peas +from cthulhu import cthulhuVersion + +class DisplayVersion(GObject.Object, Peas.Activatable, plugin.Plugin): + __gtype_name__ = 'displayversion' + + object = GObject.Property(type=GObject.Object) + def __init__(self): + plugin.Plugin.__init__(self) + def do_activate(self): + API = self.object + self.registerGestureByString(self.speakText, _(f'Cthulhu screen reader version {cthulhuVersion.version}-{cthulhuVersion.codeName}'), 'kb:cthulhu+V') + def do_deactivate(self): + API = self.object + 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) + return True diff --git a/src/cthulhu/plugins/DisplayVersion/Makefile.am b/src/cthulhu/plugins/DisplayVersion/Makefile.am new file mode 100644 index 0000000..0cf43a4 --- /dev/null +++ b/src/cthulhu/plugins/DisplayVersion/Makefile.am @@ -0,0 +1,7 @@ +cthulhu_python_PYTHON = \ + __init__.py \ + DisplayVersion.plugin \ + DisplayVersion.py + +cthulhu_pythondir=$(pkgpythondir)/plugins/DisplayVersion + diff --git a/src/cthulhu/plugins/DisplayVersion/__init__.py b/src/cthulhu/plugins/DisplayVersion/__init__.py new file mode 100644 index 0000000..782103c --- /dev/null +++ b/src/cthulhu/plugins/DisplayVersion/__init__.py @@ -0,0 +1,25 @@ +#!/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 +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the +# 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 + diff --git a/src/cthulhu/plugins/Makefile.am b/src/cthulhu/plugins/Makefile.am index f34a494..fc36845 100644 --- a/src/cthulhu/plugins/Makefile.am +++ b/src/cthulhu/plugins/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = Clipboard HelloWorld SelfVoice Time MouseReview Date ByeCthulhu HelloCthulhu PluginManager CapsLockHack SimplePluginSystem +SUBDIRS = Clipboard DisplayVersion HelloWorld SelfVoice Time MouseReview Date ByeCthulhu HelloCthulhu PluginManager CapsLockHack SimplePluginSystem cthulhu_pythondir=$(pkgpythondir)/plugins