Social Connect QML plugin: access Facebook, Twitter from your Qt/QML applications

Posted on Mon 13 August 2012 in Maemo (EN), MeeGo, Programmazione, Qt, Ubuntu (EN) • Tagged with library, Mobile, nokia, QML, Qt, Social

Social Connect is a library written in Qt that allows applications to easily connect to services like Facebook and Twitter. Recently I had the opportunity to work on this library improving it and adding support for Instagram (work is still in progress but it's almost finished).

social connect

The main features of this library are:

  • Out-of-the-box support for Facebook and Twitter
  • Integrated authentication implementation
  • Simplified common interface for all supported services
  • Provides interfaces for native API calls
  • Design enabling easy addition of new services e.g. LinkedIn

If you are writing an application that needs to access these services, this could be the library for you. It can be extended to support even other services like LinkedIn, Flickr etc... and I would like to invite people to contribute to the code. The library has been tested with Qt 4.8.1 on Ubuntu Linux 12.04 but it should be compatible with any other versions/platforms.

For more informations about getting started with the library, I suggest you to give a look at this page https://projects.developer.nokia.com/socialconnect/wiki/GettingStarted


Writing Python bindings of existing C libraries – (3) – Building and Installing with distutils

Posted on Thu 13 August 2009 in HowTo, Igalia, Linux, Maemo (EN), Programmazione, Python • Tagged with binding, distutils, library, maemo, Python, setup

In the last post of this series, we saw how to write a simple binding and we finished to build and install it manually. This is of course not a good way to manage the building/installation procedure.

In Python we can use a library called distutils that let us to automatize the building and installing process. I'll use the foo source code to create the package, so it will be easier to understand.

Using distutils

All we have to do is to write a setup.py file similar to this one:

from distutils.core import setup, Extension

foomodule = Extension('foo', sources = ['foo.c'])

setup (
    name = 'Foo',
    version = '1.0',  
    description = 'This is a package for Foo',  
    ext_modules = [foomodule]
)

As you can see, we have to first import needed modules with: from distutils.core import setup, Extension
then we create an entry for each module we have (in this case just one, "foomodule"). We then call the setup() method passing it all the parameters and our setup.py is complete.

Building and installing

To test it we can try to build the package in this way:

python2.5 setup.py build

if we want to install the module in our system:

python2.5 setup.py install

References


Writing Python bindings of existing C libraries - (1) - Introduction

Posted on Mon 03 August 2009 in HowTo, Igalia, Linux, Maemo (EN), Programmazione, Python • Tagged with bindings, C, Igalia, libraries, library, maemo, pymaemo, Python

This summer I'm having the pleasure of working in Igalia (a spanish free software company) for a couple of months and they assigned me to an interesting project: developing Python bindings for MAFW library (a Maemo multimedia library that will be used in Fremantle release).

Having the opportunity to work both with C (yes, Python bindings are almost C code) and Python (it's a good practice to write unittest of all implemented methods) it's a good way to improve my knowledges in both languages and since I wasn't able to find much documentation about these kind of things, I'm going to share my own experiences.

What is a Binding?

A binding is a Python module, written in C language, that allows Python developers to call functions from existing C libraries from their python applications. It's just like a "bridge" from C world to Python one.

Why writing bindings?

There are a couple of reasons to write python bindings instead of writing a library in python language from scratch.

First of all I don't think is good duplicating code, so if a library already exists and it's written in C, why writing it again in another language? There's no reason. A lot of code already exist in C world and all we have to do is to create a bridge with python world.

Another good reason, in particular when a C library doesn't exist yet, is the fact that python code is slower than C code for some tasks (for example multimedia codecs). In these cases is good to implement the core library in C language and then create a python binding for it.

Coming next

As the title of this post says, this is only an introduction to the subjects I'm going to write about. If you have any particular request about any argument you would like to read, please feel free to leave me a comment. Next posts will talk about these things:

  • A simple example of binding: I'll write a simple library in C language and I'll show how to create the relative python binding, providing complete source code and an example for python developers.
  • Building and installing python bindings with distutils: I'll explain how to use distutils to build and install the binding (using the well know method "python setup.py install").
  • Defining new types: this post will be about how to write new types in C language and being able to use them from python code.
  • Using codegen to write bindings: I'll explain how to use codegen utils to automate lot of tasks, to generate the most part of binding code and how to customize the generated code using overrides.