File: ctrlinfo

package info (click to toggle)
gdesklets 0.36-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 9,604 kB
  • ctags: 2,161
  • sloc: python: 12,197; sh: 9,020; ansic: 1,712; makefile: 807; xml: 324
file content (47 lines) | stat: -rwxr-xr-x 1,054 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /usr/bin/env python

# This tool loads a given control and outputs information about the control.
#
# The output consists of multiple lines of key-value pairs, where the value
# is URL-quoted, e.g.:
#
#   ID2:ITime%3A7qktelp6tw29ve5p8q3lxn6bs-2


from plugin.Interface import Interface

import os
import sys


def output(key, value):

    from utils import vfs
    print "%s:%s" % (key, vfs.escape_path(value))


sys.path.append(os.curdir)
cwd = os.getcwd()

try:
    path = sys.argv[1]
    if (path[-1] == os.sep): path = path[:-1]
    os.chdir(os.path.dirname(path))
    m = __import__(os.path.basename(path))
    cls = m.get_class()

    ifaces = " ".join([ Interface.get_id(i)
                        for i in Interface.get_interfaces(cls) ])
    tazifaces = " ".join([ Interface.get_taz_style_id(i)
                           for i in Interface.get_interfaces(cls) ])


    output("PATH", path)
    for iface in Interface.get_interfaces(cls):
        output("ID2", ifaces)
        output("ID1", tazifaces)

except:
    sys.exit(1)

os.chdir(cwd)