Cannot get tool method run to execute

Thanks, exactly what I was looking for. My tool is kind of a mixture of the three. I want to get some options, then the tool runs, but has the option of confirming modification actions, such as “Found John Doe in FS as parent of a person in the tree but not in it, should he be added to the DB?”.

Will investigate these, thanks.

Excellent! That did it, now the options dialog comes up and run() gets called on clicking ‘Execute’.

2 Likes

Which “that” did it? Nick suggested 2.

Went with ToolManagedWindow because I do not know the difference with the Batch one yet.

1 Like

Curiously, searching the (Sphinx) developer docs does not find these classes.

Asked Perplexity AI to “Please compare and contrast the ToolManagedWindow and the ToolManagedWindowBatch classes found at https://github.com/gramps-project/gramps/blob/master/gramps/gui/plug/_windows.py#L2057-L2093

The ToolManagedWindow and ToolManagedWindowBatch classes in the provided code are both derived from ToolManagedWindowBase but serve different purposes. Here is a comparison:

Similarities

  1. Base Classes:

    • Both inherit from ToolManagedWindowBase.
    • Both initialize their parent classes (Tool or BatchTool) and pass necessary parameters.
  2. Shared Parameters:

    • Both constructors use common parameters like dbstate, uistate, options_class, name, and an optional callback.
  3. Initialization:

    • Both classes initialize ToolManagedWindowBase explicitly after initializing their respective parent classes.

Differences

Feature ToolManagedWindow ToolManagedWindowBatch
Parent Class Inherits from tool.Tool. Inherits from tool.BatchTool.
Purpose Designed for single-instance tools. Designed for batch-processing tools.
Fail Handling Does not include a failure check. Includes a failure check (self.fail) before initializing the base class.
UI State Directly uses uistate parameter. Extracts uistate from the user object (user.uistate).

Summary

  • Use ToolManagedWindow for tools that operate in a single-instance, interactive mode.
  • Use ToolManagedWindowBatch for batch tools where additional failure handling is required before initializing the UI.

Citations:
[1] Reddit - Dive into anything
[2] Winuser.h header - Win32 apps | Microsoft Learn
[3] Putting a dash instance inside a class? - Dash Python - Plotly Community Forum
[4] Tool Windows overview - Visual Studio (Windows) | Microsoft Learn
[5] https://www.youtube.com/watch?v=NG0PPt-CaYE
[6] Concise Windows Functions in Malware Analysis List · GitHub
[7] Writing a class that accepts a callback in Python? - Stack Overflow
[8] Toolkit reference - Microsoft Deployment Toolkit (MDT) Scripts - Microsoft Deployment Toolkit | Microsoft Learn


Answer from Perplexity: https://www.perplexity.ai/search/please-compare-and-contrast-th-a3h4M8jjSDGV0YbzwFgfFA?utm_source=copy_output