~ubuntu-branches/ubuntu/karmic/ibus/karmic-updates

« back to all changes in this revision

Viewing changes to ui/gtk/propitem.py

  • Committer: Bazaar Package Importer
  • Author(s): LI Daobing
  • Date: 2009-07-23 20:22:09 UTC
  • mfrom: (1.1.4 upstream) (6.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090723202209-bmgqa80g1umg8l2p
Tags: 1.2.0.20090723-1
new upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#
3
3
# ibus - The Input Bus
4
4
#
5
 
# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
 
5
# Copyright(c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
6
6
#
7
7
# This library is free software; you can redistribute it and/or
8
8
# modify it under the terms of the GNU Lesser General Public
9
9
# License as published by the Free Software Foundation; either
10
 
# version 2 of the License, or (at your option) any later version.
 
10
# version 2 of the License, or(at your option) any later version.
11
11
#
12
12
# This library is distributed in the hope that it will be useful,
13
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20
20
# Boston, MA  02111-1307  USA
21
21
 
22
22
class PropItem:
23
 
    def __init__ (self, prop):
 
23
    def __init__(self, prop):
24
24
        self._prop = prop
25
25
        self._sub_items = []
26
26
 
27
 
    def update_property (self, prop):
 
27
    def update_property(self, prop):
28
28
        if self._prop == None:
29
29
            return False
30
30
 
32
32
 
33
33
        if self._prop.key == prop.key and self._prop.type == prop.type:
34
34
            self._prop = prop
35
 
            self.property_changed ()
 
35
            self.property_changed()
36
36
            retval =  True
37
37
 
38
 
        if any (map (lambda i: i.update_property (prop), self._sub_items)):
 
38
        if any(map(lambda i: i.update_property(prop), self._sub_items)):
39
39
            retval = True
40
40
 
41
41
        return retval
42
42
 
43
 
    def set_prop_label (self, label):
 
43
    def set_prop_label(self, label):
44
44
        self._prop.label = label
45
 
        self.property_changed ()
 
45
        self.property_changed()
46
46
 
47
 
    def set_icon (self, icon):
 
47
    def set_icon(self, icon):
48
48
        self._prop.icon = icon
49
 
        self.property_changed ()
 
49
        self.property_changed()
50
50
 
51
 
    def set_tooltip (self, tooltip):
 
51
    def set_tooltip(self, tooltip):
52
52
        self._prop.tooltip = tooltip
53
 
        self.property_changed ()
 
53
        self.property_changed()
54
54
 
55
 
    def set_state (self, state):
 
55
    def set_state(self, state):
56
56
        self._prop.state = state
57
 
        self.property_changed ()
 
57
        self.property_changed()
58
58
 
59
 
    def property_changed (self):
 
59
    def property_changed(self):
60
60
        pass
61
61
 
62
62