Editing PyPackager

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-
For developers without a Linux-background and supporting hardware, getting into development on Maemo is most easily achieved by using [[PyMaemo]], the Python port for Maemo. Check the website for more information on how to program - this wiki page only explains how to properly integrate your python app into the Maemo desktop environment.
+
For developers without a Linux-background and supporting hardware, getting into development on Maemo is most easily achieved by using [http://pymaemo.garage.maemo.org/ PyMaemo], the Python port for Maemo. Check the website for more information on how to program - this wiki page only explains how to properly integrate your python app into the Maemo desktop environment.
Once you have a python application, you need to properly structure your source directory and add some additional files to achieve maximum Maemo/Hildon desktop integration. This document shall explain this, using the [http://maemo.org/downloads/product/OS2008/mclock/ mClock] build process as an example.
Once you have a python application, you need to properly structure your source directory and add some additional files to achieve maximum Maemo/Hildon desktop integration. This document shall explain this, using the [http://maemo.org/downloads/product/OS2008/mclock/ mClock] build process as an example.
Line 52: Line 52:
=== mClock.desktop file ===
=== mClock.desktop file ===
-
 
+
<nowiki>[Desktop Entry]</nowiki>
-
{{main|Desktop file format}}
+
Version=1.0.0 '''Version of this file, NOT of the app. Keep it at 1.0.0'''
-
 
+
Encoding=UTF-8
-
<pre>[Desktop Entry]
+
Name=mClock '''Name of the app as seen in Menu'''
-
# Version of this file, NOT of the app. Keep it at 1.0.0
+
Comment=Clock & day/night map '''Description of the app as seen as subtitle in Menu in Finger mode '''
-
Version=1.0.0
+
Exec=/usr/bin/mClock '''Link to the app'''
-
Encoding=UTF-8
+
Icon=mclock '''Name of our icon file, without the trailing .png part'''
-
# Name of the app as seen in Menu
+
X-Icon-path=/usr/share/icons '''Path to the icon'''
-
Name=mClock
+
X-Window-Icon=mclock '''Name of our icon file, without the trailing .png part (again?!)'''
-
# Description of the app as seen as subtitle in Menu in Finger mode
+
Type=Application
-
Comment=Clock & day/night map
+
X-Osso-Service=com.nokia.mclock '''MUST begin with com.nokia. due to a bug, anything else WONT work'''
-
# Link to the app
+
X-Osso-Type=application/x-executable
-
Exec=/usr/bin/mClock
+
StartupWMClass=mClock '''Only needed because it's a PyGame app (would be automatic with GTK)'''
-
# Name of our icon file, without the trailing .png part
+
-
Icon=mclock
+
-
# Path to the icon
+
-
X-Icon-path=/usr/share/icons
+
-
# Name of our icon file, without the trailing .png part (again?!)
+
-
X-Window-Icon=mclock
+
-
Type=Application
+
-
# MUST begin with com.nokia. due to a bug, anything else will NOT work
+
-
X-Osso-Service=com.nokia.mclock
+
-
X-Osso-Type=application/x-executable
+
-
# Only needed because it's a PyGame app (would be automatic with GTK)
+
-
StartupWMClass=mClock
+
-
</pre>
+
=== mclock.service ===
=== mclock.service ===
-
 
All lower case just to be sure. Very simple content:
All lower case just to be sure. Very simple content:
-
<pre>
+
<nowiki>[D-BUS Service]</nowiki>
-
[D-BUS Service]
+
Name=com.nokia.mclock '''MUST begin with com.nokia. due to a bug, anything else WONT work'''
-
# MUST begin with com.nokia. due to a bug, anything else will NOT work
+
Exec=/usr/bin/mClock '''Link to the app'''
-
Name=com.nokia.mclock
+
-
# Link to the app
+
-
Exec=/usr/bin/mClock
+
-
</pre>
+
=== mClock.py===
=== mClock.py===
-
 
Some important snippets from my code...
Some important snippets from my code...
The first one is to be set as early as wanted, it will make sure that the "Loading..." banner disappers. Only needed because this is a pure pygame app right now, wouldn't be needed when using GTK!
The first one is to be set as early as wanted, it will make sure that the "Loading..." banner disappers. Only needed because this is a pure pygame app right now, wouldn't be needed when using GTK!
-
<source lang="python">
+
import os
-
import os
+
<nowiki>os.environ["SDL_VIDEO_X11_WMCLASS"]="mClock"</nowiki>
-
os.environ["SDL_VIDEO_X11_WMCLASS"]="mClock"
+
-
</source>
+
Later on, we need to connect to our osso service or the service daemon will kill our application!
Later on, we need to connect to our osso service or the service daemon will kill our application!
-
<source lang="python">
+
osso_c = osso.Context("mclock", "0.2.1", False)
-
osso_c = osso.Context("mclock", "0.2.1", False)
+
-
</source>
+
(However, don't ask me IF that version string has ANY relevance, I don't know)
(However, don't ask me IF that version string has ANY relevance, I don't know)
=== mclock.pypackager===
=== mclock.pypackager===
-
 
The saved pypackager file that contains my package definition. You can copy that into a text file and then load it from PyPackager to get my build configuration:
The saved pypackager file that contains my package definition. You can copy that into a text file and then load it from PyPackager to get my build configuration:
-
<pre>
+
(S'mClock'
-
(S'mClock'
+
S'0.5.5'
-
S'0.5.5'
+
S'user/other'
-
S'user/other'
+
S'all'
-
S'all'
+
S'Optional'
-
S'Optional'
+
S'Tom Waelti <twaelti@gmail.com>'
-
S'Tom Waelti <twaelti@gmail.com>'
+
S'python2.5 (>= 2.5.1-1osso5),  python2.5-osso, python2.5-gnome (>= 2.18.0-1osso3)'
-
S'python2.5 (>= 2.5.1-1osso5),  python2.5-osso, python2.5-gnome (>= 2.18.0-1osso3)'
+
S'A simple clock for maemo, incl. a day/night world map.\nPress D-Pad or bottom left to switch view mode.\nESC to exit.\nLeft/right D-Pad (or touching l/r border of screen)\nto change season. '
-
S'A simple clock for maemo, incl. a day/night world map.\nPress D-Pad or bottom left to switch view mode.\nESC to exit.\nLeft/right D-Pad (or touching l/r border of screen)\nto change season. '
+
S'/home/user/MyDocs/mclock-src'
-
S'/home/user/MyDocs/mclock-src'
+
S'/home/user/MyDocs/mClock.png'
-
S'/home/user/MyDocs/mClock.png'
+
S''
-
S''
+
S''
-
S''
+
S'#!/bin/sh\ntouch /usr/lib/python2.5/site-packages/gnome/__init__.py\n'
-
S'#!/bin/sh\ntouch /usr/lib/python2.5/site-packages/gnome/__init__.py\n'
+
S''
-
S''
+
S''
-
S''
+
S'extras'
-
S'extras'
+
S'chinook'
-
S'chinook'
+
S'low'
-
S'low'
+
S'email@email.com'
-
S'email@email.com'
+
S''
-
S''
+
S''
-
S''
+
S'login'
-
S'login'
+
S'1'
-
S'1'
+
tp1
-
tp1
+
.
-
.
+
-
</pre>
+
[[Category:Development]]
[[Category:Development]]
-
[[Category:Python]]
 

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)

Templates used on this page: