From 6df4d7677aa9dee037853b5e6c08b33718b8ab1a Mon Sep 17 00:00:00 2001 From: digitalfrost Date: Sat, 20 Aug 2022 18:51:59 +0200 Subject: [PATCH 1/6] Fix typo --- cura/TaskManagement/OnExitCallbackManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/TaskManagement/OnExitCallbackManager.py b/cura/TaskManagement/OnExitCallbackManager.py index 7894931e9c..ce5fbdc948 100644 --- a/cura/TaskManagement/OnExitCallbackManager.py +++ b/cura/TaskManagement/OnExitCallbackManager.py @@ -10,7 +10,7 @@ if TYPE_CHECKING: # -# This class manages a all registered upon-exit checks that need to be perform when the application tries to exit. +# This class manages all registered upon-exit checks that need to be perform when the application tries to exit. # For example, to show a confirmation dialog when there is USB printing in progress, etc. All callbacks will be called # in the order of when they got registered. If all callbacks "passes", that is, for example, if the user clicks "yes" # on the exit confirmation dialog or nothing that's blocking the exit, then the application will quit after that. From 6298bb50ce72ebce4e7252c58741a6e318f525df Mon Sep 17 00:00:00 2001 From: digitalfrost Date: Sat, 20 Aug 2022 18:58:03 +0200 Subject: [PATCH 2/6] OnExitCallbackManager.py: Fix grammar Grammatical correction of docstring --- cura/TaskManagement/OnExitCallbackManager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cura/TaskManagement/OnExitCallbackManager.py b/cura/TaskManagement/OnExitCallbackManager.py index ce5fbdc948..32a805cca8 100644 --- a/cura/TaskManagement/OnExitCallbackManager.py +++ b/cura/TaskManagement/OnExitCallbackManager.py @@ -10,10 +10,10 @@ if TYPE_CHECKING: # -# This class manages all registered upon-exit checks that need to be perform when the application tries to exit. -# For example, to show a confirmation dialog when there is USB printing in progress, etc. All callbacks will be called -# in the order of when they got registered. If all callbacks "passes", that is, for example, if the user clicks "yes" -# on the exit confirmation dialog or nothing that's blocking the exit, then the application will quit after that. +# This class manages all registered upon-exit checks that need to be performed when the application tries to exit. +# For example, show a confirmation dialog when there is USB printing in progress. All callbacks will be called +# in the order of when they were registered. If all callbacks "pass", that is, for example, if the user clicks "yes" +# on the exit confirmation dialog and nothing is blocking the exit, then the application will quit. # class OnExitCallbackManager: From 62d05f235018a0346b4bfbe5c89aea5d2b89c782 Mon Sep 17 00:00:00 2001 From: digitalfrost Date: Sat, 20 Aug 2022 19:12:44 +0200 Subject: [PATCH 3/6] OnExitCallbackManager.py: Improve docstring layout - Reduce line length. - More logical line breaks. --- cura/TaskManagement/OnExitCallbackManager.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cura/TaskManagement/OnExitCallbackManager.py b/cura/TaskManagement/OnExitCallbackManager.py index 32a805cca8..a943d6321e 100644 --- a/cura/TaskManagement/OnExitCallbackManager.py +++ b/cura/TaskManagement/OnExitCallbackManager.py @@ -10,10 +10,13 @@ if TYPE_CHECKING: # -# This class manages all registered upon-exit checks that need to be performed when the application tries to exit. -# For example, show a confirmation dialog when there is USB printing in progress. All callbacks will be called -# in the order of when they were registered. If all callbacks "pass", that is, for example, if the user clicks "yes" -# on the exit confirmation dialog and nothing is blocking the exit, then the application will quit. +# This class manages all registered upon-exit checks +# that need to be performed when the application tries to exit. +# For example, show a confirmation dialog when there is USB printing in progress. +# All callbacks will be called in the order of when they were registered. +# If all callbacks "pass", for example: +# if the user clicks "yes" on the exit confirmation dialog +# and nothing else is blocking the exit, then the application will quit. # class OnExitCallbackManager: From fe2b8ebaf78474eaabd9f96f059c4b803a0d4240 Mon Sep 17 00:00:00 2001 From: digitalfrost Date: Sat, 20 Aug 2022 19:22:28 +0200 Subject: [PATCH 4/6] Improve triggerNextCallback documentation triggerNextCallback documentation: - Correct grammar - Shorten lines and improve layout --- cura/TaskManagement/OnExitCallbackManager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cura/TaskManagement/OnExitCallbackManager.py b/cura/TaskManagement/OnExitCallbackManager.py index a943d6321e..b743cb0d21 100644 --- a/cura/TaskManagement/OnExitCallbackManager.py +++ b/cura/TaskManagement/OnExitCallbackManager.py @@ -38,8 +38,10 @@ class OnExitCallbackManager: def getIsAllChecksPassed(self) -> bool: return self._is_all_checks_passed - # Trigger the next callback if available. If not, it means that all callbacks have "passed", which means we should - # not block the application to quit, and it will call the application to actually quit. + # Trigger the next callback if there is one. + # If not, all callbacks have "passed", + # which means we should not prevent the application from quitting, + # and we call the application to actually quit. def triggerNextCallback(self) -> None: # Get the next callback and schedule that if this_callback = None From d9fb352ee25f394a1449195b7e62e235ac27bc46 Mon Sep 17 00:00:00 2001 From: digitalfrost Date: Sat, 20 Aug 2022 19:27:32 +0200 Subject: [PATCH 5/6] Fix typo --- cura/TaskManagement/OnExitCallbackManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/TaskManagement/OnExitCallbackManager.py b/cura/TaskManagement/OnExitCallbackManager.py index b743cb0d21..07fdd2d111 100644 --- a/cura/TaskManagement/OnExitCallbackManager.py +++ b/cura/TaskManagement/OnExitCallbackManager.py @@ -43,7 +43,7 @@ class OnExitCallbackManager: # which means we should not prevent the application from quitting, # and we call the application to actually quit. def triggerNextCallback(self) -> None: - # Get the next callback and schedule that if + # Get the next callback and schedule it this_callback = None if self._current_callback_idx < len(self._on_exit_callback_list): this_callback = self._on_exit_callback_list[self._current_callback_idx] From 50d81225dab34f69b30760b952fa9386db57ff11 Mon Sep 17 00:00:00 2001 From: digitalfrost Date: Sat, 20 Aug 2022 19:40:58 +0200 Subject: [PATCH 6/6] Improve documentation string onCurrentCallbackFinished documentation string: - Improve clarity - Fix grammar - Improve layout and shorten line length --- cura/TaskManagement/OnExitCallbackManager.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cura/TaskManagement/OnExitCallbackManager.py b/cura/TaskManagement/OnExitCallbackManager.py index 07fdd2d111..54121a2960 100644 --- a/cura/TaskManagement/OnExitCallbackManager.py +++ b/cura/TaskManagement/OnExitCallbackManager.py @@ -60,10 +60,11 @@ class OnExitCallbackManager: # Tell the application to exit self._application.callLater(self._application.closeApplication) - # This is the callback function which an on-exit callback should call when it finishes, it should provide the - # "should_proceed" flag indicating whether this check has "passed", or in other words, whether quitting the - # application should be blocked. If the last on-exit callback doesn't block the quitting, it will call the next - # registered on-exit callback if available. + # Callback function which an on-exit callback calls when it finishes. + # It provides a "should_proceed" flag indicating whether the check has "passed", + # or whether quitting the application should be blocked. + # If the last on-exit callback doesn't block quitting, it will call the next + # registered on-exit callback if one is available. def onCurrentCallbackFinished(self, should_proceed: bool = True) -> None: if not should_proceed: Logger.log("d", "on-app-exit callback finished and we should not proceed.")