Introduction to Application Development  in Python and Gtk+ / Hildon @ Maemo 5 + my very own experience by Amanda Lam Hong...
Self Introduction <ul><li>BEng Computer Systems Engineering, University of Warwick, UK </li></ul><ul><li>Technical Writer ...
Maemo Devices <ul><li>Nokia Internet Tablets: </li></ul><ul><ul><li>Nokia 770  Maemo 1.x/OS2005 Maemo 2.x/OS2006 </li></ul...
Maemo’s Application Frameworks <ul><li>Maemo 1.x – 4.x </li></ul><ul><ul><li>Based on the Gtk+ / Hildon application framew...
So, what is Gtk+? <ul><li>Highly usable, feature rich toolkit for creating graphical user interfaces which boasts cross pl...
Where did Gtk+ come from? <ul><li>Originated from the  GIMP  (GNU Image Manipulation Program) project by Spencer Kimball a...
Language Bindings supported by Gtk+ <ul><li>Gtk+ is written in C </li></ul><ul><li>Bindings  are provided for programmers ...
Who use Gtk+? <ul><li>Environments </li></ul><ul><li>GNOME, Xfce, LXDE… </li></ul><ul><li>Access Linux Platform (ALP) </li...
Then, what is Hildon? <ul><li>Application framework developed by Nokia </li></ul><ul><li>Now part of GNOME </li></ul><ul><...
Where Hildon sits in the Maemo Architecture?
Hildon 2.2 UI Components
Mixed use of Hildon and Gtk+  UI Components in Maemo <ul><li>Most Hildon classes are inherited from Gtk+ classes </li></ul...
What programming languages can I use to develop Maemo applications? <ul><li>C & C++ (GCC 4.2) </li></ul><ul><li>Python 2.5...
I use Python. But why Python? <ul><li>Because… </li></ul><ul><ul><li>I am C-phobic! </li></ul></ul><ul><ul><li>I am just a...
Little History of <ul><li>Since 1989 </li></ul><ul><li>By  Guido van Rossum , a Dutch computer programmer, now a Google em...
Maemo Applications written in Python <ul><li>gPodder Podcast Client </li></ul><ul><li>Gonvert </li></ul><ul><li>Hermes </l...
How does Python code look like?
Let’s run the Hello World program!
Class Definition Example
My Maemo Applications <ul><li>Written in Python and Gtk+/Hildon, of course. </li></ul><ul><li>Support both landscape and p...
eSpeakGUI Client: UI Components A set of hildon.PickerButtons in a gtk.HBox A set of hildon.GtkButtons in a gtk.VBox hildo...
eSpeakGUI Client: UI Components hildon.TouchSelector
eSpeakGUI Client: How does it speak? <ul><li>eSpeak is an open-source, command-line Text-to-Speech utility </li></ul><ul><...
eSpeakGUI Client: Demonstration
Stroke Order Chinese Input Method: UI Components hildon.StackWindow hildon. TouchSelector hildon.TextView in a hildon.Pann...
Stroke Order Chinese Input Method: UI Components hildon.AppMenu containing hildon.GtkButtons
Stroke Order Chinese Input Method: The Use of <ul><li>Characters and associated phrases are stored in a SQLite 3 database....
Stroke Order Chinese Input Method: Accessing C-compiled libraries directly <ul><li>Not all features are available via bind...
Stroke Order Chinese Input Method: Demonstration
Get your hands dirty! <ul><li>Q:  What tools do you need to develop Python applications on the Maemo platform? </li></ul><...
Glade – Gtk+ RAD tool <ul><li>Drag-and-drop controls to build up a GUI app </li></ul><ul><li>Not aware of Hildon controls ...
Illumination Software Creator <ul><li>Define variables, GUI components and action blocks visually. </li></ul><ul><li>Gener...
PyGtkEditor on Maemo <ul><li>Open, edit, and run Python code directly on your Maemo device! </li></ul><ul><li>Support synt...
I decide to develop Maemo apps in Python, do I still need Maemo SDK? <ul><li>You can write Python programs that run on Mae...
Will my Python/Gtk+/Hildon apps work in MeeGo? <ul><li>Well, maybe. Expect modifications though. </li></ul><ul><li>MeeGo i...
MeeGo Architecture
Gtk+ Support in MeeGo Handset UX <ul><li>Zwong tested a Gtk+ app on MeeGo Handset UX and confirmed that it somehow works p...
I want to develop apps for the MeeGo platform – shall I choose Gtk+, or Qt? <ul><li>Of course, the answer is… </li></ul><u...
References for you to get started <ul><li>Python programming on Maemo </li></ul><ul><li>http:// wiki.maemo.org/PyMaemo </l...
Thank you! <ul><li>Questions are welcome. </li></ul><ul><li>Please join the  Hong Kong Maemo / Moblin / MeeGo User Group  ...
References <ul><li>Pictures and some text of this presentation were obtained from: </li></ul><ul><ul><li>Gimp.org </li></u...
Upcoming SlideShare
Loading in...5
×

Introduction to Application Development in Python and Gtk+ / Hildon @ Maemo 5

1,817

Published on

Introduction to Application Development in Python and Gtk+ / Hildon @ Maemo 5 + my very own experience

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,817
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction to Application Development in Python and Gtk+ / Hildon @ Maemo 5

  1. 1. Introduction to Application Development in Python and Gtk+ / Hildon @ Maemo 5 + my very own experience by Amanda Lam Hong Kong Maemo / Moblin / MeeGo User Group
  2. 2. Self Introduction <ul><li>BEng Computer Systems Engineering, University of Warwick, UK </li></ul><ul><li>Technical Writer of a popular local website company </li></ul><ul><li>Founder of the Hong Kong Maemo / Moblin / MeeGo User Group @ facebook </li></ul><ul><li>Executive Committee Member and Podcaster of the Hong Kong PDA User Group (HKPUG) </li></ul><ul><li>Voluntary News Editor of UMPCFever.com / Digital.XY.HK </li></ul><ul><li>Author of the first Maemo 4.1 and Maemo 5 Traditional Chinese Language Pack </li></ul><ul><li>Application Developer of: </li></ul><ul><ul><li>EeeToggle for Windows </li></ul></ul><ul><ul><li>eSpeak GUI Client for Maemo 5 </li></ul></ul><ul><ul><li>Stroke Order Chinese Input Method ( 筆劃輸入法 ) for Maemo 5 </li></ul></ul>
  3. 3. Maemo Devices <ul><li>Nokia Internet Tablets: </li></ul><ul><ul><li>Nokia 770 Maemo 1.x/OS2005 Maemo 2.x/OS2006 </li></ul></ul><ul><ul><li>Nokia N800 & N810 Maemo 3.x / “Bora” / OS2007 Maemo 4.0 / “Chinook” / OS2008 Maemo 4.1 / “Diablo” / OS2008 </li></ul></ul><ul><ul><li>Nokia N900 Maemo 5 / “Fremantle” / OS2009 </li></ul></ul><ul><li>myInteractiveDevice (myID) </li></ul><ul><ul><li>Maemo 4.x Compatible </li></ul></ul><ul><li>ZhongYi 眾一 S101 </li></ul><ul><ul><li>Maemo 4.x Compatible </li></ul></ul>
  4. 4. Maemo’s Application Frameworks <ul><li>Maemo 1.x – 4.x </li></ul><ul><ul><li>Based on the Gtk+ / Hildon application framework </li></ul></ul><ul><li>Maemo 5 </li></ul><ul><ul><li>Based on the Gtk+ / Hildon application framework </li></ul></ul><ul><ul><li>Support of Qt 4.5 since PR1.0 </li></ul></ul><ul><ul><li>Support of Qt 4.6 since PR1.2 </li></ul></ul><ul><li>i.e. ALL existing Maemo devices run Gtk+ and Hildon applications! </li></ul>
  5. 5. So, what is Gtk+? <ul><li>Highly usable, feature rich toolkit for creating graphical user interfaces which boasts cross platform compatibility and an easy to use API. </li></ul><ul><ul><li>Windows </li></ul></ul><ul><ul><li>Buttons </li></ul></ul><ul><ul><li>Menus </li></ul></ul><ul><ul><li>Status Bars </li></ul></ul><ul><ul><li>Dialog boxes </li></ul></ul><ul><ul><li>… many other GUI controls </li></ul></ul><ul><li>Written in C. </li></ul><ul><li>Provide bindings to other programming languages. </li></ul><ul><li>Based on 4 libraries: </li></ul><ul><ul><li>GLib : Low-level stuffs such as data structures, portability wrappers, event loop, threads, dynamic loading and an object system </li></ul></ul><ul><ul><li>Pango : layout and rendering of text with an emphasis on internationalization. </li></ul></ul><ul><ul><li>Cairo : 2D graphics with support for multiple output devices </li></ul></ul><ul><ul><li>ATK : set of interfaces providing accessibility </li></ul></ul>
  6. 6. Where did Gtk+ come from? <ul><li>Originated from the GIMP (GNU Image Manipulation Program) project by Spencer Kimball and Peter Mattis, started in 1995 </li></ul><ul><li>Initially, based on Motif… </li></ul><ul><ul><li>Not good enough! </li></ul></ul><ul><ul><li>So… </li></ul></ul><ul><li>Rewrote their own GUI toolkit – Gtk </li></ul><ul><ul><li>Released since GIMP 0.60 </li></ul></ul><ul><ul><li>Renamed to Gtk+ since GIMP 0.99 </li></ul></ul>
  7. 7. Language Bindings supported by Gtk+ <ul><li>Gtk+ is written in C </li></ul><ul><li>Bindings are provided for programmers of other programming languages </li></ul><ul><li>Official bindings include: C++, Vala, Ruby, Python, Java, .Net, PHP and Perl. </li></ul>
  8. 8. Who use Gtk+? <ul><li>Environments </li></ul><ul><li>GNOME, Xfce, LXDE… </li></ul><ul><li>Access Linux Platform (ALP) </li></ul><ul><li>Moblin / Maemo </li></ul><ul><li>Applications </li></ul><ul><li>AbiWord </li></ul><ul><li>Gnumeric </li></ul><ul><li>Midori </li></ul><ul><li>Evolution </li></ul>
  9. 9. Then, what is Hildon? <ul><li>Application framework developed by Nokia </li></ul><ul><li>Now part of GNOME </li></ul><ul><li>Was used in Nokia Internet Tablet series and the Ubuntu Mobile and Embedded Edition </li></ul><ul><li>Depends on Gtk+ (GUI components), GConf (settings) & libcanberra (sound) libraries </li></ul><ul><li>Application Manager, Control Panel </li></ul><ul><li>Desktop, Widgets </li></ul><ul><li>Finger-friendly GUI components for Mobile Devices </li></ul>
  10. 10. Where Hildon sits in the Maemo Architecture?
  11. 11. Hildon 2.2 UI Components
  12. 12. Mixed use of Hildon and Gtk+ UI Components in Maemo <ul><li>Most Hildon classes are inherited from Gtk+ classes </li></ul><ul><li>You can place both Gtk+ and Hildon UI components to your applications </li></ul><ul><li>… but, be aware of UI styles and user experience! </li></ul>
  13. 13. What programming languages can I use to develop Maemo applications? <ul><li>C & C++ (GCC 4.2) </li></ul><ul><li>Python 2.5.4 </li></ul><ul><li>PHP 5 </li></ul><ul><li>Ruby 1.8 </li></ul><ul><li>Java (OpenJDK 1.8.x) </li></ul>
  14. 14. I use Python. But why Python? <ul><li>Because… </li></ul><ul><ul><li>I am C-phobic! </li></ul></ul><ul><ul><li>I am just a beginner of Linux application development </li></ul></ul><ul><ul><li>Python syntax is simple, code is fairly readable </li></ul></ul><ul><ul><li>Interpreter; easy to debug </li></ul></ul><ul><ul><li>Can be imperative, object-oriented, or functional </li></ul></ul><ul><ul><li>Dynamic types </li></ul></ul><ul><ul><li>Automatic memory management </li></ul></ul><ul><ul><li>Works well with Gtk+ and Hildon frameworks </li></ul></ul><ul><ul><li>Many code examples </li></ul></ul><ul><ul><li>Many existing Maemo applications are developed in Python </li></ul></ul><ul><ul><li>Code and run directly on my Internet Tablets! </li></ul></ul>
  15. 15. Little History of <ul><li>Since 1989 </li></ul><ul><li>By Guido van Rossum , a Dutch computer programmer, now a Google employee </li></ul><ul><li>Successor to the ABC programming language </li></ul><ul><li>Vision: </li></ul><ul><ul><li>an easy and intuitive language just as powerful as major competitors </li></ul></ul><ul><ul><li>open source, so anyone can contribute to its development </li></ul></ul><ul><ul><li>code that is as understandable as plain English </li></ul></ul><ul><ul><li>suitability for everyday tasks, allowing for short development times </li></ul></ul>
  16. 16. Maemo Applications written in Python <ul><li>gPodder Podcast Client </li></ul><ul><li>Gonvert </li></ul><ul><li>Hermes </li></ul><ul><li>Panucci player </li></ul><ul><li>PyGTKEditor </li></ul><ul><li>Witter </li></ul><ul><li>Zoutube </li></ul>
  17. 17. How does Python code look like?
  18. 18. Let’s run the Hello World program!
  19. 19. Class Definition Example
  20. 20. My Maemo Applications <ul><li>Written in Python and Gtk+/Hildon, of course. </li></ul><ul><li>Support both landscape and portrait mode. </li></ul><ul><li>UI Internationalization. </li></ul><ul><li>eSpeak GUI Client </li></ul><ul><ul><li>Provides a GUI for the eSpeak text-to-speech CLI utility </li></ul></ul><ul><li>Stroke Order Input Method 筆劃輸入法 </li></ul><ul><ul><li>As the name suggests! </li></ul></ul>
  21. 21. eSpeakGUI Client: UI Components A set of hildon.PickerButtons in a gtk.HBox A set of hildon.GtkButtons in a gtk.VBox hildon.TextView in a hildon.PannableArea hildon.AppMenu A set of hildon.GtkButtons in a gtk.HBox
  22. 22. eSpeakGUI Client: UI Components hildon.TouchSelector
  23. 23. eSpeakGUI Client: How does it speak? <ul><li>eSpeak is an open-source, command-line Text-to-Speech utility </li></ul><ul><li>Works like this… </li></ul>espeakcmd = &quot;espeak -v &quot; + currentlang + &quot; -a &quot; + currentAmp + &quot; -p &quot; + currentPitch + &quot; -s &quot; + currentSpeed + &quot; -g &quot; + currentWordGap + &quot; &quot;&quot; + textresult + &quot;&quot; &&quot; os.system(espeakcmd) <ul><li>Available in Maemo Extras Repository </li></ul><ul><li>The GUI client simply creates a command line to call the espeak utility via the os.system() method. </li></ul><ul><ul><li>Argument values obtained from </li></ul></ul><ul><ul><ul><li>Selected values of the hildon.PickerButtons </li></ul></ul></ul><ul><ul><ul><li>Text to be spoken from the hildon.TextView </li></ul></ul></ul>
  24. 24. eSpeakGUI Client: Demonstration
  25. 25. Stroke Order Chinese Input Method: UI Components hildon.StackWindow hildon. TouchSelector hildon.TextView in a hildon.PannableArea gtk.Label gtk.Label in hildon.PannableArea hildon.TextView hildon.GtkButtons in HBoxes and VBoxes hildon.GtkButtons in HBoxes and VBoxes hildon.GtkButton hildon.GtkButtons in a VBox hildon.AppMenu hildon.AppMenu
  26. 26. Stroke Order Chinese Input Method: UI Components hildon.AppMenu containing hildon.GtkButtons
  27. 27. Stroke Order Chinese Input Method: The Use of <ul><li>Characters and associated phrases are stored in a SQLite 3 database. </li></ul><ul><li>Why SQLite 3? </li></ul><ul><ul><li>Full Unicode Support </li></ul></ul><ul><ul><li>Native Python API </li></ul></ul><ul><ul><li>Lightweight, and, FAST! </li></ul></ul><ul><ul><li>It’s built-in in N900! </li></ul></ul>
  28. 28. Stroke Order Chinese Input Method: Accessing C-compiled libraries directly <ul><li>Not all features are available via bindings </li></ul><ul><li>You may import the ctypes library to get access to methods and properties in C-compiled libraries dynamically. </li></ul><ul><li>Example: Accessing the N900 Address Book: </li></ul>
  29. 29. Stroke Order Chinese Input Method: Demonstration
  30. 30. Get your hands dirty! <ul><li>Q: What tools do you need to develop Python applications on the Maemo platform? </li></ul><ul><li>A: Python! And… </li></ul><ul><ul><li>A plain-text editor! </li></ul></ul><ul><li>Of course, there are other easy-to-use options too. </li></ul>
  31. 31. Glade – Gtk+ RAD tool <ul><li>Drag-and-drop controls to build up a GUI app </li></ul><ul><li>Not aware of Hildon controls and libraries! </li></ul><ul><li>Require extra dependency on apps generated </li></ul>
  32. 32. Illumination Software Creator <ul><li>Define variables, GUI components and action blocks visually. </li></ul><ul><li>Generate Python code for desktop and Maemo. </li></ul><ul><li>Generate Flex code for Adobe Flash apps. </li></ul><ul><li>Great app for building a brief prototype and then fine-tune your code later. </li></ul><ul><li>Available in Microsoft Windows, Mac OS X and various Linux distributions. </li></ul>
  33. 33. PyGtkEditor on Maemo <ul><li>Open, edit, and run Python code directly on your Maemo device! </li></ul><ul><li>Support syntax highlighting and Hildon text completion. </li></ul><ul><li>Support other programming languages as well. </li></ul><ul><li>It itself is written in Python and Gtk+/Hildon! </li></ul>
  34. 34. I decide to develop Maemo apps in Python, do I still need Maemo SDK? <ul><li>You can write Python programs that run on Maemo devices directly, without using the Maemo 5 SDK. </li></ul><ul><ul><li>Transfer your Python scripts from your PC to your Maemo device. </li></ul></ul><ul><ul><li>Code directly on your device. </li></ul></ul><ul><ul><li>Run! </li></ul></ul><ul><li>However, you need Maemo SDK if you: </li></ul><ul><ul><li>Want to make use of the device simulator instead of testing your apps on real Maemo device. </li></ul></ul><ul><ul><li>Would like to package your Python apps. </li></ul></ul><ul><ul><li>Would like to upload your Python apps to the Maemo.org repositories. </li></ul></ul>
  35. 35. Will my Python/Gtk+/Hildon apps work in MeeGo? <ul><li>Well, maybe. Expect modifications though. </li></ul><ul><li>MeeGo is based on Qt instead of Gtk+/Hildon. </li></ul><ul><li>From MeeGo.com FAQ: </li></ul><ul><li>“ Will”. But when? We may get more clues in the forthcoming MeeGo Conference 2010. </li></ul>
  36. 36. MeeGo Architecture
  37. 37. Gtk+ Support in MeeGo Handset UX <ul><li>Zwong tested a Gtk+ app on MeeGo Handset UX and confirmed that it somehow works partially. ( http:// zwong.de/?p =78 ) </li></ul>
  38. 38. I want to develop apps for the MeeGo platform – shall I choose Gtk+, or Qt? <ul><li>Of course, the answer is… </li></ul><ul><ul><li>Qt! </li></ul></ul><ul><ul><li>Because the entire GUI of MeeGo is based on Qt components. </li></ul></ul><ul><ul><li>Python binding for Qt is also available: PyQt </li></ul></ul><ul><li>Then why shall we still bother with Gtk+? </li></ul><ul><ul><li>All Maemo devices up to today are based on Gtk+/Hildon. </li></ul></ul><ul><ul><li>The current release of the Chinese Input Method Engine “MSCIM” on N900 only supports Gtk+/Hildon apps, not Qt’s. </li></ul></ul><ul><ul><li>GNOME is available in nearly all mainstream Linux distributions. </li></ul></ul><ul><ul><li>Better to learn both! </li></ul></ul>
  39. 39. References for you to get started <ul><li>Python programming on Maemo </li></ul><ul><li>http:// wiki.maemo.org/PyMaemo </li></ul><ul><li>http:// wiki.maemo.org/PyMaemo/UI_tutorial </li></ul><ul><li>http:// pymaemo.garage.maemo.org / </li></ul><ul><li>http:// library.gnome.org/devel/pygtk/stable / </li></ul><ul><li>Hildon and Gtk+ Application Frameworks </li></ul><ul><li>http://maemo.org/api_refs/5.0/5.0-final/hildon/ </li></ul><ul><li>http://www.forum.nokia.com/info/sw.nokia.com/id/eb8a68ba-6225-4d84-ba8f-a00e4a05ff6f/Hildon_2_2_UI_Style_Guide.html </li></ul><ul><li>http://www.forum.nokia.com/info/sw.nokia.com/id/019c2b31-3777-49a0-9257-970d79580756/Hildon_2_2_Widget_UI_Specification.html </li></ul><ul><li>Source Code of existing Maemo applications </li></ul><ul><li>http:// maemo.org /packages/ </li></ul>
  40. 40. Thank you! <ul><li>Questions are welcome. </li></ul><ul><li>Please join the Hong Kong Maemo / Moblin / MeeGo User Group at http://groups.to/hkmaemo/ </li></ul><ul><li>Visit my blog at http://amanda_hoic.mysinablog.com/ </li></ul>
  41. 41. References <ul><li>Pictures and some text of this presentation were obtained from: </li></ul><ul><ul><li>Gimp.org </li></ul></ul><ul><ul><li>Gnome.org </li></ul></ul><ul><ul><li>Gtk.org </li></ul></ul><ul><ul><li>Maemo.org </li></ul></ul><ul><ul><li>Meego.com </li></ul></ul><ul><ul><li>MyID.com.hk </li></ul></ul><ul><ul><li>Wikipedia.com </li></ul></ul><ul><ul><li>Zwong.de </li></ul></ul><ul><ul><li>Zy-mobile.com </li></ul></ul>
  1. Gostou de algum slide específico?

    Recortar slides é uma maneira fácil de colecionar informações para acessar mais tarde.

×