~ubuntu-branches/ubuntu/saucy/autopilot/saucy-proposed

« back to all changes in this revision

Viewing changes to autopilot/emulators/dbus_handler.py

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2013-06-07 13:33:46 UTC
  • mfrom: (57.1.1 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130607133346-42zvbl1h2k1v54ac
Tags: 1.3daily13.06.05-0ubuntu2
autopilot-touch only suggests python-ubuntu-platform-api for now.
It's not in distro and we need that requirement to be fulfilled to
have unity 7, 100 scopes and the touch stack to distro.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2012 Canonical
2
 
# Author: Thomi Richards
3
 
#
4
 
# This program is free software: you can redistribute it and/or modify it
5
 
# under the terms of the GNU General Public License version 3, as published
6
 
# by the Free Software Foundation.
7
 
 
8
 
"""Initialise dbus once using glib mainloop."""
9
 
 
10
 
from __future__ import absolute_import
11
 
 
12
 
import dbus
13
 
from dbus.mainloop.glib import DBusGMainLoop
14
 
 
15
 
_glib_loop_set = False
16
 
 
17
 
def get_session_bus():
18
 
    """This function returns a session bus that has had the DBus GLib main loop
19
 
    initialised.
20
 
 
21
 
    """
22
 
    global _glib_loop_set
23
 
    if not _glib_loop_set:
24
 
        #
25
 
        # DBus has an annoying bug where we need to initialise it with the gobject main
26
 
        # loop *before* it's initialised anywhere else. This module exists so we can
27
 
        # initialise the dbus module once, and once only.
28
 
        DBusGMainLoop(set_as_default=True)
29
 
        _glib_loop_set = True
30
 
    # create a global session bus object:
31
 
    return dbus.SessionBus()