# Copyright 2008 by Kate Scheppke and Wade Brainerd.
# This file is part of Typing Turtle.
#
# Typing Turtle is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Typing Turtle is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Typing Turtle. If not, see .
# Import standard Python modules.
import logging, os, math, time, copy, json, locale, datetime, random, re
from gettext import gettext as _
# Import PyGTK.
import gobject, pygtk, gtk, pango
# Import Sugar UI modules.
import sugar.activity.activity
from sugar.graphics import *
class MedalScreen(gtk.EventBox):
def __init__(self, medal, activity):
gtk.EventBox.__init__(self)
self.modify_bg(gtk.STATE_NORMAL, self.get_colormap().alloc_color('#ffffff'))
self.medal = medal
self.activity = activity
cert0 = gtk.Label()
cert0.set_markup("" + _('Certificate of\nAchievement') + "")
cert1 = gtk.Label()
cert1.set_markup("" +
(_('This certifies that on %(date)s,\n%(nick)s earned a %(type)s medal\nin Typing Turtle lesson %(lesson)s.') % medal) +
"")
wpmlabel = gtk.Label()
wpmlabel.set_markup("" + (_('Words Per Minute: %(wpm)d') % medal) + "" )
accuracylabel = gtk.Label()
accuracylabel.set_markup("" + (_('Accuracy: %(accuracy)d%%') % medal) + "" )
statbox = gtk.HBox()
statbox.pack_start(wpmlabel, True)
statbox.pack_start(accuracylabel, True)
oklabel = gtk.Label()
oklabel.set_markup("" + _('Go Back') + '')
okbtn = gtk.Button()
okbtn.add(oklabel)
okbtn.connect('clicked', self.ok_cb)
btnbox = gtk.HBox()
btnbox.pack_start(okbtn, True, False)
vbox = gtk.VBox()
vbox.pack_start(cert0, True, False, 0)
vbox.pack_start(cert1, False, False, 0)
vbox.pack_start(gtk.HSeparator(), False, False, 20)
vbox.pack_start(statbox, False, False, 0)
vbox.pack_start(gtk.HSeparator(), False, False, 20)
vbox.pack_start(btnbox, False, False, 40)
self.add(vbox)
self.show_all()
def ok_cb(self, widget):
self.activity.pop_screen()