def create_matrices_expander(self):
expander = Gtk.Expander()
expander.connect_after('activate', self.on_expander_activate)
vbox = Gtk.VBox(False, 0)
expander.add(vbox)
if self.m_statistics.m_t.m_P.header.statistics_matrices == 'enabled':
expander.set_expanded(True)
for heading, seconds in ((_("Session"), 0),
(_("Today"), 60*60*24),
(_("Last 7 days"), 60*60*24*7),
(_("Total"), -1)):
table = MatrixTable(heading,
self.m_statistics.get_statistics(seconds),
self.m_statistics)
vbox.pack_start(table, False, False, 0)
else:
expander.set_expanded(False)
expander.show_all()
return expander
python类Expander()的实例源码
def __init__(self,
parent=None,
title="",
primary=None,
secondary=None,
details=None,
buttons=Gtk.ButtonsType.OK,
type=Gtk.MessageType.INFO):
Gtk.MessageDialog.__init__(self, parent, 0, type, buttons, primary)
self.set_title(title)
if secondary:
self.format_secondary_markup(secondary)
if details:
textview = Gtk.TextView()
textview.get_buffer().set_text(details)
scroll = Gtk.ScrolledWindow()
scroll.set_size_request(500, 300)
scroll.set_policy(Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC)
scroll.add(textview)
expand = Gtk.Expander().new(_("Details"))
expand.add(scroll)
expand.show_all()
self.get_content_area().pack_start(expand, True, True, 0)
if parent:
self.set_modal(True)
self.set_property("skip-taskbar-hint", True)
def __init__(self,
parent=None,
title="",
primary=None,
secondary=None,
details=None,
buttons=Gtk.ButtonsType.OK,
type=Gtk.MessageType.INFO):
Gtk.MessageDialog.__init__(self, parent, 0, type, buttons, primary)
self.set_title(title)
if secondary:
self.format_secondary_markup(secondary)
if details:
textview = Gtk.TextView()
textview.get_buffer().set_text(details)
scroll = Gtk.ScrolledWindow()
scroll.set_size_request(500, 300)
scroll.set_policy(Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC)
scroll.add(textview)
expand = Gtk.Expander().new(_("Details"))
expand.add(scroll)
expand.show_all()
self.get_content_area().pack_start(expand, True, True, 0)
if parent:
self.set_modal(True)
self.set_property("skip-taskbar-hint", True)