-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support entry_points for the MenuButton class
- `hab_gui.widgets.menu_button.MenuButton` is now populated by entry points supporting sub-classes. - Adds QAction subclasses to implement refreshing hab_gui and adding separators to menus. - `AliasLaunchWindow.refresh_cache` now handles stopping/starting the `refresh_timer` internally. - Correct `hab_gui_menu_button` entry_point name to `hab_gui.uri.menu.widget`. - `hab_gui.uri.menu.widget` can now be omitted by setting to `null`. - Fixed bug with how `allow_none` was handled by `AliasLaunchWindow.load_entry_point`.
- Loading branch information
1 parent
612c9fe
commit 731f31e
Showing
6 changed files
with
116 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from Qt import QtWidgets | ||
|
||
from .. import utils | ||
|
||
|
||
class RefreshAction(QtWidgets.QAction): | ||
"""A QAction that causes the hab_widget to refresh the resolved hab setup and UI. | ||
Args: | ||
resolver (hab.Resolver): The resolver used for settings. | ||
hab_widget (QWidget): The URI widget menu operations are performed on. | ||
verbosity (int, optional): The current verbosity setting. | ||
parent (Qt.QtWidgets.QWidget, optional): Define a parent for this widget. | ||
""" | ||
|
||
def __init__(self, resolver, hab_widget, verbosity=0, parent=None): | ||
super().__init__( | ||
utils.Paths.icon("refresh.svg"), | ||
"Refresh Hab Config", | ||
parent, | ||
) | ||
self.hab_widget = hab_widget | ||
self.resolver = resolver | ||
self.verbosity = verbosity | ||
self.setObjectName("refresh_hab_cfg") | ||
|
||
self.triggered.connect(self.hab_widget.refresh_cache) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from Qt import QtWidgets | ||
|
||
|
||
class SeparatorAction(QtWidgets.QAction): | ||
"""A entry point used to add a separator to a menu using entry_points. | ||
Args: | ||
resolver (hab.Resolver): Ignored for this class. | ||
hab_widget (QWidget): Ignored for this class. | ||
verbosity (int, optional): Ignored for this class. | ||
parent (Qt.QtWidgets.QWidget, optional): Define a parent for this widget. | ||
""" | ||
|
||
def __init__(self, resolver, hab_widget, verbosity=0, parent=None): | ||
super().__init__(parent) | ||
self.setSeparator(True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters