[orca] Add initial support for Smuxi (gnome frontend)
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add initial support for Smuxi (gnome frontend)
- Date: Sat, 29 Sep 2018 16:46:24 +0000 (UTC)
commit 40860bd844d68482be46dcfefe5856bf7c381a0a
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sat Sep 29 12:44:59 2018 -0400
Add initial support for Smuxi (gnome frontend)
configure.ac | 1 +
src/orca/scripts/apps/Makefile.am | 1 +
src/orca/scripts/apps/__init__.py | 1 +
.../scripts/apps/smuxi-frontend-gnome/Makefile.am | 6 ++
.../scripts/apps/smuxi-frontend-gnome/__init__.py | 20 ++++++
src/orca/scripts/apps/smuxi-frontend-gnome/chat.py | 49 +++++++++++++
.../scripts/apps/smuxi-frontend-gnome/script.py | 82 ++++++++++++++++++++++
7 files changed, 160 insertions(+)
---
diff --git a/configure.ac b/configure.ac
index 79d7e1930..3e2d04da0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,6 +116,7 @@ src/orca/scripts/apps/pidgin/Makefile
src/orca/scripts/apps/rhythmbox/Makefile
src/orca/scripts/apps/soffice/Makefile
src/orca/scripts/apps/SeaMonkey/Makefile
+src/orca/scripts/apps/smuxi-frontend-gnome/Makefile
src/orca/scripts/apps/Thunderbird/Makefile
src/orca/scripts/apps/xfwm4/Makefile
src/orca/scripts/terminal/Makefile
diff --git a/src/orca/scripts/apps/Makefile.am b/src/orca/scripts/apps/Makefile.am
index 5101d4b6e..787bf0e96 100644
--- a/src/orca/scripts/apps/Makefile.am
+++ b/src/orca/scripts/apps/Makefile.am
@@ -26,6 +26,7 @@ SUBDIRS = \
rhythmbox \
soffice \
SeaMonkey \
+ smuxi-frontend-gnome \
Thunderbird \
xfwm4
diff --git a/src/orca/scripts/apps/__init__.py b/src/orca/scripts/apps/__init__.py
index 95ecd9858..c0ef25cb6 100644
--- a/src/orca/scripts/apps/__init__.py
+++ b/src/orca/scripts/apps/__init__.py
@@ -28,5 +28,6 @@ __all__ = ['Banshee',
'rhythmbox',
'soffice',
'SeaMonkey',
+ 'smuxi-frontend-gnome',
'Thunderbird',
'xfwm4']
diff --git a/src/orca/scripts/apps/smuxi-frontend-gnome/Makefile.am
b/src/orca/scripts/apps/smuxi-frontend-gnome/Makefile.am
new file mode 100644
index 000000000..9bc84d75c
--- /dev/null
+++ b/src/orca/scripts/apps/smuxi-frontend-gnome/Makefile.am
@@ -0,0 +1,6 @@
+orca_python_PYTHON = \
+ __init__.py \
+ chat.py \
+ script.py
+
+orca_pythondir=$(pkgpythondir)/scripts/apps/smuxi-frontend-gnome
diff --git a/src/orca/scripts/apps/smuxi-frontend-gnome/__init__.py
b/src/orca/scripts/apps/smuxi-frontend-gnome/__init__.py
new file mode 100644
index 000000000..64560daa9
--- /dev/null
+++ b/src/orca/scripts/apps/smuxi-frontend-gnome/__init__.py
@@ -0,0 +1,20 @@
+# Orca
+#
+# Copyright 2018 Igalia, S.L.
+#
+# 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.
+
+from .script import Script
diff --git a/src/orca/scripts/apps/smuxi-frontend-gnome/chat.py
b/src/orca/scripts/apps/smuxi-frontend-gnome/chat.py
new file mode 100644
index 000000000..18ac1038c
--- /dev/null
+++ b/src/orca/scripts/apps/smuxi-frontend-gnome/chat.py
@@ -0,0 +1,49 @@
+# Orca
+#
+# Copyright 2018 Igalia, S.L.
+#
+# Author: Joanmarie Diggs <jdiggs igalia com>
+#
+# 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.
+
+"""Custom chat module for Smuxi."""
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2018 Igalia, S.L."
+__license__ = "LGPL"
+
+import pyatspi
+
+import orca.chat as chat
+
+
+class Chat(chat.Chat):
+
+ def __init__(self, script, buddyListAncestries):
+
+ super().__init__(script, buddyListAncestries)
+
+ def isFocusedChat(self, obj):
+ """Returns True if we plan to treat this chat as focused."""
+
+ isPageTab = lambda x: x and x.getRole() == pyatspi.ROLE_PAGE_TAB
+ pageTab = pyatspi.findAncestor(obj, isPageTab)
+ if pageTab is None:
+ return super().isFocusedChat(obj)
+
+ return pageTab.getState().contains(pyatspi.STATE_SHOWING)
diff --git a/src/orca/scripts/apps/smuxi-frontend-gnome/script.py
b/src/orca/scripts/apps/smuxi-frontend-gnome/script.py
new file mode 100644
index 000000000..dbc235731
--- /dev/null
+++ b/src/orca/scripts/apps/smuxi-frontend-gnome/script.py
@@ -0,0 +1,82 @@
+# Orca
+#
+# Copyright 2018 Igalia, S.L.
+#
+# Author: Joanmarie Diggs <jdiggs igalia com>
+#
+# 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.
+
+"""Custom script for Smuxi."""
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2018 Igalia, S.L."
+__license__ = "LGPL"
+
+import pyatspi
+
+import orca.scripts.toolkits.GAIL as GAIL
+from .chat import Chat
+
+class Script(GAIL.Script):
+
+ def __init__(self, app):
+ """Creates a new script for the given application."""
+
+ # So we can take an educated guess at identifying the buddy list.
+ self._buddyListAncestries = [[pyatspi.ROLE_TREE_TABLE,
+ pyatspi.ROLE_SCROLL_PANE,
+ pyatspi.ROLE_SPLIT_PANE,
+ pyatspi.ROLE_SPLIT_PANE,
+ pyatspi.ROLE_FILLER,
+ pyatspi.ROLE_FRAME]]
+
+ super().__init__(app)
+
+ def getChat(self):
+ """Returns the 'chat' class for this script."""
+
+ return Chat(self, self._buddyListAncestries)
+
+ def setupInputEventHandlers(self):
+ """Defines InputEventHandler fields for this script."""
+
+ super().setupInputEventHandlers()
+ self.inputEventHandlers.update(self.chat.inputEventHandlers)
+
+ def getAppKeyBindings(self):
+ """Returns the application-specific keybindings for this script."""
+
+ return self.chat.keyBindings
+
+ def getAppPreferencesGUI(self):
+ """Return a GtkGrid containing the application unique configuration."""
+
+ return self.chat.getAppPreferencesGUI()
+
+ def getPreferencesFromGUI(self):
+ """Returns a dictionary with the app-specific preferences."""
+
+ return self.chat.getPreferencesFromGUI()
+
+ def onTextInserted(self, event):
+ """Called whenever text is added to an object."""
+
+ if self.chat.presentInsertedText(event):
+ return
+
+ super().onTextInserted(event)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]