# Cannot get tool method run to execute

**URL:** <https://gramps.discourse.group/t/cannot-get-tool-method-run-to-execute/7064>\
**Category:** Development\
**Tags:** familysearch\
**Created:** [February 20, 2025, 11:16pm UTC](https://gramps.discourse.group/t/cannot-get-tool-method-run-to-execute/7064 "2025-02-20T23:16:49Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![lsc](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@lsc](https://gramps.discourse.group/u/lsc)\
**Post date:** [February 23, 2025, 8:20am UTC](https://gramps.discourse.group/t/cannot-get-tool-method-run-to-execute/7064/21 "2025-02-23T08:20:16Z")

</div>

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?”.

---

<div class="post-metadata">

**Author:** ![lsc](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@lsc](https://gramps.discourse.group/u/lsc)\
**Post date:** [February 23, 2025, 8:20am UTC](https://gramps.discourse.group/t/cannot-get-tool-method-run-to-execute/7064/22 "2025-02-23T08:20:51Z")

</div>

Will investigate these, thanks.

---

<div class="post-metadata">

**Author:** ![lsc](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@lsc](https://gramps.discourse.group/u/lsc)\
**Post date:** [February 23, 2025, 2:32pm UTC](https://gramps.discourse.group/t/cannot-get-tool-method-run-to-execute/7064/23 "2025-02-23T14:32:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [February 24, 2025, 12:01pm UTC](https://gramps.discourse.group/t/cannot-get-tool-method-run-to-execute/7064/24 "2025-02-24T12:01:15Z")

</div>

> [@lsc](#):
>
> That did it,

Which “that” did it? Nick suggested 2.

---

<div class="post-metadata">

**Author:** ![lsc](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@lsc](https://gramps.discourse.group/u/lsc)\
**Post date:** [February 24, 2025, 1:22pm UTC](https://gramps.discourse.group/t/cannot-get-tool-method-run-to-execute/7064/25 "2025-02-24T13:22:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [February 24, 2025, 3:09pm UTC](https://gramps.discourse.group/t/cannot-get-tool-method-run-to-execute/7064/26 "2025-02-24T15:09:50Z")

</div>

Curiously, [searching the (Sphinx) developer docs](https://gramps-project.org/api_3_3_x/search.html?q=ToolManagedWindow) 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`](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** :

2. **Shared Parameters** :

3. **Initialization** :

* * *

### **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 - The heart of the internet](https://www.reddit.com/r/csharp/comments/s3phkt/favorite_source_code_comparison_tool_diff_tool/)  
[2] [Winuser.h header - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/winuser/)  
[3] [Putting a dash instance inside a class? - Dash Python - Plotly Community Forum](https://community.plotly.com/t/putting-a-dash-instance-inside-a-class/6097)  
[4] [https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/tool-window/tool-window?view=vs-2022](https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/tool-window/tool-window?view=vs-2022)  
[5] [https://www.youtube.com/watch?v=NG0PPt-CaYE](https://www.youtube.com/watch?v=NG0PPt-CaYE)  
[6] [Concise Windows Functions in Malware Analysis List · GitHub](https://gist.github.com/404NetworkError/a81591849f5b6b5fe09f517efc189c1d)  
[7] [Writing a class that accepts a callback in Python? - Stack Overflow](https://stackoverflow.com/questions/1567777/writing-a-class-that-accepts-a-callback-in-python)  
[8] [Toolkit reference - Microsoft Deployment Toolkit (MDT) Scripts - Microsoft Deployment Toolkit | Microsoft Learn](https://learn.microsoft.com/en-us/mem/configmgr/mdt/scripts)

* * *

Answer from Perplexity: [https://www.perplexity.ai/search/please-compare-and-contrast-th-a3h4M8jjSDGV0YbzwFgfFA?utm\_source=copy\_output](https://www.perplexity.ai/search/please-compare-and-contrast-th-a3h4M8jjSDGV0YbzwFgfFA?utm_source=copy_output)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/gramps/original/1X/2ac1e712b7adf612e31ca08a55419f4cf37c0158.png) [@system](https://gramps.discourse.group/u/system)\
**Post date:** [March 26, 2025, 3:10pm UTC](https://gramps.discourse.group/t/cannot-get-tool-method-run-to-execute/7064/27 "2025-03-26T15:10:03Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

[Previous page](https://gramps.discourse.group/t/cannot-get-tool-method-run-to-execute/7064.md?page=1)
