AppWindow

class AppWindow.AppWindow(parent, controller)[source]

Bases: Frame

AppWindow is the class that inherits from Tkinter.Frame. It has subclasses PipelineGUI and StartGUI. It handles elements that remain consistent throughout the GUI, including the menu bar, the light and dark styling, and the functionality for opening new projects, existing projects, and recent projects.

Parameters:
  • parent (tkinter container) – passed from main to make the tkinter frame.

  • controller (main*) – a reference to main.

_create_menu()[source]

Setup method for top menu bar. It’s displayed consistently through the Tk app with “File”, “Info”, and “Reconstruction” menus that let the user navigate through projects, access the docs, and run all pipeline steps automatically.

_open_helpmenu(docpage='index.html')[source]

Handler for all of the menu elements under the info menu on the menu bar. Opens different pages of the VirtualRocks documentation depending on what docpage is passed.

Parameters:

docpage (string) – the name of the documentation page to open. Defaults to the main page, index.html.

_recent_menu()[source]

Helper method that creates the menu cascade under “Open Recents…” in the file menu. It refreshes the menu elements displayed when the menu is opened, with open file at the top and the least recently opened file at the bottom. The menu can display 0 to 4 projects.

As it can be called repeatedly, the method starts by removing all elements from the cascade before adding new ones. It uses get from RecentsManager to use up-to-date recent values.

_start_darkmode()[source]

Handler for setting the app to dark mode. Uses ttkbootstrap theme “darkly”. If the app isn’t already in dark mode, it changes the style and sets main’s styleflag.

_start_lightmode()[source]

Handler for setting the app to light mode. Uses ttkbootstrap theme “lumen”. If the app isn’t already in light mode, it changes the style and sets main’s styleflag.

new_project()[source]

Event handler for opening new projects. It handles the “New” menu item under then “File” menu tab and the “New Project” button on the start screen on the Tk app. It opens a dialog that prompts the user to select a workspace/working directory. Once the user selects a valid directory, it calls the controller’s new_project method in main.

open_project(projfile=None)[source]

Event handler for opening existing projects. It handles the “Open” menu item and the items under the “Open Recent…” cascade in the File menu tab, and the “Open Project” button on the start screen of the Tk app. If a project file directory is passed or the user selects a file directory using the dialog, then the function calls the controller’s open_project method in main with the project file directory.

Parameters:

projfile (pathlib.Path) – optional path to a .vrp file.

open_recent(recent)[source]

Event handler for the menu items representing files in the recents dictionary under the “Open Recents…” cascade in the “File” menu tab in the menu bar. If the project exists, then it’s passed to open_project.

Parameters:

recent (pathlib.Path) – a string of the path of the recent file to open.