'When you click the direct button on a project tree item, there are several options. I'm trying to add one more button
I'm using the code below. And the image to show the example.
[enter image description here][1]
context_menu = self.main.create_menu(DirViewMenust.Newt, _('Newtest'))
new_menu = self.main.create_menu(DirViewMenust.Newt, _('Newtest'))
new_file_action = self.main.create_action(
DirViewActionst.NewFilet,
text=_("Test"),
icon=None,
triggered=lambda: self.on_clicked,
)
self.main.add_item_to_menu(context_menu, context_menu,
section=ExplorerWidgetMainToolbarSections.Main, before=None)
I'm using the API below:
# Local imports
from spyder.plugins.explorer.widgets.explorer import (
DirViewActions, DirViewContextMenuSections, DirViewMenus,
DirViewNewSubMenuSections, ExplorerTreeWidgetActions)
from spyder.plugins.explorer.widgets.main_widget import (
ExplorerWidgetMainToolbarSections, ExplorerWidgetOptionsMenuSections)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|