Skip to content

Latest commit

 

History

History
233 lines (195 loc) · 11.6 KB

README.md

File metadata and controls

233 lines (195 loc) · 11.6 KB

Hab Gui

A graphical user interface built on top of hab to take hab out of the shell.

image

Features

Quickstart

  1. Enable the use of hab gui by adding the entry_point in your site json file. You can use the example site files that come in the hab and hab-gui repos.

  2. Set a HAB_PATHS environment variable.

hab-gui.json extends hab's cli by adding the gui comand

  1. Use hab gui to launch the alias launch window.

    hab gui launch

    Or update the URI saved in the user prefs.

    hab gui set-uri

Configuration

hab gui sub-command

Using hab entry points you can add a gui sub-command to hab. This allows you to launch hab-gui commands from the existing hab shell commands.

{
    "prepend": {
        "entry_points": {
            "cli": {
                "gui": "hab_gui.cli:gui"
            }
        }
    }
}

This is a minimal site json file enabling the use of hab gui that can be added to your existing site files.

habw.exe

When hab-gui is installed it adds the command habw as a using gui_scripts. This is useful for windows users as it prevents showing a command prompt window while using the other hab gui features. This exe uses the same cli interface as hab so you can convert any existing command to using habw. Just keep in mind that you won't see any text output on windows, so you may want to only use it when using the hab gui sub-command.

Hab-gui Entry Points

By default hab-gui uses fairly simple gui interfaces like a combo box for URI picking and simple buttons to launch aliases. Using the hab entry points system you can implement your own widgets extending or completely re-implementing them.

Group Description Used by Multiple
hab_gui.alias.widget Widget used to display and launch a specific alias for the current URI. AliasLaunchWindow First
hab_gui.aliases.widget Class used to display the hab_gui.alias.widget's. AliasLaunchWindow First
hab_gui.footer.widget A widget class shown under the alias buttons in the AliasLaunchWindow. For example, Optinal Distros is a interface for choosing optional distros for the current URI. AliasLaunchWindow First
hab_gui.init Used to customize the init of hab gui's launched from the command line. By default this installs a sys.excepthook that captures any python exceptions and shows them in a QMessageBox dialog. See hab-gui-init.json. hab_gui.cli when starting a QApplication instance. First
hab_gui.uri.menu.actions Used to customize the menu shown by hab_gui.uri.menu.widget. This should reference QAction subclasses conforming to hab_gui.actions.refresh_action.RefreshAction. MenuButton All
hab_gui.uri.menu.widget Class used to show a menu interface on the right of hab_gui.uri.widget. This can be omitted by setting this entry_point to null. AliasLaunchWindow First
hab_gui.uri.pin.widget Class used to allow the user to pin commonly used URIs. Pinning can be disabled by the site file, or setting this entry_point to null. AliasLaunchWindow First
hab_gui.uri.widget Class used by the user to choose the current URI they want to launch aliases from. This class can be customized to provide the user with URI's generated from a DB that are not explicitly defined by configs. AliasLaunchWindow First
  • See hab-gui.json for an example of adding the gui sub-command to hab.
  • See hab-gui-alt.json for an example of changing the default classes used by hab gui launch.
  • See hab-gui-init.json for an example of changing the QApplication before any hab gui commands create it. This also allows for global customization of features like error handling etc.

Note: Entry_point names should start with hab_gui. and use . between each following word following the group specification on https://packaging.python.org/en/latest/specifications/entry-points/#data-model.

Icons and labels

For the command line using an simplified alias name that is easy to type but harder to read is generally preferred. However for a UI like the launcher, its nice to be able to use a nice name with spaces and extra information. For example in the command line using the alias maya24 is better than having to type "Maya 2024" including double quotes.

Hab gui respects extra values defined on complex aliases.

Key Description Default
icon Path to a icon file readable by QIcon. No icon is shown.
label The text to show instead of the alias name. Same alias name shown in command line.
min_verbosity Hab-gui uses the hab-gui key. For example "min_verbosity": {"global": 1, "hab-gui": 3} would make this alias visible on the command line using -v or above, but when using hab-gui you would need to use -vvv or higher to see it. This allows you to hide aliases that only make sense on the command line but not in hab-gui. 0, so always visible.

Example:

{
    "name": "maya2024",
    "aliases": {
        "windows": [
            [
                // Alias users are expected to launch the correct version of maya with
                "maya", {
                    "cmd": "C:\\Program Files\\Autodesk\\Maya2024\\bin\\maya.exe",
                    // Show the icon and give it the nice name "Maya"
                    "icon": "{relative_root}/.img/maya.ico",
                    "label": "Maya",
                }
            ],
            [
                // Alias used to launch Maya 2024. This allows you to also have
                // access to Maya 2023 etc in the same config and launch the
                // correct version.
                "maya24", {
                    "cmd": "C:\\Program Files\\Autodesk\\Maya2024\\bin\\maya.exe",
                    "icon": "{relative_root}/.img/maya.ico",
                    "label": "Maya 2024",
                    // In general we don't want users to have to know which version
                    // of Maya to launch so hide this alias unless the user passes `-v`
                    // when using the command line or hab-gui.
                    "min_verbosity": {"global": 1},
                }
            ],
            // The mayapy alias are being added for script access and are not really
            // meant for users, so hide them from the command line.
            // Hab-gui can't pass arguments to aliases when launching, so there
            // really is no need to show this alias in hab-gui, so require `-vvv`.
            [
                "mayapy", {
                    "cmd": "C:\\Program Files\\Autodesk\\Maya2024\\bin\\mayapy.exe",
                    "min_verbosity": {"global": 1, "hab-gui": 3},
                }
            ],
            [
                "mayapy24", {
                    "cmd": "C:\\Program Files\\Autodesk\\Maya2024\\bin\\mayapy.exe",
                    "min_verbosity": {"global": 1, "hab-gui": 3},
                }
            ]
        ]
    }
}

Startup Splash Screen

A splash screen be enabled by adding image/directory paths to the site.json config. The config takes a list entry and can contain full file paths or directory paths that contain valid images.

Valid image types: JPG, PNG, GIF

{
    "prepend": {
        "splash_screen": [
            "Path(s)/To/Images"
        ]
    }
}

Auto Refresh

Users are likely to keep the hab launcher open for long periods of time and this may lead to them using out of date configuration settings. Hab Launcher has a refresh button to let users manually force a refresh. Note that this does not refresh the site configuration, configs and distros.

By default it will automatically refresh every 30 minutes(00:30:00). You can configure this interval by setting hab_gui_refresh_inverval in your site configuration. This accepts a string in %H:%M:%S format using time.strptime. An empty string will disable this auto-refresh feature.

Optional Distros GUI

This widget allows you to present users with additional plugins that only some of them might need. The default implementation respects the "enabled by default option". It is shown below the Alias button grid.

Once a user modifies any of the check boxes these changes will be saved in the user prefs if enabled. These user prefs are stored per top level URI so users don't have to micromanage the settings for every single URI they use. This behavior can be changed by sub-classing DistroPicker and re-implementing the standardize_uri method. The Reset to defaults button on the right allows users to clear their preferences for that URI and reset it to the defaults.

The optional distros widget can be enabled by setting the entry point hab_gui.footer.widget to the hab_gui.widgets.distro_picker:DistroPicker class in your site json file.

{
    "prepend": {
        "entry_points": {
            "hab_gui.footer.widget": {
                "default": "hab_gui.widgets.distro_picker:DistroPicker"
            }
        }
    }
}