495
495
class FramedHeaderBox(FramedBox):
497
497
MARKUP = '<b>%s</b>'
499
# pages for the spinner notebook
499
def __init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=0, padding=0):
503
def __init__(self, orientation=Gtk.Orientation.VERTICAL,
500
507
FramedBox.__init__(self, Gtk.Orientation.VERTICAL, spacing, padding)
501
509
self.header = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, spacing)
502
510
self.header_alignment = Gtk.Alignment()
503
511
self.header_alignment.add(self.header)
504
512
self.box.pack_start(self.header_alignment, False, False, 0)
513
# make the content box
505
514
self.content_box = Gtk.Box.new(orientation, spacing)
506
self.box.add(self.content_box)
515
# and a spinner (to be used only if needed)
516
# TODO: cosmetic tweak needed - draw a line at the top of the spinner
517
# area so that the header has a proper border
518
self.spinner = Gtk.Spinner()
519
self.spinner.set_size_request(32, 32)
520
self.spinner.set_valign(Gtk.Align.CENTER)
521
self.spinner.set_halign(Gtk.Align.CENTER)
522
# finally, a notebook for the spinner and the content box to share
523
self.spinner_notebook = Gtk.Notebook()
524
self.spinner_notebook.set_show_tabs(False)
525
self.spinner_notebook.set_show_border(False)
526
self.spinner_notebook.append_page(self.content_box, None)
527
self.spinner_notebook.append_page(self.spinner, None)
528
self.box.add(self.spinner_notebook)
509
531
def on_draw(self, cr):
524
546
def pack_end(self, *args, **kwargs):
525
547
return self.content_box.pack_end(*args, **kwargs)
549
def show_spinner(self):
552
self.spinner_notebook.set_current_page(self.SPINNER)
554
def hide_spinner(self):
557
self.spinner_notebook.set_current_page(self.CONTENT)
527
559
# XXX: non-functional with current code...
528
560
#~ def set_header_expand(self, expand):
553
585
self.title.set_markup(self.MARKUP % label)
556
def header_implements_more_button(self, callback=None):
588
def header_implements_more_button(self):
557
589
if not hasattr(self, "more"):
558
590
self.more = MoreLink()
559
591
self.header.pack_end(self.more, False, False, 0)