Skip to content

MainWindow for ipywidgets #601

@tlambert03

Description

@tlambert03

the Qt backend has a MainWindow but the ipywidgets backend doesn't. As @larsoner has pointed out, the closest ipywidgets analog is probably AppLayout

In Qt, a main window is characterized by the ability to add a menu bar (top), status bar (bottom), dock widgets, and toolbars:

mainwindowlayout

In ipywidgets, it's more a layout issue, with a header, a footer, two sidebars and a central pane:

Screen Shot 2023-10-11 at 5 24 57 PM

Currently, our MainWindow protocol is a minimal subclass of Container that can add menus:

class MainWindowProtocol(ContainerProtocol, Protocol):
    def _mgui_create_menu_item(
        self,
        menu_name: str,
        action_name: str,
        callback: Callable | None = None,
        shortcut: str | None = None,
    ) -> None:

but will likely gain _mgui_add_toolbar after #597...

This raises the question of how represent these somewhat different concepts of "main window" in our API. If we use AppLayout behind the scenes, how do we assign stuff to left/middle/right? Or do we just ignore the left and right (and allow people to manually edit using widget.native if they choose.

fwiw, it looks like mne-python doesn't use AppLayout directly anywhere?

@larsoner, any insights/opinions from your mne applications?

Metadata

Metadata

Assignees

No one assigned

    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