Your SlideShare is downloading. ×
Introduction to Application Development in Python and Gtk+ / Hildon @ Maemo 5
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

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

1,774

Published on

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

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,774
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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

×