[gcompris/gcomprisbraille: 3/3] Stop the drag on release|Bounds issue still to be fixed



commit 63b7893a398e257df6f42cce8048be928d3d1d63
Merge: 09c769f 45bc334
Author: SrishAkaTux <srishakatux gmail com>
Date:   Wed Aug 24 02:48:02 2011 +0530

    Stop the drag on release|Bounds issue still to be fixed

 src/louis_braille-activity/init_path.sh         |    2 +-
 src/louis_braille-activity/louis_braille.py     |    4 +---
 src/louis_braille-activity/louis_braille.xml.in |    2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)
---
diff --cc src/louis_braille-activity/init_path.sh
index 0f250c6,0f250c6..1bada2b
--- a/src/louis_braille-activity/init_path.sh
+++ b/src/louis_braille-activity/init_path.sh
@@@ -5,4 -5,4 +5,4 @@@ activity=louis_braill
  plugindir=$path/../boards/.libs
  pythonplugindir=$path/../braille_alphabets-activity:$path/../louis_braille-activity
  resourcedir=$path/resources
--section="/experimental"
++section="/experimental"
diff --cc src/louis_braille-activity/louis_braille.py
index 0275c30,65b7cc0..f66ae2f
--- a/src/louis_braille-activity/louis_braille.py
+++ b/src/louis_braille-activity/louis_braille.py
@@@ -136,21 -135,13 +136,20 @@@ class Gcompris_louis_braille
                               font = 'SANS 9',
                               width = 500,
                               )
 -              # It is hard to manage focus when we move the item
 -              #gcompris.utils.item_focus_init(self.dragText, self.dragRect)
 -              group_item.connect("button_press_event", self.component_drag)
 -              group_item.connect("motion_notify_event", self.component_drag)
 -              group_item.connect("button_release_event", self.component_drag)
  
 +              #Calculate y coordinates of each group item
 +              bounds = group_item.get_bounds()
 +              coord_item = (bounds.y1 + bounds.y2 )/ 2
 +
 +              #Append all group items and coordinates of them in an array
 +              self.groupitem_array.append(group_item)
 +              self.coorditem_array.append(coord_item)
 +
 +              # It is hard to manage focus when we move the item
 +              group_item.connect("button_press_event", self.component_drag, index)
 +              group_item.connect("motion_notify_event", self.component_drag, index)
 +              group_item.connect("button_release_event", self.component_drag, index)
  
- 
            ok = goocanvas.Svg(parent = self.rootitem,
                           svg_handle = gcompris.skin.svg_get(),
                           svg_id = "#OK",
@@@ -274,27 -263,10 +273,26 @@@
            groupitem.translate(0, event.y - self.offset_y)
  
        elif event.type == gtk.gdk.BUTTON_RELEASE:
 -        pass
 -        # Must find the closer stop to drop this item
 +        bounds = groupitem.get_bounds()
 +        self.mid_bounds = (bounds.y1 + bounds.y2) / 2
 +
-         groupitem.translate(0, 100)
+ 
 -      return True
 +        # Must find the closer stop to drop this item
 +        while(self.item < 11):
 +          if (self.coorditem_array[self.item] < self.mid_bounds and self.coorditem_array[self.item + 1] \
 +               > self.mid_bounds):
 +              if( self.mid_bounds - self.coorditem_array[self.item] < self.coorditem_array[self.item + 1] \
 +                   - self.mid_bounds ) :
 +                  #TODO
 +                  #Here I want to translate the group item to calculated bound
 +                  #But it goes somewhere else
 +                  groupitem.translate(0, self.coorditem_array[self.item])
 +                  print self.coorditem_array[self.item]
 +              else :
 +                  groupitem.translate(0, self.coorditem_array[self.item + 1])
 +                  print self.coorditem_array[self.item + 1]
 +          self.item += 1
 +      self.item = 0
-       return True
  
    def enter_callback(self, event, widget, index):
        print self.widget_array[index].get_text()
diff --cc src/louis_braille-activity/louis_braille.xml.in
index c33b9d3,c33b9d3..ceeca1a
--- a/src/louis_braille-activity/louis_braille.xml.in
+++ b/src/louis_braille-activity/louis_braille.xml.in
@@@ -17,4 -17,4 +17,4 @@@
          <credit>Louis Braille Video :http://bit.ly/qedAtc</credit>
    </Board>
    <Data directory=""/>
--</GCompris>
++</GCompris>



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