def __init__(self, label, main_widget, alternative_widget=None):
self.main_widget = main_widget
self.alternative_widget = alternative_widget
self.label = label
self.stack = Gtk.Stack()
self.stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
self.stack.set_transition_duration(1000)
self.stack.add_named(main_widget, "main_widget")
if alternative_widget is not None:
self.stack.add_named(self.alternative_widget, "alternative_widget")
Gtk.ListBoxRow.__init__(self)
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
hbox.set_border_width(5)
hbox.set_margin_left(20)
hbox.set_margin_right(20)
self.add(hbox)
grid = Gtk.Grid()
grid.set_column_spacing(15)
hbox.pack_start(grid, True, True, 0)
self.description_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.description_box.props.hexpand = True
self.description_box.props.halign = Gtk.Align.START
self.description_box.props.valign = Gtk.Align.CENTER
self.label.props.xalign = 0.0
self.description_box.add(self.label)
grid.attach(self.description_box, 0, 0, 1, 1)
grid.attach_next_to(self.stack, self.description_box, Gtk.PositionType.RIGHT, 1, 1)
评论列表
文章目录