Commit 06644945 authored by Daiki Ueno's avatar Daiki Ueno

Remove python binding.

parent 1774a2c2
......@@ -16,4 +16,4 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
SUBDIRS = python vala
SUBDIRS = vala
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2011 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program 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
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
SUBDIRS = eekboard
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2011 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program 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
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
if ENABLE_PYTHON
pkgpython_PYTHON = \
__init__.py \
serializable.py \
symbol.py \
keysym.py \
text.py \
client.py \
context.py
endif
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2011 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program 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
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
from symbol import *
from keysym import *
from text import *
from serializable import *
from client import *
from context import *
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2011 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program 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
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
import dbus
import dbus.mainloop.glib
import gobject
from context import Context
dbus.mainloop.glib.DBusGMainLoop(set_as_default = True)
class Client(gobject.GObject):
__gtype_name__ = "PYEekboardClient"
__gsignals__ = {
'destroyed': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
())
}
def __init__(self):
super(Client, self).__init__()
self.__bus = dbus.SessionBus()
_service = self.__bus.get_object("org.fedorahosted.Eekboard",
"/org/fedorahosted/Eekboard")
self.__service = dbus.Interface(_service, dbus_interface="org.fedorahosted.Eekboard")
self.__service.connect_to_signal("Destroyed", self.__destroyed_cb)
def __destroyed_cb(self):
self.emit("destroyed")
def create_context(self, client_name):
object_path = self.__service.CreateContext(client_name)
return Context(self.__bus, object_path)
def push_context(self, context):
self.__service.PushContext(context.object_path)
def pop_context(self):
self.__service.PopContext()
def destroy_context(self, context):
self.__service.DestroyContext(context.object_path)
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2011 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program 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
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
import dbus
import gobject
import serializable
class Context(gobject.GObject):
__gtype_name__ = "PYEekboardContext"
__gsignals__ = {
'enabled': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
()),
'disabled': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
()),
'key-pressed': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gobject.TYPE_UINT)),
'destroyed': (
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
()),
}
__gproperties__ = {
'visible': (gobject.TYPE_BOOLEAN, 'Visible', 'Visible',
False, gobject.PARAM_READWRITE),
'keyboard': (gobject.TYPE_UINT, 'Keyboard', 'Keyboard',
0, gobject.G_MAXUINT, 0, gobject.PARAM_READWRITE),
'group': (gobject.TYPE_UINT, 'Group', 'Group',
0, gobject.G_MAXUINT, 0, gobject.PARAM_READWRITE),
}
def __init__(self, bus, object_path):
super(Context, self).__init__()
self.__bus = bus
self.__object_path = object_path
self.__properties = {}
_context = self.__bus.get_object("org.fedorahosted.Eekboard",
object_path)
self.__context = dbus.Interface(_context, dbus_interface="org.fedorahosted.Eekboard.Context")
self.__context.connect_to_signal('Enabled', self.__enabled_cb)
self.__context.connect_to_signal('Disabled', self.__disabled_cb)
self.__context.connect_to_signal('KeyActivated', self.__key_pressed_cb)
self.__context.connect_to_signal('Destroyed', self.__destroyed_cb)
self.__context.connect_to_signal('VisibilityChanged', self.__visibility_changed_cb)
self.__context.connect_to_signal('KeyboardChanged', self.__keyboard_changed_cb)
self.__context.connect_to_signal('GroupChanged', self.__group_changed_cb)
object_path = property(lambda self: self.__object_path)
def __enabled_cb(self):
self.emit('enabled')
def __disabled_cb(self):
self.emit('disabled')
def __key_pressed_cb(self, *args):
keyname = args[0]
symbol = serializable.deserialize_object(args[1])
modifiers = args[2]
self.emit('key-pressed', keyname, symbol, modifiers)
def __visibility_changed_cb(self, *args):
self.set_property('visible', args[0])
self.notify('visible')
def __keyboard_changed_cb(self, *args):
self.set_property('keyboard', args[0])
self.notify('keyboard')
def __group_changed_cb(self, *args):
self.set_property('group', args[0])
self.notify('group')
def __destroyed_cb(self):
self.emit("destroyed")
def do_set_property(self, pspec, value):
self.__properties[pspec.name] = value
def do_get_property(self, pspec):
return self.__properties.get(pspec.name, pspec.default_value)
def add_keyboard(self, keyboard_type):
return self.__context.AddKeyboard(keyboard_type)
def remove_keyboard(self, keyboard_id):
return self.__context.RemoveKeyboard(keyboard_id)
def set_keyboard(self, keyboard_id):
self.__context.SetKeyboard(keyboard_id)
def show_keyboard(self):
self.__context.ShowKeyboard()
def hide_keyboard(self):
self.__context.HideKeyboard()
def set_group(self, group):
self.__context.SetGroup(group)
def press_keycode(self, keycode):
self.__context.PressKeycode(keycode)
def release_keycode(self, keycode):
self.__context.ReleaseKeycode(keycode)
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2011 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program 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
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
import symbol
class Keysym(symbol.Symbol):
__gtype_name__ = "PYEekKeysym"
__NAME__ = "EekKeysym"
def __init__(self):
super(Keysym, self).__init__()
xkeysym = property(lambda self: self.__xkeysym)
def serialize(self, struct):
super(Keysym, self).serialize(struct)
struct.append(dbus.UInt32(self.__xkeysym))
def deserialize(self, struct):
super(Keysym, self).deserialize(struct)
self.__xkeysym = struct.pop(0)
# vim:set et sts=4 sw=4:
#
# ibus - The Input Bus
#
# Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2007-2010 Red Hat, 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 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 program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
__all__ = (
"Serializable",
"serialize_object",
"deserialize_object",
)
import dbus
import gobject
__serializable_name_dict = dict()
def serializable_register(classobj):
# if not issubclass(classobj, Serializable):
# raise "%s is not a sub-class of Serializable" % str(classobj)
__serializable_name_dict[classobj.__NAME__] = classobj
def serialize_object(o):
if isinstance(o, Serializable):
l = [o.__NAME__]
o.serialize(l)
return dbus.Struct(l)
else:
return o
def deserialize_object(v):
if isinstance(v, tuple):
struct = list(v)
type_name = struct.pop(0)
type_class = __serializable_name_dict[type_name]
o = type_class()
o.deserialize (struct)
return o
return v
class SerializableMeta(gobject.GObjectMeta):
def __init__(cls, name, bases, dict_):
super(SerializableMeta, cls).__init__(name, bases, dict_)
if "__NAME__" in cls.__dict__:
serializable_register(cls)
class Serializable(gobject.GObject):
__metaclass__ = SerializableMeta
__gtype_name__ = "PYEekSerializable"
__NAME__ = "EekSerializable"
def __init__(self):
super(Serializable, self).__init__()
def serialize(self, struct):
pass
def deserialize(self, struct):
pass
__serializable_name_dict["EekSerializable"] = Serializable
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2011 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program 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
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
import serializable
class Symbol(serializable.Serializable):
__gtype_name__ = "PYEekSymbol"
__NAME__ = "EekSymbol"
def __init__(self):
super(Symbol, self).__init__()
name = property(lambda self: self.__name)
label = property(lambda self: self.__label)
category = property(lambda self: self.__category)
modifier_mask = property(lambda self: self.__modifier_mask)
icon_name = property(lambda self: self.__icon_name)
def serialize(self, struct):
super(Symbol, self).serialize(struct)
struct.append(dbus.String(self.__name))
struct.append(dbus.String(self.__label))
struct.append(dbus.UInt32(self.__category))
struct.append(dbus.UInt32(self.__modifier_mask))
struct.append(dbus.String(self.__icon_name))
def deserialize(self, struct):
super(Symbol, self).deserialize(struct)
self.__name = struct.pop(0)
self.__label = struct.pop(0)
self.__category = struct.pop(0)
self.__modifier_mask = struct.pop(0)
self.__icon_name = struct.pop(0)
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2011 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program 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
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
import symbol
class Text(symbol.Symbol):
__gtype_name__ = "PYEekText"
__NAME__ = "EekText"
def __init__(self):
super(Text, self).__init__()
text = property(lambda self: self.__text)
def serialize(self, struct):
super(Text, self).serialize(struct)
struct.append(dbus.String(self.__text))
def deserialize(self, struct):
super(Text, self).deserialize(struct)
self.__text = struct.pop(0)
......@@ -185,38 +185,6 @@ if test -n "$focus_listeners"; then
AC_DEFINE(ENABLE_FOCUS_LISTENER, [1], [Define if eekboard can follow focus changes])
fi
dnl Python language binding
AC_MSG_CHECKING([whether you enable Python language support])
AC_ARG_ENABLE(python,
AS_HELP_STRING([--enable-python=no/yes],
[Enable Python language binding default=yes]),
enable_python=$enableval,
enable_python=yes)
dnl check python unconditionally to re-generate
dnl eek/*-keysym-labels.txt when maintainer-mode enabled
AM_PATH_PYTHON([2.5], , enable_python=no)
if test x"$enable_python" = x"yes"; then
if test x$enable_python = xyes; then
AC_PATH_PROGS(PYTHON_CONFIG, [python$PYTHON_VERSION-config python-config])
if test x"$PYTHON_CONFIG" != x""; then
PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
PYTHON_LIBS=`$PYTHON_CONFIG --libs`
else
PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
fi
PYTHON_INCLUDES="$PYTHON_CFLAGS"
AC_SUBST(PYTHON_CFLAGS)
AC_SUBST(PYTHON_INCLUDES)
AC_SUBST(PYTHON_LIBS)
fi
fi
AC_MSG_RESULT($enable_python)
AM_CONDITIONAL(ENABLE_PYTHON, [test x$enable_python = xyes])
GOBJECT_INTROSPECTION_CHECK([0.9.0])
dnl Vala langauge binding
......@@ -321,8 +289,6 @@ eekboard/Makefile
src/Makefile
tests/Makefile
bindings/Makefile
bindings/python/Makefile
bindings/python/eekboard/Makefile
bindings/vala/Makefile
docs/Makefile
docs/reference/Makefile
......@@ -359,7 +325,6 @@ Build options:
GTK version $with_gtk
Build Clutter UI $enable_clutter
Build Vala binding $enable_vala
Build Python binding $enable_python
Sound support $enable_libcanberra
Build document $enable_gtk_doc
Focus listeners $focus_listeners
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment