3 from dialog
import Dialog
10 def __init__(self
, title
, *sections
):
12 self
.sections
= sections
19 self
.box
= box
= Dialog()
20 box
.set_title(self
.title
)
21 box
.set_has_separator(False)
23 swin
= gtk
.ScrolledWindow(None, None)
24 swin
.set_policy(gtk
.POLICY_AUTOMATIC
, gtk
.POLICY_ALWAYS
)
25 swin
.set_shadow_type(gtk
.SHADOW_IN
)
26 swin
.set_border_width(2)
27 box
.vbox
.pack_start(swin
, True, True)
30 text
.set_left_margin(4)
31 text
.set_right_margin(4)
32 text
.set_wrap_mode(gtk
.WRAP_WORD
)
33 text
.set_editable(False)
34 text
.set_cursor_visible(False)
35 body
= text
.get_buffer()
36 titer
= body
.get_start_iter()
37 heading_style
= body
.create_tag(underline
= True, scale
= 1.2)
40 for title
, body
in self
.sections
:
44 body
.insert(titer
, '\n\n')
45 body
.insert_with_tags(titer
, title
, heading_style
)
46 body
.insert(titer
, '\n' + body
.strip())
51 box
.add_button(gtk
.STOCK_CLOSE
, gtk
.RESPONSE_CANCEL
)
52 box
.connect('response', lambda box
, resp
: box
.destroy())
54 box
.set_default_response(gtk
.RESPONSE_CANCEL
)
58 box
.connect('destroy', destroyed
)
60 box
.set_position(gtk
.WIN_POS_CENTER
)
61 box
.set_default_size(gtk
.gdk
.screen_width() / 4,
62 gtk
.gdk
.screen_height() / 3)