예제 #1
0
 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_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
예제 #2
0
 def up(self):
     self.m_value += 1
     self.g_label.set_text(mpd.int_to_user_notename(self.m_value))
     self.g_label.set_use_markup(1)
     self.emit('value-changed', self.m_value)
예제 #3
0
 def set_value(self, val):
     self.m_value = val
     self.g_label.set_text(mpd.int_to_user_notename(val))
     self.g_label.set_use_markup(1)