def __init__(self, app, name, use_icon, enable_press, widget):
self.pressed = Gtk.Label() if enable_press else None
self.click_button = SCButtons.STICKPRESS
ControllerWidget.__init__(self, app, name, use_icon, widget)
grid = Gtk.Grid()
self.widget.set_events(Gdk.EventMask.POINTER_MOTION_MASK)
self.widget.connect('motion-notify-event', self.on_cursor_motion)
self.label.set_property("vexpand", True)
self.label.set_property("hexpand", True)
if self.pressed:
self.label.set_xalign(0.0); self.label.set_yalign(0.5)
self.pressed.set_property("hexpand", True)
self.pressed.set_xalign(0.0); self.pressed.set_yalign(1.0)
grid.attach(self.pressed, 2, 2, 1, 1)
else:
self.label.set_xalign(0.5); self.label.set_yalign(0.5)
self.pressed = None
if self.icon:
self.icon.set_margin_right(5)
grid.attach(self.icon, 1, 1, 1, 2)
grid.attach(self.label, 2, 1, 1, 1)
self.over_icon = False
self.enable_press = enable_press
self.widget.add(grid)
self.widget.show_all()
评论列表
文章目录