特殊:Badtitle/NS100:UMEGuide/ApplicationDevelopment/PortingAnAppToUME:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
第6行: | 第6行: | ||
This shows how to port an application (gPodder) to Ubuntu Mobile. gPodder media aggregator is a podcast receiver/catcher written in Python utilizing PyGTK for its graphical interface. gPodder is very lightweight and doesn't have many dependencies. A great part of the porting effort is spent making an application use and obey the Hildon UI style of windows and menu's | This shows how to port an application (gPodder) to Ubuntu Mobile. gPodder media aggregator is a podcast receiver/catcher written in Python utilizing PyGTK for its graphical interface. gPodder is very lightweight and doesn't have many dependencies. A great part of the porting effort is spent making an application use and obey the Hildon UI style of windows and menu's | ||
== Assumed Knowledge == | == Assumed Knowledge == | ||
You have set up the UME development environment as show [[UbuntuWiki:MobileAndEmbedded/CreatingAnImageForUMEDevice|here]]. Also that you can change the Flash UI as explained [http://ianlawrence.info/random-stuff/location-services-on-ubuntu-mobile here]. | You have set up the UME development environment as show [[UbuntuWiki:MobileAndEmbedded/CreatingAnImageForUMEDevice|here]].|Also that you can change the Flash UI as explained [http://ianlawrence.info/random-stuff/location-services-on-ubuntu-mobile here]. | ||
'''Dependencies Needed''' | '''Dependencies Needed''' | ||
gPodder has the following dependencies on Ubuntu: | gPodder has the following dependencies on Ubuntu: | ||
第34行: | 第34行: | ||
<code><nowiki>apt-get install python-xml</nowiki></code> | <code><nowiki>apt-get install python-xml</nowiki></code> | ||
After this executes it executes OK in the terminal so lets test it by clicking the gpodder image and see what happens | After this executes it executes OK in the terminal so lets test it by clicking the gpodder image and see what happens | ||
https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder1.png | {{https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder1.png%7D%7D | ||
this presents the gpodder UI | this presents the gpodder UI | ||
https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder-ume.png | {{https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder-ume.png%7D%7D | ||
It seems ok but it is not 'Hildonized' yet | It seems ok but it is not 'Hildonized' yet | ||
== Hildonize Step 1 == | == Hildonize Step 1 == | ||
第92行: | 第92行: | ||
<property name="urgency_hint">False</property></nowiki></pre> | <property name="urgency_hint">False</property></nowiki></pre> | ||
and put it in the new <code><nowiki>Hildonwindow(self.window)</nowiki></code> that was just created in gpodder.py like this : | and put it in the new <code><nowiki>Hildonwindow(self.window)</nowiki></code> that was just created in gpodder.py like this : | ||
<pre><nowiki> | <pre><nowiki> | ||
self.window = hildon.Window() | |||
self.window.set_title(self.gPodder.get_title()) | self.window.set_title(self.gPodder.get_title()) | ||
#****** start of the added code ****** | #****** start of the added code ****** | ||
第120行: | 第121行: | ||
self.window.show_all()</nowiki></pre> | self.window.show_all()</nowiki></pre> | ||
Gives the final version | Gives the final version | ||
https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder-hildon-menu.png | {{https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder-hildon-menu.png%7D%7D | ||
which can be downloaded here: | which can be downloaded here: | ||
https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder-ume.tar | [[https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder-ume.tar%5D%5D | ||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2008年10月19日 (日) 17:50的版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/af | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|Afrikaans| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/ar | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|العربية| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/az | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|azərbaycanca| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/bcc | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|جهلسری بلوچی| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/bg | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|български| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/br | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|brezhoneg| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/ca | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|català| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/cs | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|čeština| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/de | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|Deutsch| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/el | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|Ελληνικά| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/es | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|español| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/fa | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|فارسی| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/fi | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|suomi| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/fr | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|français| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/gu | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|ગુજરાતી| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/he | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|עברית| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/hu | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|magyar| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/id | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|Bahasa Indonesia| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/it | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|italiano| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/ja | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|日本語| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/ko | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|한국어| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/ksh | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|Ripoarisch| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/mr | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|मराठी| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/ms | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|Bahasa Melayu| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/nl | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|Nederlands| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/no | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|norsk| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/oc | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|occitan| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/pl | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|polski| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/pt | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|português| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/ro | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|română| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/ru | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|русский| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/si | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|සිංහල| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/sq | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|shqip| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/sr | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|српски / srpski| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/sv | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|svenska| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/th | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|ไทย| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/tr | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|Türkçe| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/vi | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|Tiếng Việt| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/yue | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|粵語| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/zh | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|中文| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/zh-hans | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|中文(简体)| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME | {{#if: | :}}UMEGuide/ApplicationDevelopment/PortingAnAppToUME}}/zh-hant | • {{#if: UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|中文(繁體)| [[::UMEGuide/ApplicationDevelopment/PortingAnAppToUME/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :UMEGuide/ApplicationDevelopment/PortingAnAppToUME/zh | | {{#ifexist: UMEGuide/ApplicationDevelopment/PortingAnAppToUME/zh | | {{#ifeq: {{#titleparts:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:UMEGuide/ApplicationDevelopment/PortingAnAppToUME|1|-1|}} | zh | | }}
This follows on from the tutorial Using a Glade UI with Python to create a UME/Hildon app For more background info also read the excellent maemo tutorial for porting python applications to the Hildon framework. This is the canonical URL for this tutorial.
Objective
This shows how to port an application (gPodder) to Ubuntu Mobile. gPodder media aggregator is a podcast receiver/catcher written in Python utilizing PyGTK for its graphical interface. gPodder is very lightweight and doesn't have many dependencies. A great part of the porting effort is spent making an application use and obey the Hildon UI style of windows and menu's
Assumed Knowledge
You have set up the UME development environment as show here.|Also that you can change the Flash UI as explained here. Dependencies Needed gPodder has the following dependencies on Ubuntu: python-glade2 python-feedparser apt-get install both of them in the target filesystem.
Get the Source Code and try it out on UME
Download and extract the source package from the project's page. The code changes are made in the gpodder-0.8.0/src/gpodder/gpodder.py file. On the target filesystem change the UI so that it displays the gpodder image and move the expanded gpodder folder to the target filesystem (I renamed it to gpodder-orig) like this:
user@machine:~/Dev/Ume/ports$ sudo cp -R gpodder-orig /home/ian/Dev/Ume/olpcimage/targets/metahacker/fs/home/
Maybe gpodder will be ok without too many changes so lets install it by:
user@machine:/home/gpodder-orig# python setup.py install
In the target filesystem terminal:
export DISPLAY=:0 (to save typing this every time you open a target filesystem shell from moblin you can add this line to .bashrc) /etc/init.d/dbus start xinit /etc/X11/xinit/xinitrc -- /usr/bin/Xephyr :2 -host-cursor -screen 1024x600x32 -dpi 96 -ac
executing gpodder
in the terminal gave an error of
from xml.sax.saxutils import DefaultHandler
so in the terminal
apt-get install python-xml
After this executes it executes OK in the terminal so lets test it by clicking the gpodder image and see what happens
{{https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder1.png%7D%7D
this presents the gpodder UI
{{https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder-ume.png%7D%7D
It seems ok but it is not 'Hildonized' yet
Hildonize Step 1
The first code change in the porting exercise is to make gPodder use HildonProgram
and HildonWindow
classes instead of the GtkWindow
class.
Start by modifying the gpodder.py file (in the gpodder-orig/src/gpodder directory). To use Hildon elements, you have to import its module. The following illustrates the import:
from libipodsync import gPodder_iPodSync from libipodsync import ipod_supported # ****** start of the added code ****** import hildon # ****** end of the added code ****** # for isDebugging: import libgpodder
Note: if this errors apt-get install python2.5-hildon python2.5-hildon-dev
Next, add a HildonProgram(self.app)
and a HildonWindow(self.window)
:
if libgpodder.isDebugging(): print "A new %s has been created" % self.__class__.__name__ #****** start of the added code ****** self.app = hildon.Program() self.window = hildon.Window() self.window.set_title(self.gPodder.get_title()) self.app.add_window(self.window) self.vMain.reparent(self.window) self.gPodder.destroy() self.window.show_all() #****** end of the added code ****** #self.gPodder.set_title( self.gPodder.get_title()) #self.statusLabel.set_text( "Welcome to gPodder! Suggestions? Mail to: [email protected]") # set up the rendering of the comboAvailable combobox
The gPodder class (self)
has its close_gpodder
method connected to the destroy signal from the original gPodder
Gtk window. In the glade file remove the connection:
Original version
user@machine:/home/gpodder-orig/data# nano gpodder.glade <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="focus_on_map">True</property> <property name="urgency_hint">False</property> <signal name="destroy" handler="close_gpodder" last_modification_time="Sat, 29 Oct 2005 11:54:40 GMT"/>
Hildon Version
user@machine:/home/gpodder-hildon/data# nano gpodder.glade <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="focus_on_map">True</property> <property name="urgency_hint">False</property>
and put it in the new Hildonwindow(self.window)
that was just created in gpodder.py like this :
self.window = hildon.Window() self.window.set_title(self.gPodder.get_title()) #****** start of the added code ****** self.window.connect("destroy", self.close_gpodder) #****** end of the added code ****** self.app.add_window(self.window) self.vMain.reparent(self.window)
Note: above you can see two different versions gpodder-orig and gpodder-hildon in the target filesystem. To install a different version just remove the old version by;
user@machine:/home/gpodder-hildon/src/gpodder# cd /usr/lib/python2.5/site-packages/ user@machine:/usr/lib/python2.5/site-packages# rm -R gpodder-0.8.0.egg-info gpodder
and then do a python setup.py install on the new version (also remember to change the file /usr/share/gpodder/gpodder.glade if you need to for things like dialogues etc)
Hildonize Step 2
To use Hildon's title area as its menu bar, instead of using the GTK+ menu (a GTKMenuBar
object) alter gpodder.py again. Before doing this have a look in the gpodder.glade file, you can see that the gPodder
window has a menu bar (a GTKMenuBar
object) called mainMenu
The code below moves all its children (menuPodcasts, menuChannels and menuHelp
) to the HildonWindow's
menu and then destroys the empty mainMenu
menu
self.vMain.reparent(self.window) self.gPodder.destroy() #****** start of the added code ****** menu = gtk.Menu() for child in self.mainMenu.get_children(): child.reparent(menu) self.window.set_menu(menu) self.mainMenu.destroy() #****** end of the added code self.window.show_all()
Gives the final version {{https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder-hildon-menu.png%7D%7D which can be downloaded here: [[https://help.ubuntu.com/community/UMEGuide/ApplicationDevelopment/PortingAnAppToUME?action=AttachFile&do=get&target=gpodder-ume.tar%5D%5D