/usr/share/gcompris/python/admin/constants.py is in gcompris-data 13.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | # gcompris - constants.py
#
# Copyright (C) 2005, 2008 Bruno Coudoin and Yves Combe
#
# This program 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.
#
# This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
# Some common constants for the administration
COLUMN_WIDTH_LOGIN = 80
COLUMN_WIDTH_FIRSTNAME = 100
COLUMN_WIDTH_LASTNAME = 180
COLUMN_WIDTH_BIRTHDATE = 40
COLUMN_WIDTH_CLASSNAME = 100
COLUMN_WIDTH_TEACHER = 300
COLUMN_WIDTH_GROUPNAME = 100
COLUMN_WIDTH_GROUPDESCRIPTION = 200
COLUMN_WIDTH_GROUPDESCRIPTION_EDIT = 150
COLUMN_WIDTH_PROFILENAME = 100
COLUMN_WIDTH_PROFILEDESCRIPTION = 300
COLUMN_WIDTH_DATE = 140
COLUMN_WIDTH_NUMBER = 50
#
# Some utility method
# -------------------
# Return the next class id in the base
# Params are db_connect, db_cursor
def get_next_class_id(con, cur):
cur.execute('select max(class_id) from class')
class_id = cur.fetchone()[0]
if(class_id == None):
class_id=0
else:
class_id += 1
return class_id
# Return the next group id in the base
# Params are db_connect, db_cursor
def get_next_group_id(con, cur):
cur.execute('select max(group_id) from groups')
group_id = cur.fetchone()[0]
if(group_id == None):
group_id=0
else:
group_id += 1
return group_id
# Return the next profile id in the base
# Params are db_connect, db_cursor
def get_next_profile_id(con, cur):
cur.execute('select max(profile_id) from profiles')
profile_id = cur.fetchone()[0]
if(profile_id == None):
profile_id=0
else:
profile_id += 1
return profile_id
# get_wholegroup_id
# From the given class_id, return it's wholegroup_id
# Params are db_connect, db_cursor, class_id
def get_wholegroup_id(con, cur, class_id):
cur.execute('SELECT wholegroup_id FROM class WHERE class_id=?',
(class_id,))
return(cur.fetchone()[0])
# get_class_name_for_group_id
# From the given group_id, return it's class name
# Or "" if not found
def get_class_name_for_group_id(con, cur, group_id):
class_name = ""
# Extract the class name of this group
cur.execute('SELECT class_id FROM groups WHERE group_id=?',
(group_id,))
result = cur.fetchall()
if(result):
class_id = result[0][0]
cur.execute('SELECT name FROM class WHERE class_id=?',
(class_id,))
result = cur.fetchall()
if(result):
class_name = result[0][0]
return class_name
|