~ubuntu-branches/ubuntu/natty/mago/natty

« back to all changes in this revision

Viewing changes to mago/utils.py

  • Committer: Bazaar Package Importer
  • Author(s): Ara Pulido
  • Date: 2009-08-04 09:21:40 UTC
  • Revision ID: james.westby@ubuntu.com-20090804092140-mnc0rm2tr7smo107
Tags: upstream-0.1
ImportĀ upstreamĀ versionĀ 0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import os
 
2
import gtk, gobject, wnck
 
3
import subprocess
 
4
import re
 
5
 
 
6
def show_desktop(show):
 
7
    def _start_showing():
 
8
        screen.toggle_showing_desktop(show)
 
9
 
 
10
    screen = wnck.screen_get_default()
 
11
    gobject.idle_add(_start_showing)
 
12
    gobject.idle_add(gtk.main_quit)
 
13
    gtk.main()
 
14
 
 
15
def get_system_language():
 
16
    raise NotImplementedError, "not yet..."
 
17
 
 
18
def get_ldtp_version():
 
19
    script = subprocess.Popen(['ldtp', '--version'], stdout=subprocess.PIPE)
 
20
    version =  script.communicate()[0]
 
21
    pattern = re.compile("ldtp-(\d\.\d\.\d).*")
 
22
    m = pattern.match(version)
 
23
    version = m.group(1)
 
24
    return version
 
25
 
 
26