def __init__(self, text, menu):
GObject.GObject.__init__(self)
self.menu = menu
hbox1 = Gtk.HBox()
hbox2 = Gtk.HBox()
icon = Gtk.Image()
icon.set_from_file(datafile_path('bokken-small.svg'))
hbox1.pack_start(icon, True, True, 3)
label = Gtk.Label()
label.set_markup("<b>"+ text + "</b>")
hbox1.pack_start(label, True, True, 3)
arrow = Gtk.Arrow(Gtk.ArrowType.DOWN, Gtk.ShadowType.IN)
hbox1.pack_start(arrow, False, False, 3)
hbox2.pack_start(hbox1, True, True, 0)
# MEOW Text settings
#attrs = Pango.AttrList()
#attrs.change(Pango.AttrWeight(Pango.Weight.SEMIBOLD, 0, -1))
#label.set_attributes(attrs)
self.add(hbox2)
self.set_relief(Gtk.ReliefStyle.NORMAL)
self.set_can_focus(True)
self.set_can_default(False)
self.connect("toggled", self.on_toggled)
for sig in "selection-done", "deactivate", "cancel":
menu.connect(sig, self.on_menu_dismiss)
评论列表
文章目录