# SMTK Project Menu

**URL:** <https://discourse.kitware.com/t/smtk-project-menu/977>\
**Category:** Simulation Modeling Toolkit (SMTK)\
**Created:** [February 20, 2023, 2:39pm UTC](https://discourse.kitware.com/t/smtk-project-menu/977 "2023-02-20T14:39:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnt](https://discourse.kitware.com/user_avatar/discourse.kitware.com/johnt/32/147_2.png) [@johnt](https://discourse.kitware.com/u/johnt)\
**Post date:** [February 20, 2023, 2:39pm UTC](https://discourse.kitware.com/t/smtk-project-menu/977/1 "2023-02-20T14:39:53Z")

</div>

I’m getting some ideas together for an SMTK Project menu to consolidate the separate copies of menu code found in several plugins. The current thinking is outlined below and subject to change.

## The SMTK project menu has 5 top-level items:

```auto
Project
  Open Project
  Recent Projects =>
  New Project...
  Save Project
  Close Project

```

## Applications and plugins will register their project type

The function to register a project with the menu will include arguments for:

- The project type string (e.g., “ace3p”, “truchas”, “wavetank”), which must be unique.
- A public label (“ACE3P”, “Truchas”, “OpenFOAM Wave Tank”)
- The name of the project’s “create” operation (string)
- _Optional_ name of the project’s “read” operation (string). Default smtk::project::Read
- _Optional_ name of the project’s “write” operation (string). Default smtk::project::Write

Future: Include the “unregister project” function. Not needed for present use cases.

## Menu visibility and title depend on the number of registered projects

- If no projects are registered, the menu is not displayed.
- If one project is registered, the menu’s title is the project’s label.
- If more than one project are registered, the title reverts back to “Project”. Also the “New” item switches to a submenu with one item for each project type.

## The underlying QMenu item will be accessible to application/plugin code.

This is for customization. For example, the ACE3P menu includes additional menu items “Add Stage”, “Login to NERSC”, “Submit Analysis Job”, and “Launch Remote ParaView Server”. Let’s hope everyone uses this feature with caution.

## The “New Project…” item will bring up a standard dialog for setting the project directory.

It will have 3 fields for the project name, the “workspace” directory (full path), and the project directory itself (full path).

 ![project-menu](https://discourse.kitware.com/uploads/default/original/1X/9a432045a3c81dd176fb44d5102d5c3f62438a32.png)

- Future: projects should be able to substitute their own dialog
- Future: if the project create dialog requires additional input besides the directory, maybe we can/should embed the operation view below the directory fields?

## The SMTK project menu will enforce the “one project only” paradigm.

- The project plugin will include a static object to store the current project (publicly accessible).
- Future: add an option to relax the one-project constraint?

## The SMTK project menu will replace the current “File” ==\> “New Project…” menu item.

In case anyone knew that even existed…

## Future: The “Recent Projects” menu should be updated to sort by project type

Because registering multiple project types is a developer use case, we can defer.

---

<div class="post-metadata">

**Author:** ![dcthomp](https://discourse.kitware.com/user_avatar/discourse.kitware.com/dcthomp/32/10_2.png) [@dcthomp](https://discourse.kitware.com/u/dcthomp)\
**Post date:** [February 20, 2023, 3:31pm UTC](https://discourse.kitware.com/t/smtk-project-menu/977/2 "2023-02-20T15:31:03Z")

</div>

I would like to avoid any project-specific menus. Open/Save/New/Recent should be able to handle anything (projects or individual resources). The only exception would be File→Close, and that shouldn’t be needed until we can really handle closing a single resource in a project without problems.

---

<div class="post-metadata">

**Author:** ![dcthomp](https://discourse.kitware.com/user_avatar/discourse.kitware.com/dcthomp/32/10_2.png) [@dcthomp](https://discourse.kitware.com/u/dcthomp)\
**Post date:** [February 20, 2023, 3:35pm UTC](https://discourse.kitware.com/t/smtk-project-menu/977/3 "2023-02-20T15:35:43Z")

</div>

Also, in terms of a “New Project” dialog, any operation in the [`CreatorGroup`](https://smtk.readthedocs.io/en/latest/doc/reference/smtk/html/classsmtk_1_1operation_1_1CreatorGroup.xhtml) will result in its dialog being popped up. Put the generic `smtk::project::Create` operation in the `smtk::operation::CreatorGroup` and you will have the generic version. If a project has a special version, then put _it_ in the creator group. As long as they are in separate plugins, applications can choose which is available to users by choosing which subset of plugins to package.

Edit: I will add this to an upcoming MR that includes some project + task edits.
