30 lines
962 B
Python
30 lines
962 B
Python
|
# Copyright 2021 (c) Anna Schumaker.
|
||
|
from gi.repository import GObject
|
||
|
from gi.repository import Gtk
|
||
|
|
||
|
class UpDownBox(Gtk.Box):
|
||
|
def __init__(self):
|
||
|
Gtk.Box.__init__(self)
|
||
|
self.append(Gtk.Button.new_from_icon_name("go-up-symbolic"))
|
||
|
self.append(Gtk.Button.new_from_icon_name("go-down-symbolic"))
|
||
|
self.add_css_class("linked")
|
||
|
|
||
|
self.get_first_child().connect("clicked", self.clicked, "move-up")
|
||
|
self.get_last_child().connect("clicked", self.clicked, "move-down")
|
||
|
|
||
|
self.get_first_child().set_sensitive(False)
|
||
|
self.get_last_child().set_sensitive(False)
|
||
|
|
||
|
def set_active(self, active, first, last):
|
||
|
self.get_first_child().set_sensitive(active and not first)
|
||
|
self.get_last_child().set_sensitive(active and not last)
|
||
|
|
||
|
def clicked(self, button, signal):
|
||
|
self.emit(signal)
|
||
|
|
||
|
@GObject.Signal
|
||
|
def move_up(self): pass
|
||
|
|
||
|
@GObject.Signal
|
||
|
def move_down(self): pass
|