[Erp5-report] r14892 - /erp5/trunk/products/ERP5Form/PlanningBox.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jun 20 11:11:54 CEST 2007


Author: romain
Date: Wed Jun 20 11:11:53 2007
New Revision: 14892

URL: http://svn.erp5.org?rev=14892&view=rev
Log:
Restore planning box edition.
Thanks to Rafael Monnerat.

Modified:
    erp5/trunk/products/ERP5Form/PlanningBox.py

Modified: erp5/trunk/products/ERP5Form/PlanningBox.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/PlanningBox.py?rev=14892&r1=14891&r2=14892&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/PlanningBox.py (original)
+++ erp5/trunk/products/ERP5Form/PlanningBox.py Wed Jun 20 11:11:53 2007
@@ -100,13 +100,14 @@
     ############## REBUILD STRUCTURE #################
     ##################################################
     # build structure
-    widget_instance = PlanningBoxWidgetInstance.render_structure(field=field,
-                         key=key, value=value, REQUEST=REQUEST, here=here)
+    basic, planning = PlanningBoxWidgetInstance.render_structure(field=field,
+                          key=key, value=value, REQUEST= REQUEST, here=here)
 
     # getting coordinates script generator
     planning_coordinates_method = getattr(here,'planning_coordinates')
     # calling script to generate coordinates
-    planning_coordinates = planning_coordinates_method(structure=widget_instance)
+    planning_coordinates = planning_coordinates_method(basic=basic,
+                                                       planning=planning)
 
     ##################################################
     ########## RECOVERING BLOCK MOVED DICTS ##########
@@ -178,7 +179,7 @@
       final_block = {}
       # recovering the block object from block_moved informations
       final_block['block_object'] = self.getBlockObject(block_moved['name'], \
-                                                   widget_instance.planning.content)
+                                                        planning.content)
       # recovering original activity object
       final_block['activity_origin'] = \
            final_block['block_object'].parent_activity
@@ -204,7 +205,7 @@
       block_moved['top']  = block_moved['new_Y'] - deltaY
 
       # abstracting axis representation (for generic processing)
-      if widget_instance.planning.calendar_view == 0:
+      if planning.calendar_view == 0:
         block_moved['main_axis_position'] = block_moved['top']
         block_moved['main_axis_length'] = block_moved['height']
         block_moved['secondary_axis_position'] = block_moved['left']
@@ -230,7 +231,7 @@
       # now that block coordinates are recovered as well as planning
       # coordinates, recovering destination group over the main axis to know
       # if the block has been moved from a group to another
-      group_destination = self.getDestinationGroup(widget_instance,
+      group_destination = self.getDestinationGroup(basic, planning,
                block_moved,planning_coordinates['main_axis'],
                group_position, group_length)
 
@@ -248,7 +249,7 @@
       else:
         # now that all informations about the main axis changes are
         # known, checking modifications over the secondary axis.
-        secondary_axis_positions = self.getDestinationBounds(widget_instance,
+        secondary_axis_positions = self.getDestinationBounds(basic, planning,
                 block_moved, final_block['block_object'],
                 planning_coordinates, axis_length,
                 destination_group = group_destination)
@@ -279,7 +280,7 @@
     ##################################################
     # getting object_dict to update object properties once activities are up to
     # date. Activities values will be updated directly on the
-    object_dict = self.getObjectDict(widget_instance)
+    object_dict = self.getObjectDict(basic=basic, planning=planning)
 
     ##################################################
     ############# UPDATING ACTIVITIES ################
@@ -428,10 +429,10 @@
     """
     for block in content_list:
       if block.name == block_name:
-        return block
-
-
-  def getDestinationGroup(self, widget_instance, block_moved, axis_groups,
+        return block 
+
+
+  def getDestinationGroup(self, basic, planning, block_moved, axis_groups,
                                 group_position, group_length):
     """
     recover destination group from block coordinates and main axis coordinates
@@ -452,13 +453,13 @@
     if good_group_name == '':
       return None
     # group name is known, searching corresponding group object
-    for group in widget_instance.planning.main_axis.axis_group:
+    for group in planning.main_axis.axis_group:
       if group.name == good_group_name:
         return group
     return None
 
 
-  def getDestinationBounds(self, widget_instance, block_moved, block_object,
+  def getDestinationBounds(self, basic, planning, block_moved, block_object,
                                  planning_coordinates, axis_length,
                                  destination_group=None):
     """
@@ -492,20 +493,20 @@
         # to define any data out of its group bounds.
         pass
 
-    if widget_instance.basic.calendar_mode:
+    if basic.calendar_mode:
       axis_range = destination_group.secondary_axis_range
       new_start = destination_group.secondary_axis_start + \
                   delta_start * axis_range
       new_stop = destination_group.secondary_axis_start + \
                   delta_stop * axis_range
     else:
-      axis_range = widget_instance.basic.secondary_axis_info['bound_stop'] - \
-                   widget_instance.basic.secondary_axis_info['bound_start']
+      axis_range = basic.secondary_axis_info['bound_stop'] - \
+                   basic.secondary_axis_info['bound_start']
 
       # defining new final block bounds
-      new_start = widget_instance.basic.secondary_axis_info['bound_start'] + \
+      new_start = basic.secondary_axis_info['bound_start'] + \
                   delta_start * axis_range
-      new_stop  = widget_instance.basic.secondary_axis_info['bound_start'] + \
+      new_stop  = basic.secondary_axis_info['bound_start'] + \
                   delta_stop * axis_range
 
     return [new_start,new_stop, error]
@@ -561,19 +562,19 @@
 
     return [new_start,new_stop]
 
-  def getObjectDict(self, widget_instance):
+  def getObjectDict(self, basic, planning):
     """
     Takes all activities related to a specified object and return
     """
     # init dict
     object_dict = {}
     # get property_names
-    start_property = widget_instance.basic.field.get_value('x_start_bloc')
-    stop_property = widget_instance.basic.field.get_value('x_stop_bloc')
+    start_property = basic.field.get_value('x_start_bloc')
+    stop_property = basic.field.get_value('x_stop_bloc')
     # get full axis length
-    axis_start = widget_instance.basic.secondary_axis_info['bound_start']
-    axis_stop  = widget_instance.basic.secondary_axis_info['bound_stop']
-    for axis_group in widget_instance.planning.main_axis.axis_group:
+    axis_start = basic.secondary_axis_info['bound_start']
+    axis_stop  = basic.secondary_axis_info['bound_stop']
+    for axis_group in planning.main_axis.axis_group:
       for axis_element in axis_group.axis_element_list:
         for activity in axis_element.activity_list:
           # for each activity, saving its properties into a dict




More information about the Erp5-report mailing list