[gcompris/gcomprixo] Fixed for latest python that as 'with' being a keyword.



commit c717fcdbd94d37f01c39bf861852ca4e9e816392
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Sat May 16 18:42:07 2009 +0200

    Fixed for latest python that as 'with' being a keyword.
---
 src/administration-activity/admin/class_edit.py   |   44 +++++++-------
 src/administration-activity/admin/group_edit.py   |   64 ++++++++++----------
 src/administration-activity/admin/profile_edit.py |   62 ++++++++++----------
 3 files changed, 85 insertions(+), 85 deletions(-)

diff --git a/src/administration-activity/admin/class_edit.py b/src/administration-activity/admin/class_edit.py
index 75595e5..8301eac 100644
--- a/src/administration-activity/admin/class_edit.py
+++ b/src/administration-activity/admin/class_edit.py
@@ -1,21 +1,21 @@
 #  gcompris - class_edit.py
-# 
+#
 # Copyright (C) 2005 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 2 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, write to the Free Software
 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-# 
+#
 
 
 import gtk
@@ -52,11 +52,11 @@ class ClassEdit(gtk.Window):
         self.class_id = class_id
         self.class_name = class_name
         self.teacher_name = teacher_name
-        
+
         # A pointer to the user_list class
         # Will be called to refresh the list when edit is done
         self.list_class = list_class
-        
+
         self.set_title(_("Editing a Class"))
         self.set_border_width(8)
         self.set_default_size(320, 350)
@@ -67,12 +67,12 @@ class ClassEdit(gtk.Window):
         else:
             frame = gtk.Frame(_("Editing a new class"))
             self.new_class = True
-            
+
         # Connect the "destroy" event to close
         # FIXME: This makes the close code beeing called twice
         #        because the close destroy also call close again.
         frame.connect("destroy", self.close)
-        
+
         self.add(frame)
 
         # Main VBOX
@@ -86,7 +86,7 @@ class ClassEdit(gtk.Window):
         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,
@@ -98,7 +98,7 @@ class ClassEdit(gtk.Window):
                      xoptions=gtk.SHRINK, yoptions=gtk.EXPAND)
 
         # FIXME: How to remove the default selection
-        
+
         # Label and Entry for the teacher name
         label = gtk.Label(_('Teacher:'))
         label.set_alignment(0, 0)
@@ -136,7 +136,7 @@ class ClassEdit(gtk.Window):
         treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
 
         sw.add(treeview)
-        
+
         # add columns to the tree view
         self.__add_columns(treeview)
 
@@ -174,7 +174,7 @@ class ClassEdit(gtk.Window):
         treeview2.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
 
         sw2.add(treeview2)
-        
+
         # add columns to the tree view
         self.__add_columns(treeview2)
 
@@ -185,7 +185,7 @@ class ClassEdit(gtk.Window):
         vbox.pack_start(gtk.HSeparator(), False, False, 0)
 
         bbox = gtk.HBox(homogeneous=False, spacing=8)
-        
+
         button = gtk.Button(stock='gtk-help')
         bbox.pack_start(button, expand=False, fill=False, padding=0)
 
@@ -198,7 +198,7 @@ class ClassEdit(gtk.Window):
         button.connect("clicked", self.close)
 
         vbox.pack_start(bbox, False, False, 0)
-        
+
         # Missing callbacks
         button_delete.connect("clicked", self.remove_user, treeview2)
 
@@ -223,10 +223,10 @@ class ClassEdit(gtk.Window):
     # If class_id is provided, only users in this class are inserted
     # If with = True, create a list only with the given class_id.
     #           False, create a list only without the given class_id
-    def __create_model(self, with, class_id):
+    def __create_model(self, _with, class_id):
 
         # Grab the user data
-        if(with):
+        if(_with):
             self.cur.execute('SELECT user_id,firstname,lastname FROM users where class_id=? ORDER BY login', (class_id,))
         else:
             self.cur.execute('SELECT user_id,firstname,lastname FROM users WHERE class_id!=? ORDER BY login', (class_id,))
@@ -290,7 +290,7 @@ class ClassEdit(gtk.Window):
 
             # Add in the the right view
             self.add_user_in_model(self.model_right, (user_id, user_firstname, user_lastname))
-            
+
             # Save the change in the base
             self.cur.execute('UPDATE users SET class_id=? WHERE user_id=?',
                              (self.class_id, user_id))
@@ -303,7 +303,7 @@ class ClassEdit(gtk.Window):
         model = treeview.get_model()
         treestore, paths = treeview.get_selection().get_selected_rows()
         paths.reverse()
-        
+
         for path in paths:
             iter = treestore.get_iter(path)
             path = model.get_path(iter)[0]
@@ -314,7 +314,7 @@ class ClassEdit(gtk.Window):
 
             # Add in the the left view
             self.add_user_in_model(self.model_left, (user_id, user_firstname, user_lastname))
-            
+
             # Save the change in the base (1 Is the 'Unselected user' class)
             self.cur.execute('UPDATE users SET class_id=? where user_id=?', (1, user_id))
             self.con.commit()
@@ -328,7 +328,7 @@ class ClassEdit(gtk.Window):
                                self.class_name,
                                self.teacher_name)
         self.destroy()
-        
+
     # Done, can quit this dialog with saving
     #
     def ok(self, button):
@@ -376,7 +376,7 @@ class ClassEdit(gtk.Window):
     # Make the necessary checks and create the class in the base
     #
     def create_class(self):
-                
+
         # Check the login do not exist already
         self.cur.execute('SELECT name FROM class WHERE name=?',
                          (self.entry_class.get_text(),))
diff --git a/src/administration-activity/admin/group_edit.py b/src/administration-activity/admin/group_edit.py
index 089617c..774c80d 100644
--- a/src/administration-activity/admin/group_edit.py
+++ b/src/administration-activity/admin/group_edit.py
@@ -1,21 +1,21 @@
 #  gcompris - group_edit.py
-# 
+#
 # Copyright (C) 2005 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 2 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, write to the Free Software
 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-# 
+#
 
 
 import gtk
@@ -52,11 +52,11 @@ class GroupEdit(gtk.Window):
 
         self.group_id = group_id
         self.class_id = class_id
-        
+
         # A pointer to the group_user_list class
         # Will be called to refresh the list when edit is done
         self.group_user = group_user
-        
+
         self.set_title(_("Editing a Group"))
         self.set_border_width(8)
         self.set_default_size(320, 350)
@@ -74,7 +74,7 @@ class GroupEdit(gtk.Window):
 
 
         self.add(frame)
-        
+
         # Main VBOX
         vbox = gtk.VBox(False, 8)
         vbox.set_border_width(8)
@@ -86,7 +86,7 @@ class GroupEdit(gtk.Window):
         table.set_row_spacings(0)
         table.set_col_spacings(20)
         vbox.pack_start(table, True, True, 0)
-        
+
         label = gtk.Label(_('Group:'))
         label.set_alignment(0, 0)
         table.attach(label, 0, 1, 0, 1, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND)
@@ -97,7 +97,7 @@ class GroupEdit(gtk.Window):
                      xoptions=gtk.SHRINK, yoptions=gtk.EXPAND)
 
         # FIXME: How to remove the selection
-        
+
         # Label and Entry for the first name
         label = gtk.Label(_('Description:'))
         label.set_alignment(0, 0)
@@ -134,9 +134,9 @@ class GroupEdit(gtk.Window):
         treeview.set_rules_hint(True)
         treeview.set_search_column(COLUMN_FIRSTNAME)
         treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
-        
+
         sw.add(treeview)
-        
+
         # add columns to the tree view
         self.__add_columns(treeview)
 
@@ -177,7 +177,7 @@ class GroupEdit(gtk.Window):
         treeview2.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
 
         sw2.add(treeview2)
-        
+
         # add columns to the tree view
         self.__add_columns(treeview2)
 
@@ -188,7 +188,7 @@ class GroupEdit(gtk.Window):
         vbox.pack_start(gtk.HSeparator(), False, False, 0)
 
         bbox = gtk.HBox(homogeneous=False, spacing=8)
-        
+
         button = gtk.Button(stock='gtk-help')
         bbox.pack_start(button, expand=False, fill=False, padding=0)
 
@@ -228,7 +228,7 @@ class GroupEdit(gtk.Window):
     # group_id: only users in this group are inserted
     # If with = True,  create a list only with user in the given class_id and group_id.
     #           False, create a list only with user in the given class_id but NOT this group_id
-    def __create_model(self, with, class_id, group_id):
+    def __create_model(self, _with, class_id, group_id):
 
         model = gtk.ListStore(
             gobject.TYPE_INT,
@@ -246,10 +246,10 @@ class GroupEdit(gtk.Window):
             self.cur.execute('SELECT * FROM list_users_in_groups WHERE group_id=? AND user_id=?',
                              (group_id, user[0]))
             user_is_already = self.cur.fetchall()
-            
-            if(with and user_is_already):
+
+            if(_with and user_is_already):
                 self.add_user_in_model(model, user)
-            elif(not with and not user_is_already):
+            elif(not _with and not user_is_already):
                 self.add_user_in_model(model, user)
 
 
@@ -258,7 +258,7 @@ class GroupEdit(gtk.Window):
     def __add_columns(self, treeview):
 
         model = treeview.get_model()
-        
+
         # columns for first name
         renderer = gtk.CellRendererText()
         renderer.set_data("column", COLUMN_FIRSTNAME)
@@ -287,15 +287,15 @@ class GroupEdit(gtk.Window):
     def add_user(self, button, treeview):
 
         model = treeview.get_model()
-        
+
         treestore, paths = treeview.get_selection().get_selected_rows()
-        
+
         paths.reverse()
-        
+
         for path in paths:
-            
+
             iter = treestore.get_iter(path)
-            
+
             path = model.get_path(iter)[0]
             user_id        = model.get_value(iter, COLUMN_USERID)
             user_firstname = model.get_value(iter, COLUMN_FIRSTNAME)
@@ -304,7 +304,7 @@ class GroupEdit(gtk.Window):
 
             # Add in the the right view
             self.add_user_in_model(self.model_right, (user_id, user_firstname, user_lastname))
-            
+
             # Save the change in the base
             self.cur.execute('INSERT OR REPLACE INTO list_users_in_groups (group_id, user_id) VALUES (?, ?)',
                              (self.group_id, user_id))
@@ -316,15 +316,15 @@ class GroupEdit(gtk.Window):
     def remove_user(self, button, treeview):
 
         model = treeview.get_model()
-        
+
         treestore, paths = treeview.get_selection().get_selected_rows()
-        
+
         paths.reverse()
-        
+
         for path in paths:
-            
+
             iter = treestore.get_iter(path)
-            
+
             path = model.get_path(iter)[0]
             user_id        = model.get_value(iter, COLUMN_USERID)
             user_firstname = model.get_value(iter, COLUMN_FIRSTNAME)
@@ -333,7 +333,7 @@ class GroupEdit(gtk.Window):
 
             # Add in the the left view
             self.add_user_in_model(self.model_left, (user_id, user_firstname, user_lastname))
-            
+
             # Save the change in the base
             self.cur.execute('delete from list_users_in_groups where group_id=? and user_id=?',
                              (self.group_id, user_id))
@@ -346,7 +346,7 @@ class GroupEdit(gtk.Window):
     def close(self, button):
         self.group_user.reload_group()
         self.destroy()
-        
+
     # Done, can quit this dialog with saving
     #
     def ok(self, button):
diff --git a/src/administration-activity/admin/profile_edit.py b/src/administration-activity/admin/profile_edit.py
index 5e1d1e2..137ab8b 100644
--- a/src/administration-activity/admin/profile_edit.py
+++ b/src/administration-activity/admin/profile_edit.py
@@ -1,21 +1,21 @@
 #  gcompris - profile_edit.py
-# 
+#
 # Copyright (C) 2005 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 2 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, write to the Free Software
 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-# 
+#
 
 
 import gtk
@@ -55,7 +55,7 @@ class ProfileEdit(gtk.Window):
         # A pointer to the profile_list_list class
         # Will be called to refresh the list when edit is done
         self.profile_list = profile_list
-        
+
         self.set_title(_("Editing a Profile"))
         self.set_border_width(8)
         self.set_default_size(320, 350)
@@ -71,7 +71,7 @@ class ProfileEdit(gtk.Window):
 
 
         self.add(frame)
-        
+
         vbox = gtk.VBox(False, 8)
         vbox.set_border_width(8)
         frame.add(vbox)
@@ -82,7 +82,7 @@ class ProfileEdit(gtk.Window):
         table.set_row_spacings(0)
         table.set_col_spacings(20)
         vbox.pack_start(table, True, True, 0)
-        
+
         label = gtk.Label(_('Profile:'))
         label.set_alignment(0, 0)
         table.attach(label, 0, 1, 0, 1, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND)
@@ -93,7 +93,7 @@ class ProfileEdit(gtk.Window):
                      xoptions=gtk.SHRINK, yoptions=gtk.EXPAND)
 
         # FIXME: How to remove the selection
-        
+
         # Label and Entry for the first name
         label = gtk.Label(_('Description:'))
         label.set_alignment(0, 0)
@@ -130,9 +130,9 @@ class ProfileEdit(gtk.Window):
         treeview.set_rules_hint(True)
         treeview.set_search_column(COLUMN_GROUPNAME)
         treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
-        
+
         sw.add(treeview)
-        
+
         # add columns to the tree view
         self.__add_columns(treeview)
 
@@ -173,7 +173,7 @@ class ProfileEdit(gtk.Window):
         treeview2.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
 
         sw2.add(treeview2)
-        
+
         # add columns to the tree view
         self.__add_columns(treeview2)
 
@@ -184,7 +184,7 @@ class ProfileEdit(gtk.Window):
         vbox.pack_start(gtk.HSeparator(), False, False, 0)
 
         bbox = gtk.HBox(homogeneous=False, spacing=8)
-        
+
         button = gtk.Button(stock='gtk-help')
         bbox.pack_start(button, expand=False, fill=False, padding=0)
 
@@ -223,7 +223,7 @@ class ProfileEdit(gtk.Window):
     # profile_id: only groups in this profile are inserted
     # If with = True,  create a list only with groups in the given profile_id
     #           False, create a list only with groups NOT this profile_id
-    def __create_model(self, with, profile_id):
+    def __create_model(self, _with, profile_id):
 
         model = gtk.ListStore(
             gobject.TYPE_INT,
@@ -251,10 +251,10 @@ class ProfileEdit(gtk.Window):
 
             # Insert the class name in the group
             group = (group[0], class_name, group[1], group[2])
-            
-            if(with and group_is_already):
+
+            if(_with and group_is_already):
                 self.add_group_in_model(model, group)
-            elif(not with and not group_is_already):
+            elif(not _with and not group_is_already):
                 self.add_group_in_model(model, group)
 
         return model
@@ -262,7 +262,7 @@ class ProfileEdit(gtk.Window):
     def __add_columns(self, treeview):
 
         model = treeview.get_model()
-        
+
         # columns for class name
         renderer = gtk.CellRendererText()
         renderer.set_data("column", COLUMN_CLASSNAME)
@@ -299,15 +299,15 @@ class ProfileEdit(gtk.Window):
     def add_group(self, button, treeview):
 
         model = treeview.get_model()
-        
+
         treestore, paths = treeview.get_selection().get_selected_rows()
-        
+
         paths.reverse()
-        
+
         for path in paths:
-            
+
             iter = treestore.get_iter(path)
-            
+
             path = model.get_path(iter)[0]
             group_id           = model.get_value(iter, COLUMN_GROUPID)
             class_name         = model.get_value(iter, COLUMN_CLASSNAME)
@@ -318,7 +318,7 @@ class ProfileEdit(gtk.Window):
             # Add in the the right view
             self.add_group_in_model(self.model_right,
                                     (group_id, class_name, group_name, group_description))
-            
+
             # Save the change in the base
             self.cur.execute('INSERT OR REPLACE INTO list_groups_in_profiles ' +
                              '(profile_id, group_id) VALUES (?, ?)',
@@ -331,15 +331,15 @@ class ProfileEdit(gtk.Window):
     def remove_group(self, button, treeview):
 
         model = treeview.get_model()
-        
+
         treestore, paths = treeview.get_selection().get_selected_rows()
-        
+
         paths.reverse()
-        
+
         for path in paths:
-            
+
             iter = treestore.get_iter(path)
-            
+
             path = model.get_path(iter)[0]
             group_id           = model.get_value(iter, COLUMN_GROUPID)
             class_name         = model.get_value(iter, COLUMN_CLASSNAME)
@@ -350,7 +350,7 @@ class ProfileEdit(gtk.Window):
             # Add in the the left view
             self.add_group_in_model(self.model_left,
                                     (group_id, class_name, group_name, group_description))
-            
+
             # Save the change in the base
             self.cur.execute('DELETE FROM list_groups_in_profiles ' +
                              'WHERE profile_id=? AND group_id=?',
@@ -364,7 +364,7 @@ class ProfileEdit(gtk.Window):
     def close(self, button):
         self.profile_list.reload_profile()
         self.destroy()
-        
+
     # Done, can quit this dialog with saving
     #
     def ok(self, button):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]