1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 from widget import Widget
25 from common import *
26
28 """
29 The base class for widgets which display a string - L{Label},L{Button}, etc.
30 Do not use directly.
31
32 New Attributes
33 ==============
34
35 - text: The text (depends on actual widget)
36
37 Data
38 ====
39
40 The text can be set via the L{distributeInitialData} method.
41 """
42
43 ATTRIBUTES = Widget.ATTRIBUTES + [ UnicodeAttr('text') ]
44 DEFAULT_HEXPAND = 1
45 DEFAULT_VEXPAND = 0
46 DEFAULT_MARGINS = 5,5
47 DEFAULT_TEXT = u""
48
49 - def __init__(self,
50 parent = None,
51 name = None,
52 size = None,
53 min_size = None,
54 max_size = None,
55 helptext = None,
56 position = None,
57 style = None,
58 hexpand = None,
59 vexpand = None,
60 font = None,
61 base_color = None,
62 background_color = None,
63 foreground_color = None,
64 selection_color = None,
65 border_size = None,
66 position_technique = None,
67 is_focusable = None,
68 comment = None,
69 margins = None,
70 text = None):
71
72 self.margins = self.DEFAULT_MARGINS
73 self.text = self.DEFAULT_TEXT
74 super(BasicTextWidget,self).__init__(parent=parent,
75 name=name,
76 size=size,
77 min_size=min_size,
78 max_size=max_size,
79 helptext=helptext,
80 position=position,
81 style=style,
82 hexpand=hexpand,
83 vexpand=vexpand,
84 font=font,
85 base_color=base_color,
86 background_color=background_color,
87 foreground_color=foreground_color,
88 selection_color=selection_color,
89 border_size=border_size,
90 position_technique=position_technique,
91 is_focusable=is_focusable,
92 comment=comment)
93
94
95 self.accepts_initial_data = True
96 self._realSetInitialData = self._setText
97
98
99 if margins is not None: self.margins = margins
100 if text is not None: self.text = text
101
104
105 text = property(_getText,_setText)
106
110