def create_switch(self, p, g, l, b, d='Default'):
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL,
spacing=12,
expand=True,
visible=True)
title = Gtk.Label(halign='start',
expand=True,
visible=True,
label=l)
subtitle = Gtk.Label(halign='start', expand=True, visible=True)
subtitle.get_style_context().add_class('dim-label')
subtitle.set_markup('<small>'+str(d)+'</small>')
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
expand=True,
visible=True)
vbox.pack_start(title, True, True, 0)
vbox.pack_start(subtitle, True, True, 0)
box.pack_start(vbox, True, True, 0)
switch = Gtk.Switch(visible=True, expand=False)
Bracer.settings.bind(b, switch, "active", Gio.SettingsBindFlags.DEFAULT)
switch_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
spacing=6,
expand=False,
visible=True)
switch_box.pack_start(switch, True, False, 0)
pack = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL,
spacing=6,
expand=True,
visible=True)
pack.pack_start(box, True, True, 0)
pack.pack_end(switch_box, False, False, 0)
ready = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
spacing=6,
expand=True,
visible=True)
ready.pack_start(pack, True, True, 0)
self.ids.append(self.prefs.add_custom(p, g, ready, None, 1000))
评论列表
文章目录