gcompris r3366 - branches/gcomprixogoo/src/administration-activity/admin



Author: bcoudoin
Date: Sun Apr 13 00:29:14 2008
New Revision: 3366
URL: http://svn.gnome.org/viewvc/gcompris?rev=3366&view=rev

Log:
improved the amdinistration module port to goocanvas.


Modified:
   branches/gcomprixogoo/src/administration-activity/admin/board_list.py
   branches/gcomprixogoo/src/administration-activity/admin/module.py

Modified: branches/gcomprixogoo/src/administration-activity/admin/board_list.py
==============================================================================
--- branches/gcomprixogoo/src/administration-activity/admin/board_list.py	(original)
+++ branches/gcomprixogoo/src/administration-activity/admin/board_list.py	Sun Apr 13 00:29:14 2008
@@ -54,6 +54,9 @@
       # Create the profiles Combo
       self.profiles_list = gcompris.admin.get_profiles_list()
 
+      if not self.profiles_list:
+        return
+
       # Get default pofile id.
       self.cur.execute('SELECT profile_id FROM informations;')
       self.con.commit()
@@ -91,7 +94,6 @@
       combobox.show()
       box1.pack_start(combobox, False, False, 0)
 
-      i = 0
       for profile in self.profiles_list:
         combobox.append_text(profile.name)
         if profile.profile_id == self.default_profile_id:

Modified: branches/gcomprixogoo/src/administration-activity/admin/module.py
==============================================================================
--- branches/gcomprixogoo/src/administration-activity/admin/module.py	(original)
+++ branches/gcomprixogoo/src/administration-activity/admin/module.py	Sun Apr 13 00:29:14 2008
@@ -46,7 +46,6 @@
 
     def init(self, index, select_area, callback):
         height = 80
-        gap = 35
         x   = select_area[0] + (select_area[2] - select_area[0]) / 2
         y1  = select_area[1] + height * index + 2
         y2  = select_area[1] + height * (index + 1) + 1
@@ -70,8 +69,8 @@
             )
         self.select_item.connect("button_press_event", callback, self)
 
-        y1 += 30
-        item = goocanvas.Image(
+        y1 += 5
+        itemimg = goocanvas.Image(
             parent = self.root_select_item,
             pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin("config_" +
                                                                             self.module_name +
@@ -79,20 +78,27 @@
             x = x,
             y = y1,
             )
-        item.connect("button_press_event", callback, self)
+        bounds = itemimg.get_bounds()
+        centered_x = x - (bounds.x2 - bounds.x1)/2
+        itemimg.props.x = centered_x
+        itemimg.connect("button_press_event", callback, self)
+        gcompris.utils.item_focus_init(itemimg, None)
 
-        y1 += gap
+        y1 += bounds.y2 - bounds.y1
 
         item = goocanvas.Text(
             parent = self.root_select_item,
             text=_(self.module_label),
-            font=gcompris.skin.get_font("gcompris/tiny"),
-            x = x,
+            font = "Sans 8",
+            x = centered_x,
             y = y1,
             fill_color="black"
             )
+        bounds = item.get_bounds()
+        centered_x = x - (bounds.x2 - bounds.x1)/2
+        item.props.x = centered_x
         item.connect("button_press_event", callback, self)
-
+        gcompris.utils.item_focus_init(item, itemimg)
 
     def get_module_name(self):
         return self.module_name



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