Python and XKB [WAS: Re: [Sugar-devel] XO-1 keyboard issues, partial setxkbmap workaround]

Sayamindu Dasgupta sayamindu at gmail.com
Thu Mar 26 21:12:08 UTC 2009


Hello,

On Thu, Mar 26, 2009 at 2:50 PM, Martin Dengler
<martin at martindengler.com> wrote:
> On Thu, Mar 26, 2009 at 03:23:39AM +0530, Sayamindu Dasgupta wrote:
>> On Wed, Mar 25, 2009 at 10:10 PM, Martin Dengler
>> <martin at martindengler.com> wrote:
>> > On Sat, Mar 21, 2009 at 04:26:17AM +0530, Sayamindu Dasgupta wrote:
>> >> [olpc set /etc/sysconfig/keyboard from OFW's data and had no UI for
>> >> keyboard configuration]
>> >
>> > We could just get rid of the keyboard configure GUI and have people
>> > edit the file still (and automatically maintain it as you suggest).
>> > The range of choices available in the config file is huge, and I'm not
>> > sure what it really adds to give people a very limited UI.
>> >
>>
>> But that will work only on the XO :-).
>
> Define "work" :).  Editing a file works everywhere.  Editing a file
> that's maintained by the distribution (SoaS) works everywhere in that
> distro.
>

Oops - sorry, I missed out the "people editing the file part" :-). (I
should really go to sleep early on some days)

I have just pushed an initial edition of pyxkb to Git:
http://git.sugarlabs.org/projects/python-xkb

It works for me (though it may crash if you don't use it under ideal
circumstances).
Some examples:

#Get a list of all the layouts
pyxkb.get_layouts()

#Get a list of all variant for the 'us' layout:
pyxkb.get_variants_for_layout('us')

#Get the enabled layouts:
pyxkb.get_current_layouts()

#Enable 'us(olpc2)' and 'af(olpc-ps)' layout:
pyxkb.set_layouts(['us', 'es'])
pyxkb.set_variants(['olpc2', 'olpc-ps'])


I think the above should be sufficient to implement a basic keyboard
configuration control panel extension for Sugar.

Thanks,
Sayamindu

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




More information about the Fedora-olpc-list mailing list