mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
misc/ibus: Updated for version 1.5.16.
Signed-off-by: Heinz Wiesinger <pprkut@slackbuilds.org>
This commit is contained in:
parent
391f717f74
commit
7fdca74bde
10 changed files with 102 additions and 575 deletions
|
@ -8,6 +8,12 @@ ibus as your primary input method, you should remove the scim package.
|
|||
|
||||
If you use qt applications, then you probably want ibus-qt as well.
|
||||
|
||||
After installing, ibus will automatically be started in an xdg-compliant
|
||||
desktop environment; if this behavior is undesirable, you can disable it
|
||||
using your DE's session and/or startup management utility.
|
||||
To enable ibus put the following lines in your ~/.bashrc file:
|
||||
|
||||
export GTK_IM_MODULE=ibus
|
||||
export XMODIFIERS=@im=ibus
|
||||
export QT_IM_MODULE=ibus
|
||||
|
||||
ibus is pre-configured to autostart on xdg-compliant desktop environments
|
||||
if these settings are present. On other desktop environments you can add
|
||||
"ibus-autostart" to the respective autostart settings.
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
=================
|
||||
ibus auto-startup
|
||||
=================
|
||||
The ibus package has an ibus.desktop file in /etc/xdg/autostart/, so if your
|
||||
desktop environment is xdg compatible and the $XDG_CONFIG_DIRS is not set, ibus
|
||||
will be automatically launched during startup of the your DE after you have
|
||||
logged in. If you don't want to remove ibus package and want use other input
|
||||
method programs (like SCIM), you can place an ibus.desktop file in your personal
|
||||
autostart directory (most likely ~/.config/autostart/) which contains the key
|
||||
Hidden=true. You'll also want to make the ibus profile scripts non-executable:
|
||||
|
||||
chmod -x /etc/profile.d/ibus.{csh,sh}
|
||||
|
||||
If your DE is not xdg compatible (what a pity..), you can add the following
|
||||
to your shell init files (~/.profile, ~/.bash_profile, ~/.zprofile, etcetera):
|
||||
|
||||
if [ -x /usr/bin/ibus-daemon ]; then
|
||||
/usr/bin/ibus-daemon --xim &
|
||||
fi
|
||||
|
||||
=============================
|
||||
environment variable settings
|
||||
=============================
|
||||
chmod +x /etc/profile.d/ibus.{sh,csh} will enable environment variable settings
|
||||
at login, but if you have ibus-qt installed, you may also prefer to run
|
||||
qtconfig and set "Default Input Method" to ibus.
|
||||
|
||||
=====================
|
||||
integration with KDE4
|
||||
=====================
|
||||
Add ``--panel=/usr/share/ibus/ui/kimpanel/panel.py`` parameter to ibus when you
|
||||
run ibus-daemon. For example, you can append it to the "Exec" entry in
|
||||
/etc/xdg/autostart/ibus.desktop or any .desktop file you created for launching
|
||||
ibus. Then add "kimpanel" plasmaiod to your panel or dashboard. Restart ibus,
|
||||
you will see it shining out there.
|
|
@ -1,53 +1,20 @@
|
|||
config() {
|
||||
NEW="$1"
|
||||
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
||||
# If there's no config file by that name, mv it over:
|
||||
if [ ! -r $OLD ]; then
|
||||
mv $NEW $OLD
|
||||
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
|
||||
# toss the redundant copy
|
||||
rm $NEW
|
||||
fi
|
||||
# Otherwise, we leave the .new copy for the admin to consider...
|
||||
}
|
||||
|
||||
preserve_perms() {
|
||||
NEW="$1"
|
||||
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
||||
if [ -e $OLD ]; then
|
||||
cp -a $OLD ${NEW}.incoming
|
||||
cat $NEW > ${NEW}.incoming
|
||||
mv ${NEW}.incoming $NEW
|
||||
fi
|
||||
config $NEW
|
||||
}
|
||||
|
||||
preserve_perms etc/profile.d/ibus.sh.new
|
||||
preserve_perms etc/profile.d/ibus.csh.new
|
||||
|
||||
schema_install() {
|
||||
GCONF_CONFIG_SOURCE="xml::etc/gconf/gconf.xml.defaults" \
|
||||
chroot . gconftool-2 --makefile-install-rule "$1" 1>/dev/null
|
||||
}
|
||||
|
||||
SCHEMA_FILE="etc/gconf/schemas/ibus.schemas"
|
||||
if [ -r "$SCHEMA_FILE" ]; then
|
||||
schema_install "$SCHEMA_FILE"
|
||||
fi
|
||||
|
||||
if [ -x /usr/bin/update-desktop-database ]; then
|
||||
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ -x usr/bin/update-gtk-immodules ]; then
|
||||
chroot . /usr/bin/update-gtk-immodules --verbose 1>/dev/null
|
||||
fi
|
||||
|
||||
if [ -e usr/share/glib-2.0/schemas ]; then
|
||||
if [ -x /usr/bin/glib-compile-schemas ]; then
|
||||
/usr/bin/glib-compile-schemas usr/share/glib-2.0/schemas >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
|
||||
if [ -x /usr/bin/gtk-update-icon-cache ]; then
|
||||
/usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run gtk-query-immodules so that "ibus" will appear under Input Method
|
||||
# when you right- click your mouse in a text box.
|
||||
if [ -x usr/bin/update-gtk-immodules ]; then
|
||||
chroot . /usr/bin/update-gtk-immodules --verbose 1>/dev/null
|
||||
fi
|
||||
|
||||
|
|
23
misc/ibus/ibus-autostart
Normal file
23
misc/ibus/ibus-autostart
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
START="no"
|
||||
|
||||
if [ "$XIM" = "ibus" ]; then
|
||||
START="yes"
|
||||
fi
|
||||
|
||||
if [ "$XIM_PROGRAM" = "ibus" ]; then
|
||||
START="yes"
|
||||
fi
|
||||
|
||||
if [ "$GTK_IM_MODULE" = "ibus" ]; then
|
||||
START="yes"
|
||||
fi
|
||||
|
||||
if [ "$QT_IM_MOFULE" = "ibus" ]; then
|
||||
START="yes"
|
||||
fi
|
||||
|
||||
if [ "$START" = "yes" ]; then
|
||||
ibus-daemon -drx
|
||||
fi
|
32
misc/ibus/ibus-autostart.desktop
Normal file
32
misc/ibus/ibus-autostart.desktop
Normal file
|
@ -0,0 +1,32 @@
|
|||
[Desktop Entry]
|
||||
Name=IBus
|
||||
Name[de]=IBus
|
||||
Name[es]=IBus
|
||||
Name[ja]=IBus
|
||||
Name[zh_CN]=IBus
|
||||
Name[zh_TW]=IBus
|
||||
Name[ko]=IBus
|
||||
GenericName=Input Method
|
||||
GenericName[de]=Eingabemethode
|
||||
GenericName[es]=Método de entrada
|
||||
GenericName[ja]=入力メソッド
|
||||
GenericName[zh_CN]=输入法
|
||||
GenericName[zh_TW]=輸入法
|
||||
GenericName[ko]=입력 방법
|
||||
Comment=Start Input Method
|
||||
Comment[de]=Eingabemethode starten
|
||||
Comment[ja]=入力メソッドを開始
|
||||
Comment[zh_CN]=启动输入法
|
||||
Comment[zh_TW]=啓動輸入法
|
||||
Comment[ko]=입력기 시작
|
||||
Exec=ibus-autostart
|
||||
Icon=ibus
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=System;Utility;
|
||||
StartupNotify=false
|
||||
X-GNOME-Autostart-Phase=Applications
|
||||
X-GNOME-AutoRestart=false
|
||||
X-GNOME-Autostart-Notify=false
|
||||
X-KDE-autostart-after=panel
|
||||
X-KDE-StartupNotify=false
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# Copyright 2006,2007,2008 Eric Hameleers, Eindhoven, NL
|
||||
# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN USA
|
||||
# Copyright 2017 Heinz Wiesinger, Amsterdam, The Netherlands
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for
|
||||
|
@ -28,8 +29,8 @@
|
|||
# Feedback (especially improvements) is encouraged! :-)
|
||||
|
||||
PRGNAM=ibus
|
||||
VERSION=${VERSION:-1.3.9}
|
||||
BUILD=${BUILD:-2}
|
||||
VERSION=${VERSION:-1.5.16}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
|
@ -59,13 +60,6 @@ TMP=${TMP:-/tmp/SBo}
|
|||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
USE_GCONF=${USE_GCONF:-"yes"}
|
||||
if [ "$USE_GCONF" = "yes" ]; then
|
||||
conf_opt="--enable-gconf"
|
||||
else
|
||||
conf_opt="--disable-gconf --enable-memconf"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf $PKG
|
||||
|
@ -81,48 +75,36 @@ find -L . \
|
|||
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
||||
-exec chmod 644 {} \;
|
||||
|
||||
cat $CWD/emoji-test.txt > emoji-test.txt
|
||||
|
||||
# fix libdir
|
||||
sed -i "s|/lib/python|/lib$LIBDIRSUFFIX/python|g" ./configure
|
||||
|
||||
CFLAGS="$SLKCFLAGS" \
|
||||
CXXFLAGS="$SLKCFLAGS" \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
||||
--sysconfdir=/etc \
|
||||
--localstatedir=/var \
|
||||
--with-html-dir=/usr/share/gtk-doc/html \
|
||||
$conf_opt \
|
||||
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
||||
--localstatedir=/var/lib \
|
||||
--mandir=/usr/man \
|
||||
--enable-python-library \
|
||||
--with-unicode-emoji-dir=$TMP/$PRGNAM-$VERSION \
|
||||
--build=$ARCH-slackware-linux
|
||||
|
||||
make
|
||||
make DESTDIR=$PKG install
|
||||
make install-strip DESTDIR=$PKG
|
||||
|
||||
# Add kimpanel support, panel.py is harvested from
|
||||
# http://websvn.kde.org/tags/KDE/4.4.3/kdeplasma-addons/applets/kimpanel/backend/ibus/panel.py
|
||||
mkdir $PKG/usr/share/ibus/ui/kimpanel
|
||||
cp $CWD/panel.py $PKG/usr/share/ibus/ui/kimpanel
|
||||
chmod 0755 $PKG/usr/share/ibus/ui/kimpanel/panel.py
|
||||
# Link the icon to where kimpanel will look for.
|
||||
cd $PKG/usr/share/ibus/icons
|
||||
ln -s ../../icons/hicolor/scalable/apps/ibus.svg .
|
||||
cd -
|
||||
mkdir -p $PKG/etc/xdg/autostart
|
||||
install -m 755 $CWD/ibus-autostart $PKG/usr/bin/
|
||||
install -m 644 $CWD/ibus-autostart.desktop $PKG/etc/xdg/autostart/
|
||||
|
||||
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
||||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
# Add profile scripts that set up the environment:
|
||||
mkdir -p $PKG/etc/profile.d
|
||||
cat $CWD/profile.d/ibus.csh > $PKG/etc/profile.d/ibus.csh.new
|
||||
cat $CWD/profile.d/ibus.sh > $PKG/etc/profile.d/ibus.sh.new
|
||||
chmod 0755 $PKG/etc/profile.d/*
|
||||
# cleanup temporary files
|
||||
rm -rf $PKG/usr/lib$LIBDIRSUFFIX/python2.7/site-packages/gi
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a \
|
||||
AUTHORS COPYING ChangeLog NEWS README \
|
||||
cp -a AUTHORS ChangeLog COPYING* INSTALL NEWS README \
|
||||
$PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
||||
cat $CWD/README.SBO > $PKG/usr/doc/$PRGNAM-$VERSION/README.SBO
|
||||
cd $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
ln -s ../../share/gtk-doc/html/ibus html
|
||||
cd -
|
||||
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
PRGNAM="ibus"
|
||||
VERSION="1.3.9"
|
||||
VERSION="1.5.16"
|
||||
HOMEPAGE="https://github.com/ibus/ibus/wiki"
|
||||
DOWNLOAD="https://github.com/ibus/ibus/releases/download/1.3.9/ibus-1.3.9.tar.gz"
|
||||
MD5SUM="57345a3c1cfe37ce3825f6221676dcfe"
|
||||
DOWNLOAD="https://github.com/ibus/ibus/releases/download/1.5.16/ibus-1.5.16.tar.gz \
|
||||
http://www.unicode.org/Public/emoji/4.0/emoji-test.txt"
|
||||
MD5SUM="31ea7c1259c7285bd9d71f3000cbd95b \
|
||||
965fe35c4db4401cb9644ebb6251df55"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES="pyxdg"
|
||||
MAINTAINER="Grissiom"
|
||||
EMAIL="chaos.proton@gmail.com"
|
||||
REQUIRES="json-glib cldr-emoji-annotation"
|
||||
MAINTAINER="Heinz Wiesinger"
|
||||
EMAIL="pprkut@liwjatan.at"
|
||||
|
|
|
@ -1,417 +0,0 @@
|
|||
#! /usr/bin/env python
|
||||
# vim:set et sts=4 sw=4:
|
||||
#
|
||||
# ibus-panel-dbus - Another panel for ibus
|
||||
#
|
||||
# Copyright (c) 2009 Wang Hoi <zealot.hoi@gmail.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 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
|
||||
|
||||
#IBUS_SERVICE_KIMPANEL = "org.freedesktop.IBus.Panel.KIM"
|
||||
#IBUS_PATH_KIMPANEL = "/org/freedesktop/IBus/Panel/KIM"
|
||||
|
||||
from ibus import *
|
||||
from ibus.panel import *
|
||||
from ibus.bus import Bus
|
||||
from ibus.inputcontext import InputContext
|
||||
from ibus import keysyms
|
||||
#import ibus.interface
|
||||
import gtk
|
||||
import dbus
|
||||
|
||||
IBUS_ICON_DIR = '/usr/share/ibus/icons/'
|
||||
|
||||
from gettext import dgettext
|
||||
_ = lambda a : dgettext("ibus", a)
|
||||
N_ = lambda a : a
|
||||
|
||||
def prop2string(prop):
|
||||
__prop_key = '/IBus/'+prop.get_key()
|
||||
__prop_label = prop.get_label().get_text()
|
||||
__prop_icon = prop.get_icon()
|
||||
__prop_tip = prop.get_tooltip().get_text()
|
||||
|
||||
# workaround
|
||||
if len(__prop_icon)==0:
|
||||
# the setup icon
|
||||
if (prop.get_key()=='setup'):
|
||||
__prop_icon = 'configure'
|
||||
|
||||
__prop = __prop_key + ':' + __prop_label + ':' + __prop_icon + ':' + __prop_tip
|
||||
return __prop
|
||||
|
||||
class KIMIbusClient(dbus.service.Object):
|
||||
def __init__(self, object_path):
|
||||
dbus.service.Object.__init__(self, dbus.SessionBus(), object_path)
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='s')
|
||||
def ExecDialog(self, prop):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='as')
|
||||
def ExecMenu(self, props):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='as')
|
||||
def RegisterProperties(self, props):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='s')
|
||||
def UpdateProperty(self, prop):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='s')
|
||||
def RemoveProperty(self, prop):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='b')
|
||||
def Enable(self, b):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='b')
|
||||
def ShowAux(self, b):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='b')
|
||||
def ShowPreedit(self, b):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='b')
|
||||
def ShowLookupTable(self, b):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='asasasbb')
|
||||
def UpdateLookupTable(self, labels,items,xs,bool1,bool2):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='i')
|
||||
def UpdatePreeditCaret(self, pos):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='ss')
|
||||
def UpdatePreeditText(self, test, attr):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='ss')
|
||||
def UpdateAux(self, test, attr):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='ii')
|
||||
def UpdateSpotLocation(self, x, y):
|
||||
pass
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.ibus.panel',
|
||||
signature='i')
|
||||
def UpdateScreen(self, id):
|
||||
pass
|
||||
|
||||
class KIMPanel(PanelBase):
|
||||
def __init__(self):
|
||||
self.__bus = Bus()
|
||||
self.__bus.connect("disconnected", gtk.main_quit)
|
||||
super(KIMPanel, self).__init__(self.__bus)
|
||||
self.__bus.request_name(IBUS_SERVICE_PANEL, 0)
|
||||
self.__session_bus = dbus.SessionBus()
|
||||
#self.__kimproxy = self.__session_bus.get_object('org.kde.impanel',
|
||||
# '/org/kde/impanel')
|
||||
#self.__kimifce = dbus.Interface(self.__kimproxy,
|
||||
# 'org.kde.impanel')
|
||||
self.__session_bus.add_signal_receiver(self.kim_trigger_property,
|
||||
signal_name='TriggerProperty',
|
||||
dbus_interface='org.kde.impanel')
|
||||
self.__session_bus.add_signal_receiver(self.kim_panel_created,
|
||||
signal_name='PanelCreated',
|
||||
dbus_interface='org.kde.impanel')
|
||||
self.__session_bus.add_signal_receiver(self.kim_reload_config,
|
||||
signal_name='ReloadConfig',
|
||||
dbus_interface='org.kde.impanel')
|
||||
self.__session_bus.add_signal_receiver(gtk.main_quit,
|
||||
signal_name='Exit',
|
||||
dbus_interface='org.kde.impanel')
|
||||
self.__session_bus.add_signal_receiver(self.page_up,
|
||||
signal_name='LookupTablePageUp',
|
||||
dbus_interface='org.kde.impanel')
|
||||
self.__session_bus.add_signal_receiver(self.page_down,
|
||||
signal_name='LookupTablePageDown',
|
||||
dbus_interface='org.kde.impanel')
|
||||
self.__session_bus.add_signal_receiver(self.kim_select_candidate,
|
||||
signal_name='SelectCandidate',
|
||||
dbus_interface='org.kde.impanel')
|
||||
|
||||
self.__kimclient = KIMIbusClient('/org/ibus/panel')
|
||||
|
||||
self.__focus_ic = None
|
||||
|
||||
self.__logo_prop = Property(key='Logo', label='IBus', icon=IBUS_ICON_DIR + '/ibus.svg', tooltip='IBus input method')
|
||||
self.__about_prop = Property(key='About', label=_('IBus intelligent input bus'), icon='help-about')
|
||||
self.__about_prop.set_tooltip(_("IBus is an intelligent input bus for Linux/Unix.\n\nHuang Peng <shawn.p.huang@gmail.com>"))
|
||||
self.__prop_map = {}
|
||||
|
||||
self.__im_menu = []
|
||||
|
||||
def focus_in(self,ic):
|
||||
self.__focus_ic = InputContext(self.__bus, ic)
|
||||
enabled = self.__focus_ic.is_enabled()
|
||||
|
||||
if not enabled:
|
||||
self.__logo_prop.icon = IBUS_ICON_DIR + '/ibus.svg'
|
||||
else:
|
||||
engine = self.__focus_ic.get_engine()
|
||||
if engine:
|
||||
self.__logo_prop.icon = engine.icon
|
||||
else:
|
||||
self.__logo_prop.icon = IBUS_ICON_DIR + '/ibus.svg'
|
||||
|
||||
self.__kimclient.UpdateProperty(prop2string(self.__logo_prop))
|
||||
|
||||
def state_changed(self):
|
||||
print 'state_changed'
|
||||
if not self.__focus_ic:
|
||||
return
|
||||
|
||||
enabled = self.__focus_ic.is_enabled()
|
||||
|
||||
if enabled == False:
|
||||
self.__reset()
|
||||
self.__logo_prop.set_icon(IBUS_ICON_DIR + 'ibus.svg')
|
||||
else:
|
||||
engine = self.__focus_ic.get_engine()
|
||||
if engine:
|
||||
self.__logo_prop.set_icon(engine.icon)
|
||||
else:
|
||||
self.__logo_prop.set_icon(IBUS_ICON_DIR + 'ibus.svg')
|
||||
self.__kimclient.UpdateProperty(prop2string(self.__logo_prop))
|
||||
|
||||
def focus_out(self,ic):
|
||||
#self.__focus_ic = None
|
||||
self.__logo_prop.icon = IBUS_ICON_DIR + '/ibus.svg'
|
||||
self.__kimclient.UpdateProperty(prop2string(self.__logo_prop))
|
||||
|
||||
def set_cursor_location(self, x, y, w, h):
|
||||
#print 'set_cursor_location',x,y,w,h
|
||||
self.__kimclient.UpdateSpotLocation(x+w,y+h)
|
||||
|
||||
def update_preedit_text(self, text, cursor_pos, visible):
|
||||
print 'update_preedit_text',cursor_pos,visible
|
||||
self.__kimclient.UpdatePreeditText(text.get_text(),'')
|
||||
self.__kimclient.UpdatePreeditCaret(cursor_pos)
|
||||
if visible:
|
||||
self.show_preedit_text()
|
||||
else:
|
||||
self.hide_preedit_text()
|
||||
|
||||
def show_preedit_text(self):
|
||||
print 'show_preedit_text'
|
||||
self.__kimclient.ShowPreedit(1)
|
||||
|
||||
def hide_preedit_text(self):
|
||||
print 'hide_preedit_text'
|
||||
self.__kimclient.ShowPreedit(0)
|
||||
|
||||
def update_auxiliary_text(self, text, visible):
|
||||
#print 'update_auxiliary_text',visible
|
||||
self.__kimclient.UpdateAux(text.get_text(),'')
|
||||
if visible:
|
||||
self.show_auxiliary_text()
|
||||
else:
|
||||
self.hide_auxiliary_text()
|
||||
|
||||
def show_auxiliary_text(self):
|
||||
print 'show_auxiliary_text'
|
||||
self.__kimclient.ShowAux(1)
|
||||
|
||||
def hide_auxiliary_text(self):
|
||||
print 'hide_auxiliary_text'
|
||||
self.__kimclient.ShowAux(0)
|
||||
|
||||
def update_lookup_table(self, lookup_table, visible):
|
||||
if lookup_table == None:
|
||||
lookup_table = LookupTable()
|
||||
|
||||
self.__lookup_table = lookup_table
|
||||
|
||||
self.__labels = []
|
||||
self.__candis = []
|
||||
self.__attrs = []
|
||||
i = 0
|
||||
for text_obj in lookup_table.get_candidates_in_current_page():
|
||||
i=i+1
|
||||
if i==10:
|
||||
i=0
|
||||
self.__labels.append(str(i))
|
||||
self.__candis.append(text_obj.get_text())
|
||||
self.__attrs.append('')
|
||||
|
||||
self.__kimclient.UpdateLookupTable(self.__labels,
|
||||
self.__candis,self.__attrs,dbus.Boolean(1),dbus.Boolean(lookup_table.get_current_page_size() <= lookup_table.get_page_size()))
|
||||
|
||||
if visible:
|
||||
self.show_lookup_table()
|
||||
else:
|
||||
self.hide_lookup_table()
|
||||
|
||||
|
||||
def show_lookup_table(self):
|
||||
print 'show_lookup_table'
|
||||
self.__kimclient.ShowLookupTable(1)
|
||||
|
||||
def hide_lookup_table(self):
|
||||
print 'hide_lookup_table'
|
||||
self.__kimclient.ShowLookupTable(0)
|
||||
|
||||
def cursor_up_lookup_table(self):
|
||||
print 'cursor_up_lookup_table'
|
||||
|
||||
def cursor_down_lookup_table(self):
|
||||
print 'cursor_down_lookup_table'
|
||||
|
||||
def show_candidate_window(self):
|
||||
print 'show_candidate_window'
|
||||
|
||||
def hide_candidate_window(self):
|
||||
print 'hide_candidate_window'
|
||||
|
||||
def show_language_bar(self):
|
||||
print 'show_language_bar'
|
||||
|
||||
def hide_language_bar(self):
|
||||
print 'hide_language_bar'
|
||||
|
||||
def register_properties(self, props):
|
||||
print 'register_properties'
|
||||
__props = []
|
||||
__props.append(prop2string(self.__logo_prop))
|
||||
for prop in props.get_properties():
|
||||
__props.append(prop2string(prop))
|
||||
__prop_key = '/IBus/'+prop.get_key()
|
||||
#self.__prop
|
||||
__props.append(prop2string(self.__about_prop))
|
||||
|
||||
self.__kimclient.RegisterProperties(__props)
|
||||
|
||||
def update_property(self, prop):
|
||||
print 'update_property'
|
||||
self.__kimclient.UpdateProperty(prop2string(prop))
|
||||
|
||||
def get_status_icon(self):
|
||||
print 'get_status_icon'
|
||||
|
||||
# begin of signal handler
|
||||
|
||||
def kim_panel_created(self):
|
||||
print 'KIM: panel created'
|
||||
|
||||
def kim_reload_config(self):
|
||||
print 'KIM: reload config'
|
||||
|
||||
def kim_trigger_property(self,prop):
|
||||
print 'KIM: trigger property'
|
||||
if prop.startswith('/IBus/'):
|
||||
__prop_key = prop[6:]
|
||||
if __prop_key == 'Logo':
|
||||
self.__im_menu = self.__create_im_menu()
|
||||
self.__kimclient.ExecMenu(map(prop2string,self.__im_menu))
|
||||
elif __prop_key == 'About':
|
||||
self.__kimclient.ExecDialog(prop2string(self.__about_prop))
|
||||
elif __prop_key.startswith('Engine/'):
|
||||
self.__reset()
|
||||
__prop_key = __prop_key[7:]
|
||||
if __prop_key == 'None':
|
||||
self.__focus_ic.disable()
|
||||
else:
|
||||
engines = self.__bus.list_active_engines()
|
||||
for engine in engines:
|
||||
print engine.name
|
||||
if engine.name == __prop_key:
|
||||
print 'matched engine'
|
||||
self.__focus_ic.set_engine(engine)
|
||||
else:
|
||||
self.property_activate(__prop_key,PROP_STATE_CHECKED)
|
||||
|
||||
def kim_select_candidate(self,index):
|
||||
print 'select_candidate:Implement me!'
|
||||
# dirty hack
|
||||
#if self.__focus_ic:
|
||||
# #engine = self.__focus_ic.get_engine()
|
||||
# #if engine:
|
||||
# # print 'select_candidate',index
|
||||
# self.__focus_ic.process_key_event(keysyms._1,0)
|
||||
pass
|
||||
|
||||
def __reset(self):
|
||||
self.hide_auxiliary_text()
|
||||
self.hide_preedit_text()
|
||||
self.hide_lookup_table()
|
||||
|
||||
def __create_im_menu(self):
|
||||
engines = self.__bus.list_active_engines()
|
||||
|
||||
tmp = {}
|
||||
for engine in engines:
|
||||
lang = get_language_name(engine.language)
|
||||
if lang not in tmp:
|
||||
tmp[lang] = []
|
||||
tmp[lang].append(engine)
|
||||
|
||||
langs = tmp.keys()
|
||||
other = tmp.get(_("Other"), [])
|
||||
if _("Other") in tmp:
|
||||
langs.remove(_("Other"))
|
||||
langs.append(_("Other"))
|
||||
|
||||
im_menu = []
|
||||
|
||||
for lang in langs:
|
||||
if len(tmp[lang]) == 1:
|
||||
engine = tmp[lang][0]
|
||||
item = Property(key='Engine/'+engine.name)
|
||||
item.set_label("%s - %s" % (lang, engine.longname))
|
||||
if engine.icon:
|
||||
item.set_icon(engine.icon)
|
||||
else:
|
||||
item.set_icon("engine-default")
|
||||
print prop2string(item)
|
||||
im_menu.append(item)
|
||||
else:
|
||||
pass
|
||||
|
||||
item = Property(key='Engine/None',label=_('Disable'),icon=IBUS_ICON_DIR+'/ibus.svg')
|
||||
im_menu.append(item)
|
||||
|
||||
return im_menu
|
||||
|
||||
|
||||
def launch_panel():
|
||||
panel = KIMPanel()
|
||||
gtk.main()
|
||||
|
||||
if __name__ == "__main__":
|
||||
launch_panel()
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/csh
|
||||
|
||||
# ibus - Intelligent Input Bus for Linux / Unix OS. This is used to support the
|
||||
# entering of text in non-US-English languages.
|
||||
|
||||
[ -x /usr/bin/ibus-daemon ]
|
||||
if ($status == 0) then
|
||||
# Enable legacy X applications to use ibus:
|
||||
setenv XMODIFIERS "@im=ibus"
|
||||
# Enable Qt/KDE applications to use ibus.
|
||||
setenv QT_IM_MODULE "ibus"
|
||||
# Enable GTK applications to use ibus:
|
||||
setenv GTK_IM_MODULE "ibus"
|
||||
# Make ibus start automatically if the "magic key" Ctrl-Space is pressed:
|
||||
setenv XIM_PROGRAM "/usr/bin/ibus-daemon -xdrt"
|
||||
endif
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# ibus - Intelligent Input Bus for Linux / Unix OS. This is used to support the
|
||||
# entering of text in non-US-English languages.
|
||||
|
||||
if [ -x /usr/bin/ibus-daemon ]; then
|
||||
# Enable legacy X applications to use ibus:
|
||||
export XMODIFIERS="@im=ibus"
|
||||
# Enable Qt/KDE applications to use ibus.
|
||||
export QT_IM_MODULE="ibus"
|
||||
# Enable GTK applications to use ibus:
|
||||
export GTK_IM_MODULE="ibus"
|
||||
# Make ibus start automatically if the "magic key" Ctrl-Space is pressed:
|
||||
export XIM_PROGRAM="/usr/bin/ibus-daemon -xdrt"
|
||||
fi
|
||||
|
Loading…
Reference in a new issue