1 # Copyright (C) 2008, Thomas Leonard
2 # See the README file for details, or visit http://0install.net.
6 from dialog
import Dialog
13 def __init__(self
, title
, *sections
):
15 self
.sections
= sections
22 self
.box
= box
= Dialog()
23 box
.set_title(self
.title
)
24 box
.set_has_separator(False)
26 swin
= gtk
.ScrolledWindow(None, None)
27 swin
.set_policy(gtk
.POLICY_AUTOMATIC
, gtk
.POLICY_ALWAYS
)
28 swin
.set_shadow_type(gtk
.SHADOW_IN
)
29 swin
.set_border_width(2)
30 box
.vbox
.pack_start(swin
, True, True)
33 text
.set_left_margin(4)
34 text
.set_right_margin(4)
35 text
.set_wrap_mode(gtk
.WRAP_WORD
)
36 text
.set_editable(False)
37 text
.set_cursor_visible(False)
38 model
= text
.get_buffer()
39 titer
= model
.get_start_iter()
40 heading_style
= model
.create_tag(underline
= True, scale
= 1.2)
43 for title
, body
in self
.sections
:
47 model
.insert(titer
, '\n\n')
48 model
.insert_with_tags(titer
, title
, heading_style
)
49 model
.insert(titer
, '\n' + body
.strip())
54 box
.add_button(gtk
.STOCK_CLOSE
, gtk
.RESPONSE_CANCEL
)
55 box
.connect('response', lambda box
, resp
: box
.destroy())
57 box
.set_default_response(gtk
.RESPONSE_CANCEL
)
61 box
.connect('destroy', destroyed
)
63 box
.set_position(gtk
.WIN_POS_CENTER
)
64 box
.set_default_size(gtk
.gdk
.screen_width() / 4,
65 gtk
.gdk
.screen_height() / 3)