~ubuntu-branches/ubuntu/oneiric/avant-window-navigator/oneiric

« back to all changes in this revision

Viewing changes to pyawn/__init__.py

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2008-05-24 14:42:01 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080524144201-r3v8e4g2hv2q1i9x
Tags: 0.2.6-6
* debian/patches/04-fix-colormap.patch
 - Fix crash in awn-manager if colormap == None. Thanks Emme for the 
   patch. (Closes: #482030) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- Mode: Python; py-indent-offset: 4 -*-
2
 
 
3
 
import sys, os
4
 
import getopt
5
 
 
6
 
# load the required modules:
7
 
import gobject as _gobject
8
 
 
9
 
ver = getattr(_gobject, 'pygobject_version', ())
10
 
if ver < (2, 11, 1):
11
 
  raise ImportError("PyGTK requires PyGObject 2.11.1 or higher, but %s was found" % (ver,))
12
 
 
13
 
from awn import *
14
 
 
15
 
uid = "0"
16
 
window = 0
17
 
orient = 0
18
 
height = 0
19
 
 
20
 
def init (argv):
21
 
  global uid
22
 
  global window
23
 
  global orient
24
 
  global height
25
 
 
26
 
  try: 
27
 
    opts, args = getopt.getopt (argv, "u:w:o:h:", 
28
 
                                ["uid=", "window=", "orient=", "height="])
29
 
  except getopt.GetoptError:
30
 
    print ("Unable to parse args")
31
 
    sys.exit (2)
32
 
 
33
 
  for opt, arg in opts:
34
 
    if opt in ("-u", "--uid"):
35
 
      uid = arg
36
 
      #print "uid = " + arg + " " + str (type (uid))
37
 
    elif opt in ("-w", "--window"):
38
 
      window = int (arg)
39
 
      #print "window = " + arg+ " " + str (type (window))
40
 
    elif opt in ("-o", "--orient"):
41
 
      orient = int (arg)
42
 
      #print "orient = " + arg + " " + str (type (orient))
43
 
    elif opt in ("-h", "--height"):
44
 
      height = int (arg)
45
 
      #print "height = " + arg + " " + str (type (height))
46
 
 
47
 
def init_applet (applet):
48
 
  global uid
49
 
  global orient
50
 
  global height
51
 
  global window
52
 
  plug = awn.Plug (applet)
53
 
  plug.add (applet)
54
 
  if (window):
55
 
    plug.construct (window)
56
 
  else:
57
 
    plug.construct (-1)
58
 
    plug.show_all ()