Exemple #1
0
 def sad_face(self):
     l = gu.HarmonicProgressionLabel(_("Wrong"))
     l.show()
     self.g_box.pack_start(l, False)
     self.g_face = gtk.EventBox()
     self.g_face.connect('button_press_event', self.on_sadface_event)
     self.g_face.show()
     im = gtk.Image()
     im.set_from_stock('solfege-sadface', gtk.ICON_SIZE_LARGE_TOOLBAR)
     im.show()
     self.g_face.add(im)
     self.g_box.pack_start(self.g_face, False)
Exemple #2
0
 def happy_face(self):
     l = gu.HarmonicProgressionLabel(_("Correct"))
     l.show()
     self.g_box.pack_start(l, False, False, 0)
     self.g_face = Gtk.EventBox()
     self.g_face.connect('button_press_event', self.on_happyface_event)
     self.g_face.show()
     im = Gtk.Image()
     im.set_from_stock('solfege-happyface', Gtk.IconSize.LARGE_TOOLBAR)
     im.show()
     self.g_face.add(im)
     self.g_box.pack_start(self.g_face, False, False, 0)
Exemple #3
0
 def happy_face(self):
     l = gu.HarmonicProgressionLabel(_("Correct"))
     l.show()
     self.g_box.pack_start(l, False, False, 0)
     self.g_face = Gtk.EventBox()
     self.g_face.connect('button_press_event', self.on_happyface_event)
     self.g_face.show()
     im = Gtk.Image.new_from_icon_name(
         "face-smile", Gtk.IconSize.LARGE_TOOLBAR)
     im.show()
     self.g_face.add(im)
     self.g_box.pack_start(self.g_face, False, False, 0)
Exemple #4
0
def new_labelobject(label):
    """
    label can be one of the following types:
    * unicode string
    * lessonfile.LabelObject instance

    Return a gtk widget of some sort that displays the label.
    FIXME:
        If we in the future want some labels, for example chordlabel,
        to be transposable, then new_labelobject should return objects
        that are derived from gtk.Label, and they should have a
        a is_transposable method. Then Gui.on_new must call
        QuestionNameButtonTable and make it transpose the labels.
        But I don't think translated labels should have high priority.
    """
    if isinstance(label, basestring):
        # We hope all strings are unicode, but check for basestring just
        # in case some modules are wrong.
        l = gtk.Label(_i(label))
        l.show()
    else:
        if isinstance(label, tuple):
            # I think only old code
            # that has  been removed. But let us keep the code until
            # we have a chance to review.
            warnings.warn("lessonfilegui.new_labelobject: label is a tuple.",
                          DeprecationWarning)
            labeltype, labeldata = label
        else:
            labeltype = label.m_labeltype
            labeldata = label.m_labeldata
        if labeltype == 'progressionlabel':
            l = gu.HarmonicProgressionLabel(labeldata)
            l.show_all()
        else:
            l = gtk.Label()
            if labeltype == 'rnc':
                l.set_markup(rn_markup(labeldata))
            elif labeltype == 'chordname':
                l.set_markup(chordname_markup(labeldata))
            elif labeltype == 'plabel':
                l.set_markup(
                    """<span font_family="serif"><span size="xx-large">%s</span><span size="small">%s</span><span size="x-large">%s</span></span>"""
                    % labeldata)

            elif labeltype == 'pangomarkup':
                l.set_markup(labeldata)
            l.show()
    return l