Back to index

gcompris  8.2.2
wordlist.py
Go to the documentation of this file.
00001 #  gcompris - board_list.py
00002 #
00003 # Copyright (C) 2005 Yves Combe
00004 #
00005 #   This program is free software; you can redistribute it and/or modify
00006 #   it under the terms of the GNU General Public License as published by
00007 #   the Free Software Foundation; either version 2 of the License, or
00008 #   (at your option) any later version.
00009 #
00010 #   This program is distributed in the hope that it will be useful,
00011 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 #   GNU General Public License for more details.
00014 #
00015 #   You should have received a copy of the GNU General Public License
00016 #   along with this program; if not, write to the Free Software
00017 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 #
00019 
00020 import gnomecanvas
00021 import gcompris
00022 import gcompris.utils
00023 import gcompris.skin
00024 import gcompris.admin
00025 import gtk
00026 import gtk.gdk
00027 import gobject
00028 from gettext import gettext as _
00029 
00030 import glob
00031 
00032 class Words_list:
00033   """GCompris Words  List Tool"""
00034 
00035 
00036   # area is the drawing area for the list
00037   def __init__(self, db_connect, db_cursor, profile):
00038 
00039     self.cur = db_cursor
00040     self.con = db_connect
00041     self.active_profile = profile
00042 
00043     print "Words_list __init__"
00044 
00045     files = glob.glob('wordlist_*.xml')
00046 
00047     print "Matching files :", files
00048 
00049     self.main_vbox = gcompris.configuration_window ( \
00050       _('<b>%s</b> configuration\n for profile <b>%s</b>') % ('Wordlist', self.active_profile.name ),
00051       self.wordlist_callback
00052       )
00053 
00054     self.prop = gcompris.get_properties()
00055 
00056     self.wordlist_dir = self.prop.shared_dir +'/wordlist'
00057 
00058     print self.wordlist_dir
00059 
00060     gcompris.textview('Words list',
00061                       'wordlist',
00062                       'Enter the words, comma, space, return separated. Then click on th check button.',
00063                       '',
00064                       self.wordlist_validate)
00065 
00066   def wordlist_callback(self, table):
00067     print "wordlist_callback"
00068     for k, v in table.iteritems():
00069       print k, v
00070 
00071 
00072   def wordlist_validate( self, key, text, label):
00073     print "wordlist_validate"
00074     print key, text
00075     label.set_markup(text)
00076     return True
00077 
00078 
00079