Skip to content

Block "Edit annotations", "Generate output" buttons if no annotations exist / no screenshots taken #119

@miiranta

Description

@miiranta

Summary

Error is edge cases of some of the main buttons.

Steps to reproduce

Just click Edit Annotation before taking any screenshots OR
Just click Generate output before generating annotations

Traceback (most recent call last):
  File "C:\Users\Lucas Miranda\AppData\Local\slicer.org\3D Slicer 5.11.0-2025-11-16\bin\Python\slicer\util.py", line 3392, in tryWithErrorDisplay
    yield
  File "C:/Users/Lucas Miranda/Desktop/SlicerTutorialMaker/TutorialMaker/TutorialMaker.py", line 274, in Generate
    AnnotationPainter.TutorialPainter().GenerateHTMLfromAnnotatedTutorial(Lib.TutorialUtils.get_module_basepath("TutorialMaker") + "/Outputs/Annotations/annotations.json")
  File "C:\Users\Lucas Miranda\Desktop\SlicerTutorialMaker\TutorialMaker\Lib\TutorialPainter.py", line 806, in GenerateHTMLfromAnnotatedTutorial
    [self.TutorialInfo, self.slides, self.imagePaths] = AnnotatedTutorial.LoadAnnotatedTutorial(path)
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Lucas Miranda\Desktop\SlicerTutorialMaker\TutorialMaker\Lib\Annotations.py", line 507, in LoadAnnotatedTutorial
    textDict = AnnotatedTutorial.GetLocalizedDict(currentLanguage)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Lucas Miranda\Desktop\SlicerTutorialMaker\TutorialMaker\Lib\Annotations.py", line 493, in GetLocalizedDict
    with open(dictPath, encoding='utf-8') as file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Lucas Miranda\\Desktop\\SlicerTutorialMaker\\TutorialMaker\\Lib/../Outputs/Annotations/text_dict_default.json'

Environment

Slicer 5.11.0
Windows 10
Tutorial Maker version: 960d1f3 (main) -
Merge pull request #117 from SlicerLatinAmerica/hotfix-imagesize-mac

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions