blob: 8b309a2c98b9bd82e395979e8041b4f5d09d5ef3 (
plain)
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
|
#!/usr/bin/env python
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/gnome-extra/gdesklets-core/files/gdesklets-control-getid,v 1.3 2005/08/30 19:29:27 nixphoeni Exp $
#
# A simple script to get the name and id from a Control.
# Pretty much copied from test-control.py
from plugin.Interface import Interface
import sys
import os
import __builtin__
if "." not in sys.path: sys.path.append(".")
try:
path = os.path.abspath(sys.argv[1])
folder, base = os.path.split(path)
except:
#sys.exit("Usage: gdesklets-control-getid <control-directory>")
print "ERROR_IN_CONTROL_INSTALLATION"
os.chdir(folder)
try:
module = __import__(base)
os.chdir(base)
clss = module.get_class()
ctrl = clss()
except IOError:
#sys.exit("Could not load control %s." % (path))
print folder
# Get the string in the form of "IMyControl:hash" and translate it to
# "MyControl_hash"
# gDesklets needs it in the form of a valid python module name
print (Interface.get_id(Interface.get_interfaces(clss)[0]).replace(":", "_"))[1:]
|