A simple file structure of python applications on maemo/n800:
helloword
helloword.desktop
helloword.service
helloword.png
setup.py
Note:
1. Main source file helloworld is written in python, but it must be named without ".py".
2. helloworld.desktop and helloworld.service are used for adding and linking the executable source file helloworld to the application menu of N800.
3. helloworld.png is the icon displayed in application menu.
4. setup.py is used for installing the four files above into N800. It is the only file that you can name it arbitrarily.
Necessary sentences in helloworld:
- import osso
- osso_c = osso.Context("com.nokia.helloworld", "1.0.0", False)
All sentences in helloworld.desktop:
- [Desktop Entry]
- Version=1.0.0
- Encoding=UTF-8
- Type=Application
- Name=Hello world
- Exec=/usr/bin/helloworld
- Icon=helloworld
- X-Osso-Service=helloworld
- X-Osso-Type=application/x-executable
All sentences in helloworld.service:
- [D-BUS Service]
- Name=com.nokia.helloworld
- Exec=/usr/bin/helloworld
All sentences in setup.py:
- #!/usr/bin/env python2.5
- from distutils.core import setup
- setup(
- name='helloworld',
- version='1.0.0',
- scripts=['helloworld'],
- data_files = [
- ('share/icons', ['helloworld.png']),
- ('share/applications/hildon', ['helloworld.desktop']),
- ('share/dbus-1/services', ['helloworld.service']),
- ]
- )
Be careful of those service names underlined and in red, which may result in fatel errors due to a little miss of coherence. Meanwhile, you can try any other combinations of those names, which however, is not recommanded.
What's more, make sure that there is not even one single space at the end of each line in .service and .desktop files.
To install the helloworld application onto maemo:
- [sbox-SDK_X86: ~helloworld-1.0.0] > python2.5 setup.py install
To install it onto N800 device:
- [sbox-SDK_X86: ~helloworld-1.0.0] dh_make
- [sbox-SDK_X86: ~helloworld-1.0.0] dpkg-buildpackage -rfakeroot -b
Remember to change debian/control. See article "Installing packages to N800 from sources".
本文介绍了如何使用Python为Maemo/N800设备创建并打包应用程序,包括必要的文件结构、配置示例及安装指令等内容。

被折叠的 条评论
为什么被折叠?



