1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import gtk
24 from color_selection import ColorButton
25 from gtk import gdk
26 import pseudo_skin
27 import tooltip as TT
28
29 __all__ = []
30
41
43 print "destroing..", type(w), id(w)
44
46 box = gtk.VBox()
47 t = gtk.CheckButton("NeedShadow")
48 t.set_active(True)
49 t.connect('toggled', lambda w: TT.has_shadow(widget, w.get_active()))
50 box.pack_start(t, False, False)
51 TT.text(t, "toggle the shadow")
52
53 winfo = TT.WidgetInfo.get_info(widget)
54 t1 = gtk.Entry()
55 t1.set_text(winfo.text or "")
56 t1.connect('activate', lambda w: TT.text(widget, w.get_text()))
57 box.pack_start(t1, False, False)
58
59 t2 = gtk.SpinButton()
60 t2.set_range(0, 10)
61 t2.set_value((winfo.show_delay / 1000))
62 t2.connect('value-changed', lambda w: TT.show_delay(widget, w.get_value_as_int() * 1000 + 100))
63 box.pack_start(t2, False, False)
64
65 t3 = ColorButton()
66 t3.set_color(str(winfo.background))
67 t3.connect('color-select', lambda w, e: TT.background(widget, gtk.gdk.Color(w.get_color())))
68 box.pack_start(t3)
69
70 t4 = gtk.SpinButton()
71 t4.set_range(0, 100)
72 t4.set_value(winfo.padding_r)
73 t4.connect('value-changed', lambda w: TT.padding(widget, -1, -1, -1, w.get_value()))
74 box.pack_start(t4, False, False)
75
76 t5 = gtk.CheckButton("disable")
77 t5.set_active(False)
78 t5.connect('toggled', lambda w: TT.disable(widget, w.get_active()))
79 box.pack_start(t5, False, False)
80
81
82 TT.text(t1, "The text value if tooltip didn't has custom property")\
83 (t2, "The show delay value")\
84 (t3, "The background color")\
85 (t4, "The pading right value")\
86 (t5, "tmp disable tooltip")\
87 .show_delay([t1,t2,t3,t4,t5], 200)\
88 .background([t1,t2], gdk.Color("red"))\
89 .set_value([t1,t2,t3,t4,t5], {'text_kargs': {"text_size":15}})
90
91 return box
92
93
94 w = gtk.Window()
95 w.set_size_request(500, 500)
96 box = gtk.VBox()
97
98 b1 = gtk.Button("button")
99 b2 = gtk.Button("button1")
100
101 ls = gtk.HBox()
102 l1 = gtk.Label("label1")
103 l2 = gtk.Label("label2")
104 ls.add(l1)
105 ls.add(l2)
106
107
108 TT.show_delay([b1,b2,l1,l2], 1000)\
109 .background(b1, gdk.Color("yellow"))(b2, gdk.Color("#95BE0D"))(l1,gdk.Color("blue"))\
110 .custom(b1, customTooltip_cb)\
111 .text([l1, l2], "tooliiiiit")(b2, "button2222", enable_gaussian=True)\
112 .padding(l1, -1, -1, -1, 50)(b2, -1, -1, -1, 0)(b1, 0, 50, 50, 50)
113
114
115
116
117 b1c = gen_control(b1)
118 b = gtk.HBox()
119 b.add(b1)
120 b.pack_start(b1c, False)
121 box.pack_start(b)
122
123 b2c = gen_control(b2)
124 b = gtk.HBox()
125 b.add(b2)
126 b.pack_start(b2c, False)
127 box.pack_start(b)
128
129 lc = gen_control(l1)
130 b = gtk.HBox()
131 b.add(ls)
132 b.pack_start(lc, False)
133 box.pack_start(b)
134
135 w.add(box)
136 w.connect('destroy', gtk.main_quit)
137 w.show_all()
138 gtk.main()
139
140