def generate_header_bar(self):
"""
Generate the header bar box
"""
self.hb.props.title = _("Add a new account")
left_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
right_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
cancel_button = Gtk.Button.new_with_label(_("Cancel"))
cancel_button.connect("clicked", self.close_window)
cancel_button.get_style_context().add_class("destructive-action")
left_box.add(cancel_button)
self.apply_button = Gtk.Button.new_with_label(_("Add"))
self.apply_button.get_style_context().add_class("suggested-action")
self.apply_button.connect("clicked", self.add_account)
self.apply_button.set_sensitive(False)
qr_button = Gtk.Button()
qr_icon = Gio.ThemedIcon(name="qrscanner-symbolic")
qr_image = Gtk.Image.new_from_gicon(qr_icon, Gtk.IconSize.BUTTON)
qr_button.set_tooltip_text(_("Scan a QR code"))
qr_button.set_image(qr_image)
qr_button.connect("clicked", self.on_qr_scan)
right_box.add(qr_button)
right_box.add(self.apply_button)
self.hb.pack_start(left_box)
self.hb.pack_end(right_box)
self.set_titlebar(self.hb)
add_account.py 文件源码
python
阅读 34
收藏 0
点赞 0
评论 0
评论列表
文章目录