• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Python and GObject Introspection
 

Python and GObject Introspection

on

  • 5,736 views

 

Statistics

Views

Total Views
5,736
Views on SlideShare
3,638
Embed Views
2,098

Actions

Likes
0
Downloads
32
Comments
0

15 Embeds 2,098

http://yurinfore.blogspot.com 1880
http://yurinfore.blogspot.tw 178
http://feeds.feedburner.com 13
http://localhost 5
http://yurinfore.blogspot.hk 5
http://static.slidesharecdn.com 4
http://webcache.googleusercontent.com 3
http://yurenju.info 3
http://yurinfore.blogspot.de 1
http://translate.googleusercontent.com 1
http://yurinfore.blogspot.in 1
http://yurinfore.blogspot.jp 1
http://yurinfore.blogspot.com.au 1
http://reader.youdao.com 1
http://yurinfore.blogspot.fr 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Python and GObject Introspection Python and GObject Introspection Presentation Transcript

    • Python and GObject-Introspection Yuren Ju <yurenju@gmail.com>
    • About me● http://about.me/yurenju● Hacking Thursday● KaLUG● Twitter: @yurenju
    • GObject
    • D-BUS notifyGlade GTK VTE
    • GNOME platform
    • Binding Librarybased on GObject
    • Use codegen to generate GTK C Wrapper for Python gtk.c number of lines: 128,469
    • If GTK+ add APIs in new version,python-gtk also need to upgrade for new APIs.
    • Implement in Python,Also need to re-implement in Ruby, Perl, Java, Javscript again.
    • GObject-Introspection
    • Originalpython-gobject metadata GTK+ GTK+
    • GObject-Introspection python-gobject parser metadata GTK+ GTK+
    • Same metadata format python-gobject parsermetadata metadata metadataGTK+GTK+ gstreamer GTK+ ... GTK+
    • Parser + metadata = GObject-Introspection
    • tut-triangle tut.triangle+ get_color()+ set_color()+ get_centroid()+ get_centroidu()
    • MetadataComments in Source code g-ir-scanner Gir XML file g-ir-compiler Typelib binary file
    • Comments in Source codehttp://live.gnome.org/GObjectIntrospection/Annotations
    • Gir XML file
    • Metadata Comments in Source code g-ir-scanner Gir XML file g-ir-compilerlibgirepository Typelib binary file
    • python-gobjectPyGTK 2.24.0 has been released. This is a stable release supporting the GTK+2.24 API. New users wishing to develop Python applications using GTK+ arerecommended to use the GObject-Introspection features available inPyGObject. Existing authors of PyGTK applications are also recommended toport their applications to PyGObject to take advantage of new featuresappearing in GTK-3 and beyond.
    • gtk.c number of lines:128,469
    • How to use GI?from gi.repository import Gtk;
    • PEP-0302: New Import Hooks Append finder to sys.meta_path,Use finder.find_module() dynamic to find module.
    • Load module● find_module()● load_module() ● Create DynamicModule ● Module._load() – Create self._introspection_module ● IntrospectionModule => repository.requre to load typelib
    • Objectfrom gi.repository import Gtk - Widget - ContainerInitial all items in Gtk - WindowGet info from ...etc.repository.find_by_name()If item is a object instance, Use a MetaClass“GobjectMeta” to create a class wrapperFinally, you have a Python Class to create Object!
    • Method – relative easy object.method() Call info.invoke() g_function_info_invoke
    • Summary● GI Migrate metadata from language-binding to library● python-gobject let you use GTK, GObject, Gstreamer, VTE, Dbus,...etc.
    • 一人成佛,雞犬升天