def __init__(self, default_value): gtk.HBox.__init__(self) self.m_value = mpd.notename_to_int(default_value) self.g_label = gtk.Label(mpd.int_to_user_octave_notename(self.m_value)) self.g_label.set_use_markup(1) frame = gtk.Frame() e = gtk.EventBox() frame.add(e) self.pack_start(frame, False) self.g_label.set_size_request(60, -1)#FIXME hardcoded value frame.set_shadow_type(gtk.SHADOW_IN) e.add(self.g_label) vbox = gtk.VBox() self.pack_start(vbox, False) # up self.g_up = gtk.Arrow(gtk.ARROW_UP, gtk.SHADOW_OUT) eb1 = gtk.EventBox() eb1.connect('button-press-event', self.on_up_press) eb1.connect('button-release-event', self.on_up_release) frame = gtk.Frame() frame.set_shadow_type(gtk.SHADOW_OUT) frame.add(self.g_up) eb1.add(frame) vbox.pack_start(eb1) # down self.g_down = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_ETCHED_IN) eb2 = gtk.EventBox() eb2.connect('button-press-event', self.on_down_press) eb2.connect('button-release-event', self.on_down_release) frame = gtk.Frame() frame.set_shadow_type(gtk.SHADOW_OUT) frame.add(self.g_down) eb2.add(frame) vbox.pack_start(eb2) self.m_timeout = None
def __init__(self, default_value): Gtk.Box.__init__(self) self.m_value = mpd.notename_to_int(default_value) self.g_entry = Gtk.Entry() self.g_entry.set_editable(False) self.g_entry.set_text(mpd.int_to_user_octave_notename(self.m_value)) self.pack_start(self.g_entry, False, False, 0) # up eb1 = Gtk.Button() eb1.add(Gtk.Arrow(Gtk.ArrowType.UP, Gtk.ShadowType.OUT)) eb1.connect('button-press-event', self.on_up_press) eb1.connect('button-release-event', self.on_up_release) self.pack_start(eb1, True, True, 0) # down eb2 = Gtk.Button() eb2.add(Gtk.Arrow(Gtk.ArrowType.DOWN, Gtk.ShadowType.IN)) eb2.connect('button-press-event', self.on_down_press) eb2.connect('button-release-event', self.on_down_release) self.pack_start(eb2, True, True, 0) self.m_timeout = None
def __init__(self, default_value): Gtk.Box.__init__(self) self.m_value = mpd.notename_to_int(default_value) self.g_label = Gtk.Label() self.g_label.set_width_chars(6) self.g_label.set_use_markup(True) self.g_label.set_markup(mpd.int_to_user_octave_notename(self.m_value)) self.g_label.props.xalign = 1.0 self.pack_start(self.g_label, False, False, 6) # up eb1 = Gtk.Button() eb1.add(Gtk.Arrow(Gtk.ArrowType.UP, Gtk.ShadowType.OUT)) eb1.connect('button-press-event', self.on_up_press) eb1.connect('button-release-event', self.on_up_release) self.pack_start(eb1, False, False, 0) # down eb2 = Gtk.Button() eb2.add(Gtk.Arrow(Gtk.ArrowType.DOWN, Gtk.ShadowType.IN)) eb2.connect('button-press-event', self.on_down_press) eb2.connect('button-release-event', self.on_down_release) self.pack_start(eb2, False, False, 0) self.m_timeout = None
def up(self): self.m_value += 1 self.g_entry.set_text(mpd.int_to_user_octave_notename(self.m_value)) self.emit('value-changed', self.m_value)
def set_value(self, val): self.m_value = val self.g_entry.set_text(mpd.int_to_user_octave_notename(val))
def set_value(self, val): self.m_value = val self.g_label.set_markup(mpd.int_to_user_octave_notename(val))
def up(self): self.m_value += 1 self.g_label.set_text(mpd.int_to_user_octave_notename(self.m_value)) self.g_label.set_use_markup(1) self.emit('value-changed', self.m_value)
def set_value(self, val): self.m_value = val self.g_label.set_text(mpd.int_to_user_octave_notename(val)) self.g_label.set_use_markup(1)
def down(self): self.m_value -= 1 self.g_entry.set_text(mpd.int_to_user_octave_notename(self.m_value)) self.emit('value-changed', self.m_value)