On Sat, Nov 1, 2008 at 9:08 AM, Korakurider <[EMAIL PROTECTED]> wrote:
> Hi.
>
> I have difficulty to make Japanese input method (SCIM-anthy) work on 8.2-767.
> Input method can't be activated on activity window even if hit
> Ctrl-Space (IME on/off switch).
> After some experiment I found that IME can be activated if activity
> isolation is disabled.
> If isolation is enabled, I can activate IME only in terminal activity.
> Any clue to make it work even with isolation?
>
> Sayamindu,
> Just a quick report though ...
> I also tested ibus-anthy.
> Now installation is straightforward with yum.
> While it is also affected by isolation, I can activate it and input
> Japanese string
> into activity window.
>


Could you replace the attached files in your XO (/usr/bin/olpc-session
and /usr/lib/python2.5/site-packages/rainbow/service.py) and test ?
(ideally rainbow should be enabled)

I tested with scim-anthy, and it works for me (to be on the safe side,
edit ~/.i18n and set it to en_US.UTF-8)

All activities seem to work, except for Scratch and Etoys. Maybe you
can understand better what is happening here ?

Thanks,
Sayamindu



-- 
Sayamindu Dasgupta
[http://sayamindu.randomink.org/ramblings]

Attachment: olpc-session
Description: Binary data

import os
from signal import SIGCHLD
from time import time

import gobject

import dbus
import dbus.service
import dbus.bus
import dbus.mainloop.glib

from rainbow import util, inject, permissions
from rainbow.util.linux.clone import clone, CLONE_NEWNS
from rainbow.gc import gc_spool

SPOOL = '/home/olpc/isolation/1'

def log(msg, *args):
    if len(args):
        print msg % args
    else:
        print msg

class Rainbow(dbus.service.Object):
    """The Rainbow security service."""
    SERVICE_NAME = 'org.laptop.security.Rainbow'
    INTERFACE_NAME = 'org.laptop.security.Rainbow'

    def __init__(self, bus_or_name):
        dbus.service.Object.__init__(self, bus_or_name, '/')
        self.preloader_hint = True
        self.preload_common_modules()

    def _get_lang(self):
        first_line = open('/home/olpc/.i18n').readline()
        name, value = first_line.strip().split('=')
        value = value.strip('"')
        assert name == 'LANG'
        # See NOTES -- "Security risks in preforking."
        assert len(value) < 64 and all(s.isalnum() or s in "[EMAIL PROTECTED]" for s in value)
        return value

    def preload_common_modules(self):
        # Import-time logic is quite sensitive to environment variables.
        os.environ['XAUTHORITY'] = inject._XAUTHORITY
        os.environ['ICEAUTHORITY'] = inject._ICEAUTHORITY
        # Are we never going to want to launch python activities attached to other
        # displays? <MS>
        os.environ['DISPLAY'] = ':0'
        os.environ['GTK2_RC_FILES'] = '/usr/share/sugar/data/sugar-xo.gtkrc'

	os.environ['XMODIFIERS'] = '@im=SCIM'
	os.environ['GTK_IM_MODULE'] = 'xim'
	os.environ['USE_XOPENIM'] = 't'

        # There are all sorts of reasons why we might be unable to read a
        # language setting. _get_lang()'s job is to make sure that all of them
        # are represented as exceptions. <MS>
        try: os.environ['LANG'] = self._get_lang()
        except: util.trace()

        imports = ('dbus.service',
                   'dbus.decorators',
                   'telepathy',
                   'sugar.activity.activity',
                   'sugar.activity.activityservice',
                   'sugar.graphics.style',
                   'sugar.graphics.window',
                  )

        start_time = time()

        for module in imports:
            try:
                __import__(module)
            except:
                print 'Exception when preloading module: %s' % module
                self.preloader_hint = False
                util.trace()
                break

        if self.preloader_hint:
            try:
                import gtk
                display = gtk.gdk.display_get_default()
                display.close() # This needs to happen after importing s.g.style
            except:
                print 'Exception when preloading module: gtk'
                self.preloader_hint = False
                util.trace()

        print 'Module preloading took %f seconds.' % (time() - start_time)


    @dbus.service.method(INTERFACE_NAME,
                         in_signature='s')
    def ChangeActivity(self, activity_id):
        """Sets CPU throttling on the foreground and background activities as needed."""
        pass

    @dbus.service.method(INTERFACE_NAME,
                         in_signature='sa{ss}asss',
                         async_callbacks=('success_cont', 'error_cont'),
                         utf8_strings=True)
    def CreateActivity(self, log_path, env, argv, bundle_path, bundle_id,
                       success_cont, error_cont):
        # Reap zombies
        try:
            while os.waitpid(-1, os.WNOHANG) != (0,0):
                pass
        except OSError:
            pass

        try:
            f = open(os.path.join(bundle_path, 'activity', 'permissions.info'))
            pset = permissions.PermissionSet(f)
            f.close()
        except:
            pset = permissions.PermissionSet([])

        # XXX: Dirty hack -- pass 'constant-uid' in as a permission. <MS>
        pset._permissions['constant-uid'] = pset.has_permission('constant-uid') or bool(env.get('RAINBOW_CONSTANT_UID'))

        try:
            child_pid = clone(CLONE_NEWNS | SIGCHLD)
            if not child_pid:
                try:
                    # Close the connection to the system bus.
                    self.connection.close()

                    try: log_fd = os.open(log_path, os.O_WRONLY | os.O_SYNC | os.O_CREAT)
                    except: log_fd = os.open('/dev/null', os.O_WRONLY)
                    os.dup2(log_fd, 1)
                    os.dup2(log_fd, 2)
                    ret = inject.run(log, SPOOL, env, argv, env['SUGAR_BUNDLE_PATH'], pset, (1, 2),
                            env.get('RAINBOW_STRACE_LOG'), 500, 500, bundle_path, bundle_id, self.preloader_hint)
                except Exception, e:
                    util.trace()
                    error_cont(e)
                finally:
                    os._exit(255)

            success_cont()

        except Exception, e:
            util.trace()
            error_cont(e)

def run(opts, args):
    """Start the Rainbow DBus service."""
    log("GC'ing spool %s", SPOOL)
    try: gc_spool(log, SPOOL)
    except: util.trace()

    loop = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

    # Seems like we need to set this before we create a connection, or the old
    # value would persist after the fork.
    os.environ['DBUS_SESSION_BUS_ADDRESS'] = 'unix:path=/tmp/olpc-session-bus'

    bus = dbus.SystemBus(private=True, mainloop=loop)
    name = dbus.service.BusName(Rainbow.SERVICE_NAME, bus)
    Rainbow(name)

    print 'Service running mainloop.'
    mainloop = gobject.MainLoop()
    mainloop.run()
_______________________________________________
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel

Reply via email to