~romaia/kiwi/teste-ppa

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
48
49
50
51
52
53
54
55
import os
import glob

import gtk

from kiwi.ui.hyperlink import HyperLink
from kiwi.ui.objectlist import ObjectList, ObjectTree
from kiwi.ui.widgets.label import ProxyLabel
from kiwi.ui.widgets.combo import ProxyComboEntry, ProxyComboBox
from kiwi.ui.widgets.checkbutton import ProxyCheckButton
from kiwi.ui.widgets.radiobutton import ProxyRadioButton
from kiwi.ui.widgets.entry import ProxyEntry, ProxyDateEntry
from kiwi.ui.widgets.spinbutton import ProxySpinButton
from kiwi.ui.widgets.textview import ProxyTextView
from kiwi.ui.widgets.button import ProxyButton

# pyflakes
HyperLink
ObjectList
ObjectTree
ProxyLabel
ProxyComboEntry
ProxyComboBox
ProxyCheckButton
ProxyRadioButton
ProxyEntry
ProxyDateEntry
ProxySpinButton
ProxyTextView
ProxyButton


def _get_icon_path():
    dirname = os.path.dirname(__file__)
    if not os.path.exists(os.path.join(dirname, '.svn')):
        prefix = os.path.join(dirname, '..', '..', '..')
        icondir = os.path.join(prefix, 'share', 'glade3', 'pixmaps', '22x22')
    else:
        icondir = os.path.join(dirname, '..', 'glade-plugin',
                               'resources', 'kiwiwidgets')
    return os.path.abspath(icondir)


def _register_icons():
    icondir = _get_icon_path()
    for filename in glob.glob(os.path.join(icondir, '*.png')):
        basename = os.path.basename(filename)
        name = basename[:-4]
        gtk.icon_theme_add_builtin_icon(
            'widget-kiwi-%s' % (name,),
            22,
            gtk.gdk.pixbuf_new_from_file(filename))


_register_icons()