diff --git a/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyDict.xml b/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyDict.xml index 37c0e1beb5b0e76f8b8299e02e3b8268be14585f..5a8fe6adea58a6a53791c38e42f8daba42a93632 100644 --- a/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyDict.xml +++ b/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyDict.xml @@ -54,33 +54,15 @@ <item> <key> <string>_body</string> </key> <value> <string>"""\n -returns the list of possible values.\n -"""\n -# XXX it does not support multiple tested properties.\n -if configurable.getPortalType() == \'Solver Decision\':\n - solved_property = configurable.getCausalityValue(). \\\n - getTestedProperty()\n -else:\n - solved_property = configurable.getCausalityValue().getCausalityValue(). \\\n - getTestedProperty()\n +This script returns a dictionary of default properties for Unify Solver.\n \n -value_list = []\n -for movement in configurable.getDeliveryValueList():\n - value = movement.getProperty(solved_property)\n - if value not in value_list:\n - value_list.append(value)\n - simulation_movement_list = movement.getDeliveryRelatedValueList()\n - # if movement here is a delivery, we need to find simulation\n - # movements by its movements.\n - if len(simulation_movement_list) == 0:\n - simulation_movement_list = sum(\n - [x.getDeliveryRelatedValueList() \\\n - for x in configurable.getDeliveryValue().getMovementList()], [])\n - for simulation_movement in simulation_movement_list:\n - value = simulation_movement.getProperty(solved_property)\n - if value not in value_list:\n - value_list.append(value)\n -return {\'value_list\':[(x, str(x)) for x in value_list]}\n +This is a sample implementation that returns the first item in each list.\n +"""\n +value_list_dict = context.UnifySolver_getDefaultConfigurationPropertyListDict()\n +value_dict = {}\n +for property_id, value_list in value_list_dict.items():\n + value_dict[proeprty_id] = value_list[0]\n +return value_dict\n </string> </value> </item> <item> @@ -91,7 +73,7 @@ return {\'value_list\':[(x, str(x)) for x in value_list]}\n </item> <item> <key> <string>_params</string> </key> - <value> <string>configurable</string> </value> + <value> <string></string> </value> </item> <item> <key> <string>errors</string> </key> @@ -111,27 +93,22 @@ return {\'value_list\':[(x, str(x)) for x in value_list]}\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>1</int> </value> + <value> <int>0</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> - <string>configurable</string> <string>_getattr_</string> - <string>solved_property</string> - <string>value_list</string> + <string>context</string> + <string>value_list_dict</string> + <string>value_dict</string> <string>_getiter_</string> - <string>movement</string> - <string>value</string> - <string>simulation_movement_list</string> - <string>len</string> - <string>sum</string> - <string>append</string> - <string>$append0</string> - <string>x</string> - <string>simulation_movement</string> - <string>str</string> + <string>property_id</string> + <string>value_list</string> + <string>_getitem_</string> + <string>_write_</string> + <string>proeprty_id</string> </tuple> </value> </item> diff --git a/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyListDict.xml b/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyListDict.xml new file mode 100644 index 0000000000000000000000000000000000000000..cd218f1e8acde242922f0ccc58497aadf987c9f7 --- /dev/null +++ b/bt5/erp5_simulation/SkinTemplateItem/portal_skins/erp5_simulation/UnifySolver_getDefaultConfigurationPropertyListDict.xml @@ -0,0 +1,156 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>"""\n +This script returns a dictionary of possible values for Unify Solver.\n +"""\n +solver_decision = context.getCausalityValue()\n +tester = solver_decision.getCausalityValue()\n +value_list_dict = {}\n +for property_id in tester.getTestedProperty():\n + value_list = []\n + for simulation_movement in configurable.getDeliveryValueList():\n + movement = simulation_movement.getDeliveryValue()\n + value = movement.getProperty(property_id)\n + if value not in value_list:\n + value_list.append(value)\n + simulation_movement_list = movement.getDeliveryRelatedValueList()\n + value = simulation_movement.getProperty(property_id)\n + if value not in value_list:\n + value_list.append(value)\n + value_list_dict[property_id] = [(x, repr(x)) for x in value_list]\n +return value_list_dict\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>_getattr_</string> + <string>context</string> + <string>solver_decision</string> + <string>tester</string> + <string>value_list_dict</string> + <string>_getiter_</string> + <string>property_id</string> + <string>value_list</string> + <string>configurable</string> + <string>simulation_movement</string> + <string>movement</string> + <string>value</string> + <string>simulation_movement_list</string> + <string>append</string> + <string>$append0</string> + <string>x</string> + <string>repr</string> + <string>_write_</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>UnifySolver_getDefaultConfigurationPropertyListDict</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_simulation/bt/revision b/bt5/erp5_simulation/bt/revision index 176fdebf1bd8be248521f57896a16a3540e3f661..8bc6583717d617da1f8bf8bbaa7c16c25ef17113 100644 --- a/bt5/erp5_simulation/bt/revision +++ b/bt5/erp5_simulation/bt/revision @@ -1 +1 @@ -119 \ No newline at end of file +120 \ No newline at end of file