Development

Alex Burr edited this page Mar 10, 2015 · 9 revisions

Developing kano-toolset

This repository contains a number of very diverse tools implemented in different languages, some of which are independent, others are part of KanoOS apps, and therefore they rely on them.

Hands on

The best way to develop is to read through the README file if available, or jump straight into the source code for those that are simple enough.

Remember that all the code is to be run on an ARM architecture, therefore you need a RaspberryPI or equivalent and a Debian based Linux system. The complete package can be build on a ARM root jail as well.

kano-keys-pressed

In KanoOS we needed a way to detect a special key sequence during bootup, which enabled us to switch to a safe display mode. This tool resolves this problem.

The Linux keyboard driver provides an IOCTL called EVIOCGKEY known as Get Input Keys Status. This facility basically means that the currently pressed keys on the keyboard can be determined with a single system call.

Since the call returns immediately, this tool provides 2 extra parameters (delay and repeat values) so that we can give some time for the user to hold these keys during the bootup process.

You can learn more about EVIOCGKEY facility in the Linux Kernel sources, in Documentation/input/input-programming.txt.

kano-splash

kano-splash is a tool which displays a splash screen when our apps are started. Much of the code is based on the hard work of Andrew Duncan. It uses the dispmanx API to display a png file over the X11 screen. Usage information can be found in its README file.

kano-launcher

Since many apps are resource hungry, and our younger users may not be sophisticated enough to realise that an app is running poorly because another app has been left open, we call our apps through a tool, kano-launcher, which closes the other apps. This restriction is lifted on the Raspberry Pi 2 platform, which has enough resources to leave apps running. For more information on kano-launcher, see its README file.

kano python modules

Kano toolset python modules provide for several general use aids for the desktop UI. The two most remarkable ones are window and webapp

Window: Manipulate desktop apps windows

Allows you to manipulate desktop windows on the desktop: position, size, decoration. It adds the capability to wait for the window to appear on the desktop, to avoid visual flickering noise.

Practical usage example:

  1. Launch xcalc from a terminal, it will appear centered on the desktop
  2. Tell kano toolset to move the Calculator to the top left corner of the screen
from kano import window
calc=window.find_window(title=‘Calculator’)
window.gdk_window_settings(calc, x=0, y=0)

WebApp: A simple yet powerful web browser

Based on the Webkit engine, it makes it very easy to get a fully working browser on the Desktop with minimal effort.

Here’s a quick example:

#!/usr/bin/python
#
# Kano Toolset opening a fully fledged Web browser

from kano.webapp import WebApp

class MyBrowser(WebApp):
    def __init__(self):
        super(MyBrowser, self).__init__()
        self._index='http://world.kano.me'
        self._title='My first browser'
        self._width=600
        self._height=400
        self._y=5
        self._x=800

if __name__ == '__main__':
    w = MyBrowser()
    w.run()

This will open a browser window on the desktop which will render the world.kano.me page.

An extra powerful feature is the ability to inject Javascript code into the browser by using an external unix pipe. Try this on the terminal when the the above browser is up and running:

echo "alert(\"Hello Kano\")" > /tmp/webapp.pipe

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.