5 Commits
v0.2 ... v0.3

13 changed files with 7347 additions and 64 deletions

View File

@ -1,4 +1,4 @@
m4_define([cthulhu_version], [0.2])
m4_define([cthulhu_version], [0.3])
m4_define(pygobject_required_version, 3.18)
m4_define(atspi_required_version, 2.48)
@ -129,6 +129,7 @@ src/cthulhu/plugins/SelfVoice/Makefile
src/cthulhu/plugins/Date/Makefile
src/cthulhu/plugins/Time/Makefile
src/cthulhu/plugins/MouseReview/Makefile
src/cthulhu/plugins/ClassicPreferences/Makefile
src/cthulhu/backends/Makefile
src/cthulhu/cthulhu_bin.py
src/cthulhu/cthulhu_i18n.py

View File

@ -1,7 +1,7 @@
# Maintainer: Storm Dragon <storm_dragon@stormux.org>
pkgname=cthulhu
pkgver=0.2
pkgver=0.3
pkgrel=1
pkgdesc="Screen reader for individuals who are blind or visually impaired forked from Orca"
url="https://git.stormux.org/storm/cthulhu"

View File

@ -530,55 +530,6 @@ def loadUserSettings(script=None, inputEvent=None, skipReloadMessage=False):
return True
def _showPreferencesUI(script, prefs):
if cthulhu_state.cthulhuOS:
cthulhu_state.cthulhuOS.showGUI()
return
try:
module = importlib.import_module('.cthulhu_gui_prefs', 'cthulhu')
except Exception:
debug.printException(debug.LEVEL_SEVERE)
return
uiFile = os.path.join(cthulhu_platform.datadir,
cthulhu_platform.package,
"ui",
"cthulhu-setup.ui")
cthulhu_state.cthulhuOS = module.CthulhuSetupGUI(uiFile, "cthulhuSetupWindow", prefs)
cthulhu_state.cthulhuOS.init(script)
cthulhu_state.cthulhuOS.showGUI()
def showAppPreferencesGUI(script=None, inputEvent=None):
"""Displays the user interface to configure the settings for a
specific applications within Cthulhu and set up those app-specific
user preferences using a GUI.
Returns True to indicate the input event has been consumed.
"""
prefs = {}
for key in settings.userCustomizableSettings:
prefs[key] = _settingsManager.getSetting(key)
script = script or cthulhu_state.activeScript
_showPreferencesUI(script, prefs)
return True
def showPreferencesGUI(script=None, inputEvent=None):
"""Displays the user interface to configure Cthulhu and set up
user preferences using a GUI.
Returns True to indicate the input event has been consumed.
"""
prefs = _settingsManager.getGeneralSettings(_settingsManager.profile)
script = _scriptManager.getDefaultScript()
_showPreferencesUI(script, prefs)
return True
def addKeyGrab(binding):
""" Add a key grab for the given key binding."""

View File

@ -0,0 +1,14 @@
[Plugin]
Module=ClassicPreferences
Loader=python3
Name=Classic Preferences UI
Description=The classic preferences dialog
Authors=Chrys chrys@linux-a11y.org
Website=
Version=1.0
Copyright=
Builtin=true
Hidden=true
Depends=
Icon=
Help=

View File

@ -0,0 +1,84 @@
from cthulhu import plugin
import gi, time
gi.require_version('Peas', '1.0')
from gi.repository import GObject
from gi.repository import Peas
import importlib, os
import cthulhu_gui_prefs
class ClassicPreferences(GObject.Object, Peas.Activatable, plugin.Plugin):
#__gtype_name__ = 'ClassicPreferences'
object = GObject.Property(type=GObject.Object)
def __init__(self):
plugin.Plugin.__init__(self)
def do_activate(self):
API = self.object
self.connectSignal("setup-inputeventhandlers-completed", self.setupCompatBinding)
#self.setupCompatBinding(API.app)
def setupCompatBinding(self, app):
cmdnames = app.getDynamicApiManager().getAPI('Cmdnames')
inputEventHandlers = app.getDynamicApiManager().getAPI('inputEventHandlers')
inputEventHandlers['preferencesSettingsHandler'] = app.getAPIHelper().createInputEventHandler(self.showPreferencesGUI, cmdnames.SHOW_PREFERENCES_GUI)
inputEventHandlers['appPreferencesSettingsHandler'] = app.getAPIHelper().createInputEventHandler(self.showAppPreferencesGUI, cmdnames.SHOW_APP_PREFERENCES_GUI)
def do_deactivate(self):
API = self.object
inputEventHandlers = API.app.getDynamicApiManager().getAPI('inputEventHandlers')
del inputEventHandlers['preferencesSettingsHandler']
del inputEventHandlers['appPreferencesSettingsHandler']
def do_update_state(self):
API = self.object
def showAppPreferencesGUI(self, script=None, inputEvent=None):
"""Displays the user interface to configure the settings for a
specific applications within Cthulhu and set up those app-specific
user preferences using a GUI.
Returns True to indicate the input event has been consumed.
"""
API = self.object
cthulhu_state = API.app.getDynamicApiManager().getAPI('CthulhuState')
settings = API.app.getDynamicApiManager().getAPI('Settings')
_settingsManager = API.app.getDynamicApiManager().getAPI('SettingsManager').getManager()
_scriptManager = API.app.getDynamicApiManager().getAPI('ScriptManager').getManager()
prefs = {}
for key in settings.userCustomizableSettings:
prefs[key] = _settingsManager.getSetting(key)
script = script or cthulhu_state.activeScript
self._showPreferencesUI(script, prefs)
return True
def showPreferencesGUI(self, script=None, inputEvent=None):
"""Displays the user interface to configure Cthulhu and set up
user preferences using a GUI.
Returns True to indicate the input event has been consumed.
"""
API = self.object
cthulhu_state = API.app.getDynamicApiManager().getAPI('CthulhuState')
settings = API.app.getDynamicApiManager().getAPI('Settings')
_settingsManager = API.app.getDynamicApiManager().getAPI('SettingsManager').getManager()
_scriptManager = API.app.getDynamicApiManager().getAPI('ScriptManager').getManager()
debug = API.app.getDynamicApiManager().getAPI('Debug')
prefs = _settingsManager.getGeneralSettings(_settingsManager.profile)
script = _scriptManager.getDefaultScript()
self._showPreferencesUI(script, prefs)
return True
def _showPreferencesUI(self, script, prefs):
API = self.object
cthulhu_state = API.app.getDynamicApiManager().getAPI('CthulhuState')
debug = API.app.getDynamicApiManager().getAPI('Debug')
cthulhu_platform = API.app.getDynamicApiManager().getAPI('CthulhuPlatform')
if cthulhu_state.cthulhuOS:
cthulhu_state.cthulhuOS.showGUI()
return
uiFile = os.path.join(self.getModuleDir(),
"cthulhu-setup.ui")
cthulhu_state.cthulhuOS = cthulhu_gui_prefs.CthulhuSetupGUI(uiFile, "cthulhuSetupWindow", prefs, API.app)
cthulhu_state.cthulhuOS.init(script)
cthulhu_state.cthulhuOS.setTranslationContext(self.getTranslationContext())
cthulhu_state.cthulhuOS.showGUI()

View File

@ -0,0 +1,10 @@
cthulhu_python_PYTHON = \
__init__.py \
ClassicPreferences.plugin \
ClassicPreferences.py \
cthulhu_gui_prefs.py \
cthulhu_gui_profile.py \
cthulhu-setup.ui
cthulhu_pythondir=$(pkgpythondir)/plugins/ClassicPreferences

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
# Cthulhu
#
# Copyright 2010 Consorcio Fernando de los Rios.
# Author: Javier Hernandez Antunez <jhernandez@emergya.es>
# Author: Alejandro Leiva <aleiva@emergya.es>
#
# 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.
"""Displays the Save Profile As dialog."""
__id__ = "$Id$"
__version__ = "$Revision$"
__date__ = "$Date$"
__copyright__ = "Copyright (c) 2010 Consorcio Fernando de los Rios."
__license__ = "LGPL"
import locale
import sys
from gi.repository import Gtk
cthulhu_state = None
guilabels = None
OS = None
newProfile = None
app = None
class CthulhuProfileGUI(Gtk.Dialog):
def __init__(self, app):
"""Initialize the Cthulhu profile configuration GUI."""
self.app = app
global guilabels
global cthulhu_state
guilabels = self.app.getDynamicApiManager().getAPI('GuiLabels')
cthulhu_state = self.app.getDynamicApiManager().getAPI('CthulhuState')
Gtk.Dialog.__init__(self)
self.set_title(guilabels.PROFILE_SAVE_AS_TITLE)
self.set_has_resize_grip(False)
self.add_button('gtk-cancel', Gtk.ResponseType.CANCEL)
self.add_button('gtk-save', Gtk.ResponseType.ACCEPT)
grid = Gtk.Grid()
grid.set_property('margin', 12)
grid.set_row_spacing(10)
grid.set_column_spacing(10)
# Right now the content area is a GtkBox. We'll need to update
# this once GtkBox is fully deprecated.
contentArea = self.get_content_area()
contentArea.pack_start(grid, True, True, 0)
self.profileEntry = Gtk.Entry()
self.profileEntry.set_property('hexpand', True)
self.profileEntry.set_activates_default(True)
grid.attach(self.profileEntry, 1, 0, 1, 1)
label = Gtk.Label(guilabels.PROFILE_NAME_LABEL)
label.set_use_underline(True)
label.set_mnemonic_widget(self.profileEntry)
grid.attach(label, 0, 0, 1, 1)
defaultButton = self.get_widget_for_response(Gtk.ResponseType.ACCEPT)
defaultButton.set_property('can-default', True)
defaultButton.set_property('has-default', True)
self.connect('response', self.onResponse)
self.connect('destroy', self.onDestroy)
self.searchString = None
self.profileString = None
self.prefsDialog = None
self.translationContext = None
def init(self):
self.profileString = ''
def showGUI(self, prefsDialog):
"""Show the Save Profile As dialog."""
self.show_all()
self.prefsDialog = prefsDialog
self.profileEntry.set_text(self.profileString)
ts = 0
try:
ts = cthulhu_state.lastInputEvent.timestamp
except:
pass
if ts == 0:
ts = Gtk.get_current_event_time()
self.present_with_time(ts)
def onResponse(self, widget, response):
"""Signal handler for the responses emitted by the dialog."""
if response in [Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT]:
self.hide()
return
if response == Gtk.ResponseType.ACCEPT:
global newProfile
newProfile = self.profileEntry.get_text()
if newProfile:
self.destroy()
if self.prefsDialog:
self.prefsDialog.saveProfile(newProfile)
def onDestroy(self, widget):
"""Signal handler for the 'destroy' signal of the dialog."""
global OS
OS = None
def setTranslationContext(newTranslationContext):
global _, translationContext
translationContext = newTranslationContext
_ = newTranslationContext.gettext
def setApp(newApp):
global app
app = newApp
def showProfileUI(prefsDialog=None):
global OS
global newProfile
newProfile = None
if not OS:
OS = CthulhuProfileGUI(app)
OS.init()
OS.showGUI(prefsDialog)
def main():
locale.setlocale(locale.LC_ALL, '')
showProfileUI()
Gtk.main()
sys.exit(0)
if __name__ == "__main__":
main()

View File

@ -1,4 +1,4 @@
SUBDIRS = Clipboard HelloWorld SelfVoice Time MouseReview Date ByeCthulhu HelloCthulhu PluginManager CapsLockHack
SUBDIRS = Clipboard HelloWorld SelfVoice Time MouseReview Date ByeCthulhu HelloCthulhu PluginManager CapsLockHack ClassicPreferences
cthulhu_pythondir=$(pkgpythondir)/plugins

View File

@ -204,16 +204,6 @@ class Script(script.Script):
cthulhu.quitCthulhu,
cmdnames.QUIT_CTHULHU)
self.inputEventHandlers["preferencesSettingsHandler"] = \
input_event.InputEventHandler(
cthulhu.showPreferencesGUI,
cmdnames.SHOW_PREFERENCES_GUI)
self.inputEventHandlers["appPreferencesSettingsHandler"] = \
input_event.InputEventHandler(
cthulhu.showAppPreferencesGUI,
cmdnames.SHOW_APP_PREFERENCES_GUI)
self.inputEventHandlers["cycleSettingsProfileHandler"] = \
input_event.InputEventHandler(
Script.cycleSettingsProfile,
@ -239,7 +229,9 @@ class Script(script.Script):
self.inputEventHandlers.update(self.learnModePresenter.get_handlers())
self.inputEventHandlers.update(self.mouseReviewer.get_handlers())
self.inputEventHandlers.update(self.actionPresenter.get_handlers())
cthulhu.getManager().getDynamicApiManager().registerAPI('inputEventHandlers',self.inputEventHandlers, overwrite=True)
cthulhu.getManager().getSignalManager().emitSignal('setup-inputeventhandlers-completed')
def getInputEventHandlerKey(self, inputEventHandler):
"""Returns the name of the key that contains an inputEventHadler
passed as argument

View File

@ -407,4 +407,4 @@ presentChatRoomLast = False
presentLiveRegionFromInactiveTab = False
# Plugins
activePlugins = ['Clipboard', 'MouseReview', 'Date', 'ByeCthulhu', 'Time', 'HelloCthulhu', 'HelloWorld', 'SelfVoice', 'PluginManager']
activePlugins = ['Clipboard', 'MouseReview', 'Date', 'ByeCthulhu', 'Time', 'HelloCthulhu', 'HelloWorld', 'SelfVoice', 'PluginManager', 'ClassicPreferences']