Skip to content

Commit

Permalink
Merge pull request #647 from Avaiga/feature/#357-on-submission-change…
Browse files Browse the repository at this point in the history
…-called_twice

feature/#357 replace submission entity with submission status
  • Loading branch information
toan-quach authored Jan 5, 2024
2 parents d46f2ec + 6e236ed commit d589448
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions taipy/gui_core/_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ def __init__(
client_id: str,
module_context: str,
callback: t.Callable,
submission: Submission,
submission_status: SubmissionStatus,
) -> None:
self.client_id = client_id
self.module_context = module_context
self.callback = callback
self.submission = submission
self.submission_status = submission_status

def set_submission(self, submission: Submission):
self.submission = submission
def set_submission_status(self, submission_status: SubmissionStatus):
self.submission_status = submission_status
return self


Expand Down Expand Up @@ -183,7 +183,7 @@ def scenario_status_callback(self, submission_id: t.Optional[str]):
return

new_status = submission.submission_status
if sub_details.submission.submission_status != new_status:
if sub_details.submission_status != new_status:
# callback
self.gui._call_user_callback(
sub_details.client_id,
Expand All @@ -199,7 +199,7 @@ def scenario_status_callback(self, submission_id: t.Optional[str]):
):
self.client_submission.pop(submission_id, None)
else:
self.client_submission[submission_id] = sub_details.set_submission(submission)
self.client_submission[submission_id] = sub_details.set_submission_status(new_status)

except Exception as e:
_warn(f"Submission ({submission_id}) is not available", e)
Expand Down Expand Up @@ -443,7 +443,7 @@ def submit_entity(self, state: State, id: str, payload: t.Dict[str, str]):
client_id,
module_context,
submission_fn,
submission_entity,
submission_entity.submission_status,
)
else:
_warn(f"on_submission_change(): '{submission_cb}' is not a valid function.")
Expand Down

0 comments on commit d589448

Please sign in to comment.