Commit e810afc2 authored by Bruno Coudoin's avatar Bruno Coudoin
Browse files

- Renamed the official name of gcompris edit is now gcompris administration

	  It is now started with gcompris -a
	- Reworked modules statup to work like Yves did
	- Reworked class edit to also edit the class name and teacher.
	  In the end it will not be possible to edit in the tables anymore.
	  This still does not update the parent list.
parent ab21485a
2005-07-26 Bruno coudoin <bruno.coudoin@free.fr>
- Renamed the official name of gcompris edit is now gcompris administration
It is now started with gcompris -a
- Reworked modules statup to work like Yves did
- Reworked class edit to also edit the class name and teacher.
In the end it will not be possible to edit in the tables anymore.
This still does not update the parent list.
* boards/skins/babytoy/skin.xml:
* boards/skins/default/skin.xml:
* boards/skins/linha_verde/skin.xml:
* boards/skins/pink/skin.xml:
* gcompris-edit.desktop.in:
* src/boards/python/admin/board_list.py:
* src/boards/python/admin/class_edit.py:
* src/boards/python/admin/class_list.py:
* src/boards/python/admin/group_list.py:
* src/boards/python/admin/module.py:
* src/boards/python/admin/module_boards.py:
* src/boards/python/admin/module_groups.py:
* src/boards/python/admin/module_profiles.py:
* src/boards/python/admin/module_users.py:
* src/boards/python/admin/profile_list.py:
* src/boards/python/admin/user_list.py:
* src/boards/python/administration.py:
* src/gcompris/gcompris.c:
2005-07-26 Yves Combe <yves@ycombe.net>
gcompris_combo_box (gcompris.combo_box) configuration fonction for text combobox.
......
......@@ -14,6 +14,7 @@
<font id="gcompris/title" name="Sans 20"/>
<font id="gcompris/subtitle" name="Sans 16"/>
<font id="gcompris/content" name="Sans 12"/>
<font id="gcompris/tiny" name="Sans 10"/>
<!-- Defines the gcompris boards fonts -->
<font id="gcompris/board/tiny" name="Sans 10"/>
......
......@@ -14,6 +14,7 @@
<font id="gcompris/title" name="Sans 20"/>
<font id="gcompris/subtitle" name="Sans 16"/>
<font id="gcompris/content" name="Sans 12"/>
<font id="gcompris/tiny" name="Sans 10"/>
<!-- Defines the gcompris boards fonts -->
<font id="gcompris/board/tiny" name="Sans 10"/>
......
......@@ -14,6 +14,7 @@
<font id="gcompris/title" name="Sans 20"/>
<font id="gcompris/subtitle" name="Sans 16"/>
<font id="gcompris/content" name="Sans 12"/>
<font id="gcompris/tiny" name="Sans 10"/>
<!-- Defines the gcompris boards fonts -->
<font id="gcompris/board/tiny" name="Sans 10"/>
......
......@@ -14,6 +14,7 @@
<font id="gcompris/title" name="Sans 20"/>
<font id="gcompris/subtitle" name="Sans 16"/>
<font id="gcompris/content" name="Sans 12"/>
<font id="gcompris/tiny" name="Sans 10"/>
<!-- Defines the gcompris boards fonts -->
<font id="gcompris/board/tiny" name="Sans 10"/>
......
[Desktop Entry]
Encoding=UTF-8
Name=GCompris Editor
_Comment=Editor for gcompris
Exec=gcompris -e
Name=GCompris Administration
_Comment=Administration for gcompris
Exec=gcompris -a
Icon=gcompris-edit.png
Terminal=0
Type=Application
......
......@@ -65,13 +65,13 @@ class Board_list:
top_box.show()
self.frame.add(top_box)
box1 = gtk.HBox(False, 0)
box1 = gtk.HBox(False, 8)
box1.show()
box2 = gtk.HBox(False, 0)
box2 = gtk.HBox(False, 8)
box2.show()
box3 = gtk.VBox(False, 0)
box3 = gtk.VBox(False, 8)
box3.show()
top_box.pack_start(box1, False, False, 0)
......@@ -307,6 +307,8 @@ class Board_list:
def changed_cb(self, combobox):
index = combobox.get_active()
if(index<0):
return
self.active_profile = self.profiles_list[index]
print 'Active profile is now', self.active_profile.name
......
......@@ -41,7 +41,7 @@ import constants
class ClassEdit(gtk.Window):
counter = 1
def __init__(self, db_connect, db_cursor,
class_id, class_name,
class_id, class_name, teacher_name,
list_user):
# Create the toplevel window
gtk.Window.__init__(self)
......@@ -59,14 +59,46 @@ class ClassEdit(gtk.Window):
self.set_border_width(8)
self.set_default_size(320, 350)
frame = gtk.Frame(_("Editing class: ") + class_name)
if(class_name):
frame = gtk.Frame(_("Editing class: ") + class_name)
else:
frame = gtk.Frame(_("Editing a new class"))
self.add(frame)
# Main VBOX
vbox = gtk.VBox(False, 8)
vbox.set_border_width(8)
frame.add(vbox)
# Label and Entry for the class name
table = gtk.Table(2, 2, homogeneous=False)
table.set_border_width(0)
table.set_row_spacings(0)
table.set_col_spacings(20)
vbox.pack_start(table, True, True, 0)
label = gtk.Label(_('Class:'))
label.set_alignment(0, 0)
table.attach(label, 0, 1, 0, 1, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND)
self.entry_class = gtk.Entry()
self.entry_class.set_max_length(20)
self.entry_class.insert_text(class_name, position=0)
table.attach(self.entry_class, 1, 2, 0, 1, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND)
# FIXME: How to remove the selection
# Label and Entry for the teacher name
label = gtk.Label(_('Teacher:'))
label.set_alignment(0, 0)
table.attach(label, 0, 1, 1, 2, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND)
self.entry_teacher = gtk.Entry()
self.entry_teacher.set_max_length(30)
self.entry_teacher.insert_text(teacher_name, position=0)
table.attach(self.entry_teacher, 1, 2, 1, 2, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND)
# Top message gives instructions
vbox.pack_start(gtk.HSeparator(), False, False, 0)
label = gtk.Label(_('Assign all the users bellonging to this class'))
vbox.pack_start(label, False, False, 0)
vbox.pack_start(gtk.HSeparator(), False, False, 0)
......@@ -141,16 +173,17 @@ class ClassEdit(gtk.Window):
# --------------------
vbox.pack_start(gtk.HSeparator(), False, False, 0)
bbox = gtk.HButtonBox()
bbox.set_border_width(5)
bbox.set_layout(gtk.BUTTONBOX_EDGE)
bbox.set_spacing(40)
bbox = gtk.HBox(homogeneous=False, spacing=8)
button = gtk.Button(stock='gtk-help')
bbox.add(button)
bbox.pack_start(button, expand=False, fill=False, padding=0)
button = gtk.Button(stock='gtk-ok')
bbox.pack_end(button, expand=False, fill=False, padding=0)
button.connect("clicked", self.ok)
button = gtk.Button(stock='gtk-close')
bbox.add(button)
bbox.pack_end(button, expand=False, fill=False, padding=0)
button.connect("clicked", self.close)
vbox.pack_start(bbox, False, False, 0)
......@@ -271,9 +304,25 @@ class ClassEdit(gtk.Window):
self.con.commit()
# Done, can quit this dialog
# Done, can quit this dialog (without saving)
#
def close(self, button):
self.list_user.reload(self.class_id)
self.destroy()
# Done, can quit this dialog with saving
#
def ok(self, button):
class_data = (self.class_id,
self.entry_class.get_text(),
self.entry_teacher.get_text()
)
# Save the changes in the base
self.cur.execute('insert or replace into class (class_id, name, teacher) values (?, ?, ?)', class_data)
self.con.commit()
# Close the dialog window now
self.list_user.reload(self.class_id)
self.destroy()
......@@ -48,9 +48,8 @@ class Class_list:
# area is the drawing area for the list
def __init__(self, canvas, db_connect, db_cursor, area, hgap, vgap):
def __init__(self, frame, db_connect, db_cursor):
self.rootitem = canvas
self.cur = db_cursor
self.con = db_connect
......@@ -60,9 +59,6 @@ class Class_list:
# Class Management
# ---------------
frame = gtk.Frame(_("Classes") + " / " + _("Users") )
frame.show()
# create tree model
model = self.__create_model_class()
......@@ -139,20 +135,6 @@ class Class_list:
selection.connect('changed', self.class_changed_cb, self.list_user)
# Pack it all
# -----------
self.rootitem.add(
gnome.canvas.CanvasWidget,
widget=frame,
x=area[0] + hgap,
y=area[1],
width=area[2]-area[0] - hgap*2,
height=area[3]-area[1],
anchor=gtk.ANCHOR_NW,
size_pixels=False)
# -------------------
# Class Management
# -------------------
......@@ -284,10 +266,11 @@ class Class_list:
if iter:
path = model.get_path(iter)[0]
class_id = model.get_value(iter, COLUMN_CLASSID)
class_name = model.get_value(iter, COLUMN_NAME)
class_id = model.get_value(iter, COLUMN_CLASSID)
class_name = model.get_value(iter, COLUMN_NAME)
teacher_name = model.get_value(iter, COLUMN_TEACHER)
class_edit.ClassEdit(self.con, self.cur,
class_id, class_name,
class_id, class_name, teacher_name,
self.list_user)
......
......@@ -48,9 +48,8 @@ class Group_list:
# area is the drawing area for the list
def __init__(self, canvas, db_connect, db_cursor, area, hgap, vgap):
def __init__(self, frame, db_connect, db_cursor):
self.rootitem = canvas
self.cur = db_cursor
self.con = db_connect
......@@ -65,9 +64,6 @@ class Group_list:
# Group Management
# ---------------
frame = gtk.Frame(_("Group"))
frame.show()
# create tree model
self.group_model = self.__create_model_group()
......@@ -170,17 +166,6 @@ class Group_list:
selection = treeview_group.get_selection()
selection.connect('changed', self.group_changed_cb, self.group_user)
# Pack it all
self.rootitem.add(
gnome.canvas.CanvasWidget,
widget=frame,
x=area[0] + hgap,
y=area[1],
width=area[2]-area[0] - hgap*2,
height=area[3]-area[1],
anchor=gtk.ANCHOR_NW,
size_pixels=False)
# Load lists
self.class_changed_cb(self.combo_class)
self.reload_group()
......@@ -357,5 +342,8 @@ class Group_list:
group_user.reload(self.current_group_id)
def class_changed_cb(self, combobox):
self.current_class_id = self.class_list[combobox.get_active()]
active = combobox.get_active()
if active < 0:
return
self.current_class_id = self.class_list[active]
self.reload_group()
......@@ -38,7 +38,7 @@ class Module:
self.selector_color = 0xC5D2DDFFL
self.outline_color = 0XD8B09AFFL
self.module_panel_ofset = 3
# Return the position it must have in the administration menu
# The smaller number is the highest.
......@@ -97,7 +97,7 @@ class Module:
item = self.root_select_item.add (
gnome.canvas.CanvasText,
text=_(self.module_label),
font=gcompris.skin.get_font("gcompris/content"),
font=gcompris.skin.get_font("gcompris/tiny"),
x = x,
y = y1,
fill_color="black"
......
......@@ -55,24 +55,6 @@ class Boards(module.Module):
module.Module.start(self)
# item = self.rootitem.add (
# gnome.canvas.CanvasText,
# text=_(self.module_label + " Panel"),
# font=gcompris.skin.get_font("gcompris/content"),
# x = area[0] + (area[2]-area[0])/2,
# y = area[1] + 50,
# fill_color="black"
# )
hgap = 20
vgap = 15
origin_y = area[1]+vgap
boards_height = (area[3]-area[1]) - vgap*2
list_area = ( area[0], origin_y, area[2], boards_height)
# Connect to our database
self.con = sqlite.connect(gcompris.get_database())
self.cur = self.con.cursor()
......@@ -83,10 +65,10 @@ class Boards(module.Module):
self.rootitem.add(
gnome.canvas.CanvasWidget,
widget=frame,
x=area[0],
y=area[1],
width=area[2]-area[0],
height=area[3]-area[1],
x=area[0]+self.module_panel_ofset,
y=area[1]+self.module_panel_ofset,
width=area[2]-area[0]-2*self.module_panel_ofset,
height=area[3]-area[1]-2*self.module_panel_ofset,
anchor=gtk.ANCHOR_NW,
size_pixels=False)
......
......@@ -64,19 +64,21 @@ class Groups(module.Module):
# Call our parent start
module.Module.start(self)
hgap = 20
vgap = 15
frame = gtk.Frame(_("Group"))
frame.show()
# Define the area percent for each list
group_percent = 1.0
self.rootitem.add(
gnome.canvas.CanvasWidget,
widget=frame,
x=area[0]+self.module_panel_ofset,
y=area[1]+self.module_panel_ofset,
width=area[2]-area[0]-2*self.module_panel_ofset,
height=area[3]-area[1]-2*self.module_panel_ofset,
anchor=gtk.ANCHOR_NW,
size_pixels=False)
origin_y = area[1]+vgap
group_height = (area[3]-area[1])*group_percent - vgap
list_area = ( area[0], origin_y, area[2], group_height)
group_list.Group_list(self.rootitem,
self.con, self.cur,
list_area, hgap, vgap)
group_list.Group_list(frame, self.con, self.cur)
def stop(self):
......
......@@ -63,19 +63,20 @@ class Profiles(module.Module):
module.Module.start(self)
hgap = 20
vgap = 15
# Define the area percent for each list
group_percent = 1.0
origin_y = area[1]+vgap
group_height = (area[3]-area[1])*group_percent - vgap
list_area = ( area[0], origin_y, area[2], group_height)
profile_list.Profile_list(self.rootitem,
self.con, self.cur,
list_area, hgap, vgap)
frame = gtk.Frame(_("Profile"))
frame.show()
self.rootitem.add(
gnome.canvas.CanvasWidget,
widget=frame,
x=area[0]+self.module_panel_ofset,
y=area[1]+self.module_panel_ofset,
width=area[2]-area[0]-2*self.module_panel_ofset,
height=area[3]-area[1]-2*self.module_panel_ofset,
anchor=gtk.ANCHOR_NW,
size_pixels=False)
profile_list.Profile_list(frame, self.con, self.cur)
def stop(self):
print "stopping profiles panel"
......
......@@ -65,20 +65,21 @@ class Users(module.Module):
# Call our parent start
module.Module.start(self)
hgap = 20
vgap = 15
frame = gtk.Frame(_("Classes") + " / " + _("Users") )
frame.show()
# Define the area percent for each list
class_percent = 1.0
origin_y = area[1]+vgap
class_height = (area[3]-area[1])*class_percent - vgap
list_area = ( area[0], origin_y, area[2], class_height)
class_list.Class_list(self.rootitem,
self.con, self.cur,
list_area, hgap, vgap)
self.rootitem.add(
gnome.canvas.CanvasWidget,
widget=frame,
x=area[0]+self.module_panel_ofset,
y=area[1]+self.module_panel_ofset,
width=area[2]-area[0]-2*self.module_panel_ofset,
height=area[3]-area[1]-2*self.module_panel_ofset,
anchor=gtk.ANCHOR_NW,
size_pixels=False)
class_list.Class_list(frame, self.con, self.cur)
def stop(self):
......
......@@ -48,9 +48,8 @@ class Profile_list:
# area is the drawing area for the list
def __init__(self, canvas, db_connect, db_cursor, area, hgap, vgap):
def __init__(self, frame, db_connect, db_cursor):
self.rootitem = canvas
self.cur = db_cursor
self.con = db_connect
......@@ -67,9 +66,6 @@ class Profile_list:
# Profile Management
# ---------------
frame = gtk.Frame(_("Profile"))
frame.show()
# create tree model
self.profile_model = self.__create_model_profile()
......@@ -146,17 +142,6 @@ class Profile_list:
selection = treeview_profile.get_selection()
selection.connect('changed', self.profile_changed_cb, self.profile_group)
# Pack it all
self.rootitem.add(
gnome.canvas.CanvasWidget,
widget=frame,
x=area[0] + hgap,
y=area[1],
width=area[2]-area[0] - hgap*2,
height=area[3]-area[1],
anchor=gtk.ANCHOR_NW,
size_pixels=False)
# Load lists
self.reload_profile()
......
......@@ -258,7 +258,7 @@ class User_list:
dialog = gtk.MessageDialog(None,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
_("To import a file, it must be formated like this:\nlogin;First name;Last name;Birth date\nThe separator is autodetected and can be one of ',', ';' or ':'"))
_("To import a user list from file, first select a class.\FILE FORMAT: Your file must be formated like this:\nlogin;First name;Last name;Birth date\nThe separator is autodetected and can be one of ',', ';' or ':'"))
dialog.run()
dialog.destroy()
......
......@@ -104,6 +104,7 @@ class Gcompris_administration:
width_units=1.0
)
# A White background in the panel area
self.rootitem.add(
gnome.canvas.CanvasRect,
x1=self.panel_area[0],
......
/* gcompris - gcompris.c
*
* Time-stamp: <2005/07/25 00:32:32 bruno>
* Time-stamp: <2005/07/26 00:57:47 bruno>
*
* Copyright (C) 2000-2003 Bruno Coudoin
*
......@@ -113,7 +113,7 @@ static struct poptOption options[] = {
N_("display debug informations on the console."), NULL},
{"version", 'v', POPT_ARG_NONE, &popt_version, 0,
N_("Print the version of " PACKAGE), NULL},
{"antialiased", 'a', POPT_ARG_NONE, &popt_aalias, 0,
{"antialiased", '\0', POPT_ARG_NONE, &popt_aalias, 0,
N_("Use the antialiased canvas (slower)."), NULL},
{"noxrandr", 'x', POPT_ARG_NONE, &popt_noxrandr, 0,
N_("Disable XRANDR (No screen resolution change)."), NULL},
......@@ -121,7 +121,7 @@ static struct poptOption options[] = {
N_("Run gcompris with local menu (e.g -l /reading will let you play only reading activity directory, -l /boards/connect4 only the connect4 activity), -l list show the list of menus and activity"), NULL},
{"local-activity", 'L', POPT_ARG_STRING, &popt_local_activity, 0,
N_("Run gcompris with local activity directory added to menu"), NULL},
{"administration", 'e', POPT_ARG_NONE, &popt_administration, 0,
{"administration", 'a', POPT_ARG_NONE, &popt_administration, 0,
N_("Run gcompris with administration and users management mode"), NULL},
{"database", 'b', POPT_ARG_STRING, &popt_database, 0,
N_("Use alternate database for profiles"), NULL},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment