From 7db7e2345b5e3ef2a925a8729a96ea93c4e0f525 Mon Sep 17 00:00:00 2001 From: LuskasHusty <63302125+LuskasHusty@users.noreply.github.com> Date: Thu, 12 Feb 2026 10:54:50 -0300 Subject: [PATCH 1/2] FIX: Not setting ambient var in generate call --- TutorialMaker/TutorialMaker.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/TutorialMaker/TutorialMaker.py b/TutorialMaker/TutorialMaker.py index 843f5c9..bbe2a7c 100644 --- a/TutorialMaker/TutorialMaker.py +++ b/TutorialMaker/TutorialMaker.py @@ -440,6 +440,13 @@ def onComplete(): def Generate(self, tutorialName): modulePath = Lib.TutorialUtils.get_module_basepath("TutorialMaker") annotationsPath = modulePath + f"/Outputs/Annotations/{tutorialName}/annotations.json" + currentTutorial = None + try: + currentTutorial = os.environ["TUTORIAL_CURRENT_SELFTEST"] + except e: + pass + + os.environ["TUTORIAL_CURRENT_SELFTEST"] = tutorialName if not os.path.exists(annotationsPath): # In testing/CI mode, print warning instead of showing modal dialog @@ -492,6 +499,8 @@ def Generate(self, tutorialName): # In testing/CI mode, just print the message print(f"✅ Tutorial Generated: {tutorialName}") print(f" Output path: {outputPath}") + + os.environ["TUTORIAL_CURRENT_SELFTEST"] = currentTutorial pass def CreateNewTutorial(self): From 29596c72ec7fa72144b93a54744b86f456a06c58 Mon Sep 17 00:00:00 2001 From: LuskasHusty <63302125+LuskasHusty@users.noreply.github.com> Date: Thu, 12 Feb 2026 11:07:24 -0300 Subject: [PATCH 2/2] FIX: Error handling --- TutorialMaker/TutorialMaker.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/TutorialMaker/TutorialMaker.py b/TutorialMaker/TutorialMaker.py index bbe2a7c..9797596 100644 --- a/TutorialMaker/TutorialMaker.py +++ b/TutorialMaker/TutorialMaker.py @@ -465,9 +465,18 @@ def Generate(self, tutorialName): _("No Annotations Found") ) return + _exception = None + try: + AnnotationPainter.TutorialPainter().GenerateHTMLfromAnnotatedTutorial(annotationsPath) + except Exception as error: + if (os.environ.get('CI') == 'true' or os.environ.get('GITHUB_ACTIONS') == 'true'): + raise error + else: + _exception = error with slicer.util.tryWithErrorDisplay(_("Failed to generate tutorial")): - AnnotationPainter.TutorialPainter().GenerateHTMLfromAnnotatedTutorial(annotationsPath) + if _exception is not None: + raise _exception outputPath = modulePath + "/Outputs/" # Check if we're in testing/CI mode - check all possible indicators