-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from zuokangbo/main
Add mari support
- Loading branch information
Showing
4 changed files
with
32 additions
and
2 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from unimenu.apps._abstract import MenuNodeAbstract | ||
import mari | ||
|
||
|
||
class MenuNodeMari(MenuNodeAbstract): | ||
|
||
def setup(self, parent_app_node=None, backlink=False): | ||
super().setup(parent_app_node=parent_app_node, backlink=backlink) | ||
|
||
@property | ||
def _default_root_parent(self): | ||
return "MainWindow" | ||
|
||
def _setup_sub_menu(self, parent_app_node=None): | ||
if parent_app_node: | ||
return f"{parent_app_node}/{self.label}" | ||
|
||
def _setup_menu_item(self, parent_app_node=None): | ||
if parent_app_node: | ||
action = mari.actions.create(f"{parent_app_node}/{self.label}", self.command or "") | ||
mari.menus.addAction(action, parent_app_node) | ||
|
||
def _setup_separator(self, parent_app_node=None): | ||
if parent_app_node: | ||
mari.menus.addSeparator(parent_app_node) | ||
|
||
def teardown(self): | ||
"""remove from menu""" | ||
pass |