Ver Fonte

on_action parameter removed (#311) (#316)

* #311 on_action parameter removed

* remove on_action from parameters

* on_creation not defined

* format

---------

Co-authored-by: Fred Lefévère-Laoide <Fred.Lefevere-Laoide@Taipy.io>
Fred Lefévère-Laoide há 1 ano atrás
pai
commit
28e4c59758
2 ficheiros alterados com 5 adições e 5 exclusões
  1. 3 3
      src/taipy/gui_core/_context.py
  2. 2 2
      src/taipy/gui_core/viselements.json

+ 3 - 3
src/taipy/gui_core/_context.py

@@ -239,8 +239,8 @@ class _GuiCoreContext(CoreEventConsumerBase):
                             on_creation_function,
                             [
                                 id,
-                                on_creation,
                                 {
+                                    "action": on_creation,
                                     "config": scenario_config,
                                     "date": date,
                                     "label": name,
@@ -261,7 +261,7 @@ class _GuiCoreContext(CoreEventConsumerBase):
                     except Exception as e:  # pragma: no cover
                         if not gui._call_on_exception(on_creation, e):
                             _warn(f"on_creation(): Exception raised in '{on_creation}()'", e)
-                else:
+                elif on_creation is not None:
                     _warn(f"on_creation(): '{on_creation}' is not a function.")
                 scenario = create_scenario(scenario_config, date, name)
             except Exception as e:
@@ -301,7 +301,7 @@ class _GuiCoreContext(CoreEventConsumerBase):
             except Exception as e:
                 state.assign(_GuiCoreContext._SCENARIO_VIZ_ERROR_VAR, f"Error updating Scenario. {e}")
 
-    def submit_entity(self, state: State, id: str, submission_cb: str, payload: t.Dict[str, str]):
+    def submit_entity(self, state: State, id: str, payload: t.Dict[str, str]):
         args = payload.get("args")
         if args is None or not isinstance(args, list) or len(args) < 1 or not isinstance(args[0], dict):
             return

+ 2 - 2
src/taipy/gui_core/viselements.json

@@ -65,8 +65,8 @@
                     {
                       "name": "on_creation",
                       "type": "Callback",
-                      "doc": "The name of the function that is triggered when a scenario is about to be created.<br/><br/>All the parameters of that function are optional:\n<ul>\n<li>state (<code>State^</code>): the state instance.</li>\n<li>id (str): the identifier of the scenario selector.</li>\n<li>action (str): the name of the action that provoked the invocation of the callback.</li>\n<li>payload (dict): the details on this callback's invocation.<br/>\nThis dictionary has the following keys:\n<ul>\n<li>config: the name of the selected scenario configuration.</li>\n<li>date: the creation date for the new scenario.</li>\n<li>name: the user entered name.</li>\n<li>properties: a dictionnary.</li>\n</ul>\n</li>\n<li>return: the callback can return a scenario, a string containing an error message (a scenario will not be created) or None (then a new scenario is created with the user parameters).</li>\n</ul>",
-                      "signature": [["state", "State"], ["id", "str"], ["action", "str"], ["payload", "dict"]]
+                      "doc": "The name of the function that is triggered when a scenario is about to be created.<br/><br/>All the parameters of that function are optional:\n<ul>\n<li>state (<code>State^</code>): the state instance.</li>\n<li>id (str): the identifier of the scenario selector.</li>\n<li>payload (dict): the details on this callback's invocation.<br/>\nThis dictionary has the following keys:\n<ul>\n<li>config: the name of the selected scenario configuration.</li>\n<li>date: the creation date for the new scenario.</li>\n<li>name: the user entered name.</li>\n<li>properties: a dictionnary.</li>\n</ul>\n</li>\n<li>return: the callback can return a scenario, a string containing an error message (a scenario will not be created) or None (then a new scenario is created with the user parameters).</li>\n</ul>",
+                      "signature": [["state", "State"], ["id", "str"], ["payload", "dict"]]
                     }
                 ]
             }