• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python qthelpers.add_actions函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中spyder.utils.qthelpers.add_actions函数的典型用法代码示例。如果您正苦于以下问题:Python add_actions函数的具体用法?Python add_actions怎么用?Python add_actions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了add_actions函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_toolbar_buttons

 def get_toolbar_buttons(self):
     if self.run_button is None:
         self.run_button = create_toolbutton(self, text=_("Run"),
                                          icon=ima.icon('run'),
                                          tip=_("Run again this program"),
                                          triggered=self.start_shell)
     if self.kill_button is None:
         self.kill_button = create_toolbutton(self, text=_("Kill"),
                                  icon=ima.icon('kill'),
                                  tip=_("Kills the current process, "
                                        "causing it to exit immediately"))
     buttons = [self.run_button]
     if self.options_button is None:
         options = self.get_options_menu()
         if options:
             self.options_button = create_toolbutton(self, text=_('Options'),
                                         icon=ima.icon('tooloptions'))
             self.options_button.setPopupMode(QToolButton.InstantPopup)
             menu = QMenu(self)
             add_actions(menu, options)
             self.options_button.setMenu(menu)
     if self.options_button is not None:
         buttons.append(self.options_button)
     buttons.append(self.kill_button)
     return buttons
开发者ID:jitseniesen,项目名称:spyder,代码行数:25,代码来源:baseshell.py


示例2: get_toolbar_buttons

    def get_toolbar_buttons(self):
        """Return toolbar buttons list"""
        buttons = []
        # Code to add the stop button
        if self.stop_button is None:
            self.stop_button = create_toolbutton(self, text=_("Stop"),
                                             icon=self.stop_icon,
                                             tip=_("Stop the current command"))
            self.disable_stop_button()
            # set click event handler
            self.stop_button.clicked.connect(self.stop_button_click_handler)
        if self.stop_button is not None:
            buttons.append(self.stop_button)

        if self.options_button is None:
            options = self.get_options_menu()
            if options:
                self.options_button = create_toolbutton(self,
                        text=_('Options'), icon=ima.icon('tooloptions'))
                self.options_button.setPopupMode(QToolButton.InstantPopup)
                menu = QMenu(self)
                add_actions(menu, options)
                self.options_button.setMenu(menu)
        if self.options_button is not None:
            buttons.append(self.options_button)

        return buttons
开发者ID:jitseniesen,项目名称:spyder,代码行数:27,代码来源:client.py


示例3: setup_menu_actions

    def setup_menu_actions(self):
        """Setup and update the menu actions."""
        self.recent_project_menu.clear()
        self.recent_projects_actions = []
        if self.recent_projects:
            for project in self.recent_projects:
                if self.is_valid_project(project):
                    name = project.replace(get_home_dir(), '~')

                    def slot():
                        self.switch_to_plugin()
                        self.open_project(path=project)

                    action = create_action(self,
                        name,
                        icon = ima.icon('project'),
                        triggered=slot)
                    self.recent_projects_actions.append(action)
                else:
                    self.recent_projects.remove(project)
            self.recent_projects_actions += [None,
                                             self.clear_recent_projects_action]
        else:
            self.recent_projects_actions = [self.clear_recent_projects_action]
        add_actions(self.recent_project_menu, self.recent_projects_actions)
        self.update_project_actions()
开发者ID:burrbull,项目名称:spyder,代码行数:26,代码来源:plugin.py


示例4: add_actions_to_context_menu

 def add_actions_to_context_menu(self, menu):
     """Add actions to IPython widget context menu"""
     inspect_action = create_action(self, _("Inspect current object"),
                                 QKeySequence(get_shortcut('console',
                                                 'inspect current object')),
                                 icon=ima.icon('MessageBoxInformation'),
                                 triggered=self.inspect_object)
     clear_line_action = create_action(self, _("Clear line or block"),
                                       QKeySequence("Shift+Escape"),
                                       icon=ima.icon('editdelete'),
                                       triggered=self.clear_line)
     reset_namespace_action = create_action(self, _("Reset namespace"),
                                       QKeySequence("Ctrl+Alt+R"),
                                       triggered=self.reset_namespace)
     clear_console_action = create_action(self, _("Clear console"),
                                          QKeySequence(get_shortcut('console',
                                                            'clear shell')),
                                          icon=ima.icon('editclear'),
                                          triggered=self.clear_console)
     quit_action = create_action(self, _("&Quit"), icon=ima.icon('exit'),
                                 triggered=self.exit_callback)
     add_actions(menu, (None, inspect_action, clear_line_action,
                        clear_console_action, reset_namespace_action,
                        None, quit_action))
     return menu
开发者ID:jitseniesen,项目名称:spyder,代码行数:25,代码来源:client.py


示例5: get_options_menu

 def get_options_menu(self):
     ExternalShellBase.get_options_menu(self)
     self.interact_action = create_action(self, _("Interact"))
     self.interact_action.setCheckable(True)
     self.debug_action = create_action(self, _("Debug"))
     self.debug_action.setCheckable(True)
     self.args_action = create_action(self, _("Arguments..."),
                                      triggered=self.get_arguments)
     self.post_mortem_action = create_action(self, _("Post Mortem Debug"))
     self.post_mortem_action.setCheckable(True)
     run_settings_menu = QMenu(_("Run settings"), self)
     add_actions(run_settings_menu,
                 (self.interact_action, self.debug_action, self.args_action,
                  self.post_mortem_action))
     self.cwd_button = create_action(self, _("Working directory"),
                             icon=ima.icon('DirOpenIcon'),
                             tip=_("Set current working directory"),
                             triggered=self.set_current_working_directory)
     self.env_button = create_action(self, _("Environment variables"),
                                     icon=ima.icon('environ'),
                                     triggered=self.show_env)
     self.syspath_button = create_action(self,
                                         _("Show sys.path contents"),
                                         icon=ima.icon('syspath'),
                                         triggered=self.show_syspath)
     actions = [run_settings_menu, self.show_time_action, None,
                self.cwd_button, self.env_button, self.syspath_button]
     if self.menu_actions is not None:
         actions += [None]+self.menu_actions
     return actions
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:30,代码来源:pythonshell.py


示例6: get_plugin_actions

 def get_plugin_actions(self):
     """Return a list of actions related to plugin"""
     quit_action = create_action(self, _("&Quit"),
                                 icon=ima.icon('exit'), 
                                 tip=_("Quit"),
                                 triggered=self.quit)
     self.register_shortcut(quit_action, "_", "Quit", "Ctrl+Q")
     run_action = create_action(self, _("&Run..."), None,
                         ima.icon('run_small'),
                         _("Run a Python script"),
                         triggered=self.run_script)
     environ_action = create_action(self,
                         _("Environment variables..."),
                         icon=ima.icon('environ'),
                         tip=_("Show and edit environment variables"
                                     " (for current session)"),
                         triggered=self.show_env)
     syspath_action = create_action(self,
                         _("Show sys.path contents..."),
                         icon=ima.icon('syspath'),
                         tip=_("Show (read-only) sys.path"),
                         triggered=self.show_syspath)
     buffer_action = create_action(self,
                         _("Buffer..."), None,
                         tip=_("Set maximum line count"),
                         triggered=self.change_max_line_count)
     exteditor_action = create_action(self,
                         _("External editor path..."), None, None,
                         _("Set external editor executable path"),
                         triggered=self.change_exteditor)
     wrap_action = create_action(self,
                         _("Wrap lines"),
                         toggled=self.toggle_wrap_mode)
     wrap_action.setChecked(self.get_option('wrap'))
     calltips_action = create_action(self, _("Display balloon tips"),
         toggled=self.toggle_calltips)
     calltips_action.setChecked(self.get_option('calltips'))
     codecompletion_action = create_action(self,
                                       _("Automatic code completion"),
                                       toggled=self.toggle_codecompletion)
     codecompletion_action.setChecked(self.get_option('codecompletion/auto'))
     codecompenter_action = create_action(self,
                                 _("Enter key selects completion"),
                                 toggled=self.toggle_codecompletion_enter)
     codecompenter_action.setChecked(self.get_option(
                                                 'codecompletion/enter_key'))
     
     option_menu = QMenu(_('Internal console settings'), self)
     option_menu.setIcon(ima.icon('tooloptions'))
     add_actions(option_menu, (buffer_action, wrap_action,
                               calltips_action, codecompletion_action,
                               codecompenter_action, exteditor_action))
                 
     plugin_actions = [None, run_action, environ_action, syspath_action,
                       option_menu, None, quit_action]
     
     # Add actions to context menu
     add_actions(self.shell.menu, plugin_actions)
     
     return plugin_actions
开发者ID:rlaverde,项目名称:spyder,代码行数:60,代码来源:console.py


示例7: create_context_menu_actions

 def create_context_menu_actions(self):
     """Create context menu actions"""
     actions = []
     fnames = self.get_selected_filenames()
     new_actions = self.create_file_new_actions(fnames)
     if len(new_actions) > 1:
         # Creating a submenu only if there is more than one entry
         new_act_menu = QMenu(_('New'), self)
         add_actions(new_act_menu, new_actions)
         actions.append(new_act_menu)
     else:
         actions += new_actions
     import_actions = self.create_file_import_actions(fnames)
     if len(import_actions) > 1:
         # Creating a submenu only if there is more than one entry
         import_act_menu = QMenu(_('Import'), self)
         add_actions(import_act_menu, import_actions)
         actions.append(import_act_menu)
     else:
         actions += import_actions
     if actions:
         actions.append(None)
     if fnames:
         actions += self.create_file_manage_actions(fnames)
     if actions:
         actions.append(None)
     if fnames and all([osp.isdir(_fn) for _fn in fnames]):
         actions += self.create_folder_manage_actions(fnames)
     if actions:
         actions.append(None)
     actions += self.common_actions
     return actions
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:32,代码来源:explorer.py


示例8: setup_context_menu

 def setup_context_menu(self):
     """Setup shell context menu"""
     self.menu = QMenu(self)
     self.cut_action = create_action(self, _("Cut"),
                                     shortcut=keybinding('Cut'),
                                     icon=ima.icon('editcut'),
                                     triggered=self.cut)
     self.copy_action = create_action(self, _("Copy"),
                                      shortcut=keybinding('Copy'),
                                      icon=ima.icon('editcopy'),
                                      triggered=self.copy)
     paste_action = create_action(self, _("Paste"),
                                  shortcut=keybinding('Paste'),
                                  icon=ima.icon('editpaste'),
                                  triggered=self.paste)
     save_action = create_action(self, _("Save history log..."),
                                 icon=ima.icon('filesave'),
                                 tip=_("Save current history log (i.e. all "
                                       "inputs and outputs) in a text file"),
                                 triggered=self.save_historylog)
     self.delete_action = create_action(self, _("Delete"),
                                 shortcut=keybinding('Delete'),
                                 icon=ima.icon('editdelete'),
                                 triggered=self.delete)
     selectall_action = create_action(self, _("Select All"),
                                 shortcut=keybinding('SelectAll'),
                                 icon=ima.icon('selectall'),
                                 triggered=self.selectAll)
     add_actions(self.menu, (self.cut_action, self.copy_action,
                             paste_action, self.delete_action, None,
                             selectall_action, None, save_action) )
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:31,代码来源:shell.py


示例9: __init__

    def __init__(self, parent, actions=None, menu=None,
                 corner_widgets=None, menu_use_tooltips=False):
        QTabWidget.__init__(self, parent)
        self.setUsesScrollButtons(True)

        # To style tabs on Mac
        if sys.platform == 'darwin':
            self.setObjectName('plugin-tab')

        self.corner_widgets = {}
        self.menu_use_tooltips = menu_use_tooltips
        
        if menu is None:
            self.menu = QMenu(self)
            if actions:
                add_actions(self.menu, actions)
        else:
            self.menu = menu
            
        # Corner widgets
        if corner_widgets is None:
            corner_widgets = {}
        corner_widgets.setdefault(Qt.TopLeftCorner, [])
        corner_widgets.setdefault(Qt.TopRightCorner, [])
        self.browse_button = create_toolbutton(self,
                                          icon=ima.icon('browse_tab'),
                                          tip=_("Browse tabs"))
        self.browse_tabs_menu = QMenu(self)
        self.browse_button.setMenu(self.browse_tabs_menu)
        self.browse_button.setPopupMode(self.browse_button.InstantPopup)
        self.browse_tabs_menu.aboutToShow.connect(self.update_browse_tabs_menu)
        corner_widgets[Qt.TopLeftCorner] += [self.browse_button]

        self.set_corner_widgets(corner_widgets)
开发者ID:rlaverde,项目名称:spyder,代码行数:34,代码来源:tabs.py


示例10: update_menu

 def update_menu(self):
     self.menu.clear()
     items = self.selectedItems()
     actions = self.get_actions_from_items(items)
     if actions:
         actions.append(None)
     actions += self.common_actions
     add_actions(self.menu, actions)
开发者ID:0xBADCA7,项目名称:spyder,代码行数:8,代码来源:onecolumntree.py


示例11: setup_menu

 def setup_menu(self):
     """Setup context menu"""
     self.copy_action = create_action(self, _('Copy'),
                                      shortcut=keybinding('Copy'),
                                      icon=ima.icon('editcopy'),
                                      triggered=self.copy,
                                      context=Qt.WidgetShortcut)
     menu = QMenu(self)
     add_actions(menu, [self.copy_action, ])
     return menu
开发者ID:impact27,项目名称:spyder,代码行数:10,代码来源:arrayeditor.py


示例12: context_menu_requested

    def context_menu_requested(self, event):
        """ """
        pos = QPoint(event.x(), event.y())
        menu = QMenu(self)

        actions = []
        action_title = create_action(self, _('Go to step: '), icon=QIcon())
        action_title.setDisabled(True)
        actions.append(action_title)
#        actions.append(create_action(self, _(': '), icon=QIcon()))

        add_actions(menu, actions)

        menu.popup(self.mapToGlobal(pos))
开发者ID:0xBADCA7,项目名称:spyder,代码行数:14,代码来源:tour.py


示例13: contextMenuEvent

 def contextMenuEvent(self, event):
     menu = QMenu(self)
     actions = [self.pageAction(QWebEnginePage.Back),
                self.pageAction(QWebEnginePage.Forward), None,
                self.pageAction(QWebEnginePage.SelectAll),
                self.pageAction(QWebEnginePage.Copy), None,
                self.zoom_in_action, self.zoom_out_action]
     if DEV and not WEBENGINE:
         settings = self.page().settings()
         settings.setAttribute(QWebEngineSettings.DeveloperExtrasEnabled, True)
         actions += [None, self.pageAction(QWebEnginePage.InspectElement)]
     add_actions(menu, actions)
     menu.popup(event.globalPos())
     event.accept()
开发者ID:silentquasar,项目名称:spyder,代码行数:14,代码来源:browser.py


示例14: __init__

    def __init__(self, parent):
        self.tabwidget = None
        self.menu_actions = None
        self.dockviewer = None
        self.wrap_action = None
        
        self.editors = []
        self.filenames = []
        if PYQT5:        
            SpyderPluginWidget.__init__(self, parent, main = parent)
        else:
            SpyderPluginWidget.__init__(self, parent)

        # Initialize plugin
        self.initialize_plugin()

        layout = QVBoxLayout()
        self.tabwidget = Tabs(self, self.menu_actions)
        self.tabwidget.currentChanged.connect(self.refresh_plugin)
        self.tabwidget.move_data.connect(self.move_tab)

        if sys.platform == 'darwin':
            tab_container = QWidget()
            tab_container.setObjectName('tab-container')
            tab_layout = QHBoxLayout(tab_container)
            tab_layout.setContentsMargins(0, 0, 0, 0)
            tab_layout.addWidget(self.tabwidget)
            layout.addWidget(tab_container)
        else:
            layout.addWidget(self.tabwidget)

        # Menu as corner widget
        options_button = create_toolbutton(self, text=_('Options'),
                                           icon=ima.icon('tooloptions'))
        options_button.setPopupMode(QToolButton.InstantPopup)
        menu = QMenu(self)
        add_actions(menu, self.menu_actions)
        options_button.setMenu(menu)
        self.tabwidget.setCornerWidget(options_button)
        
        # Find/replace widget
        self.find_widget = FindReplace(self)
        self.find_widget.hide()
        self.register_widget_shortcuts(self.find_widget)

        layout.addWidget(self.find_widget)

        self.setLayout(layout)
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:48,代码来源:history.py


示例15: setup_options_button

    def setup_options_button(self):
        """Add the cog menu button to the toolbar."""
        if not self.options_button:
            self.options_button = create_toolbutton(
                self, text=_('Options'), icon=ima.icon('tooloptions'))

            actions = self.actions + [MENU_SEPARATOR] + self.plugin_actions
            self.options_menu = QMenu(self)
            add_actions(self.options_menu, actions)
            self.options_button.setMenu(self.options_menu)

        if self.tools_layout.itemAt(self.tools_layout.count() - 1) is None:
            self.tools_layout.insertWidget(
                self.tools_layout.count() - 1, self.options_button)
        else:
            self.tools_layout.addWidget(self.options_button)
开发者ID:burrbull,项目名称:spyder,代码行数:16,代码来源:namespacebrowser.py


示例16: get_toolbar_buttons

    def get_toolbar_buttons(self):
        """Return toolbar buttons list."""
        buttons = []

        # Code to add the stop button
        if self.stop_button is None:
            self.stop_button = create_toolbutton(
                                   self,
                                   text=_("Stop"),
                                   icon=self.stop_icon,
                                   tip=_("Stop the current command"))
            self.disable_stop_button()
            # set click event handler
            self.stop_button.clicked.connect(self.stop_button_click_handler)
            if is_dark_interface():
                self.stop_button.setStyleSheet("QToolButton{padding: 3px;}")
        if self.stop_button is not None:
            buttons.append(self.stop_button)

        # Reset namespace button
        if self.reset_button is None:
            self.reset_button = create_toolbutton(
                                    self,
                                    text=_("Remove"),
                                    icon=ima.icon('editdelete'),
                                    tip=_("Remove all variables"),
                                    triggered=self.reset_namespace)
            if is_dark_interface():
                self.reset_button.setStyleSheet("QToolButton{padding: 3px;}")
        if self.reset_button is not None:
            buttons.append(self.reset_button)

        if self.options_button is None:
            options = self.get_options_menu()
            if options:
                self.options_button = create_toolbutton(self,
                        text=_('Options'), icon=ima.icon('tooloptions'))
                self.options_button.setPopupMode(QToolButton.InstantPopup)
                menu = QMenu(self)
                add_actions(menu, options)
                self.options_button.setMenu(menu)
        if self.options_button is not None:
            buttons.append(self.options_button)

        return buttons
开发者ID:impact27,项目名称:spyder,代码行数:45,代码来源:client.py


示例17: refresh_actions

    def refresh_actions(self):
        """
        Create options menu.
        """
        self.options_menu.clear()

        # Decide what additional actions to show
        if self.undocked_window is None:
            additional_actions = [MENU_SEPARATOR,
                                  self.undock_action,
                                  self.close_plugin_action]
        else:
            additional_actions = [MENU_SEPARATOR,
                                  self.dock_action]

        # Create actions list
        self.plugin_actions = self.get_plugin_actions() + additional_actions
        add_actions(self.options_menu, self.plugin_actions)
开发者ID:impact27,项目名称:spyder,代码行数:18,代码来源:plugins.py


示例18: initialize_plugin

    def initialize_plugin(self):
        """
        Initialize plugin: connect signals, setup actions, etc.

        It must be run at the end of __init__
        """
        self.create_toggle_view_action()

        self.plugin_actions = self.get_plugin_actions() + [MENU_SEPARATOR,
                                                           self.undock_action]
        add_actions(self.options_menu, self.plugin_actions)
        self.options_button.setMenu(self.options_menu)
        self.options_menu.aboutToShow.connect(self.refresh_actions)

        self.sig_show_message.connect(self.show_message)
        self.sig_update_plugin_title.connect(self.update_plugin_title)
        self.sig_option_changed.connect(self.set_option)
        self.setWindowTitle(self.get_plugin_title())
开发者ID:impact27,项目名称:spyder,代码行数:18,代码来源:plugins.py


示例19: __init__

    def __init__(self, parent):
        QTableView.__init__(self, parent)
        self._model = None

        # Setting up actions
        self.date_dayfirst_action = create_action(self, "dayfirst",
            triggered=ft_partial(self.parse_to_type, atype="date", dayfirst=True))
        self.date_monthfirst_action = create_action(self, "monthfirst",
            triggered=ft_partial(self.parse_to_type, atype="date", dayfirst=False))
        self.perc_action = create_action(self, "perc",
            triggered=ft_partial(self.parse_to_type, atype="perc"))
        self.acc_action = create_action(self, "account",
            triggered=ft_partial(self.parse_to_type, atype="account"))
        self.str_action = create_action(self, "unicode",
            triggered=ft_partial(self.parse_to_type, atype="unicode"))
        self.int_action = create_action(self, "int",
            triggered=ft_partial(self.parse_to_type, atype="int"))
        self.float_action = create_action(self, "float",
            triggered=ft_partial(self.parse_to_type, atype="float"))

        # Setting up menus
        self.date_menu = QMenu()
        self.date_menu.setTitle("Date")
        add_actions( self.date_menu, (self.date_dayfirst_action,
                                      self.date_monthfirst_action))
        self.parse_menu = QMenu(self)
        self.parse_menu.addMenu(self.date_menu)
        add_actions( self.parse_menu, (self.perc_action, self.acc_action))
        self.parse_menu.setTitle("String to")
        self.opt_menu = QMenu(self)
        self.opt_menu.addMenu(self.parse_menu)
        add_actions( self.opt_menu, (self.str_action, self.int_action,
                                     self.float_action))
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:33,代码来源:importwizard.py


示例20: setup_menu_actions

 def setup_menu_actions(self):
     """Setup and update the menu actions."""
     self.recent_project_menu.clear()
     self.recent_projects_actions = []
     if self.recent_projects:
         for project in self.recent_projects:
             if self.is_valid_project(project):
                 name = project.replace(get_home_dir(), "~")
                 action = create_action(
                     self,
                     name,
                     icon=ima.icon("project"),
                     triggered=lambda v, path=project: self.open_project(path=path),
                 )
                 self.recent_projects_actions.append(action)
             else:
                 self.recent_projects.remove(project)
         self.recent_projects_actions += [None, self.clear_recent_projects_action]
     else:
         self.recent_projects_actions = [self.clear_recent_projects_action]
     add_actions(self.recent_project_menu, self.recent_projects_actions)
     self.update_project_actions()
开发者ID:jitseniesen,项目名称:spyder,代码行数:22,代码来源:projects.py



注:本文中的spyder.utils.qthelpers.add_actions函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python qthelpers.create_action函数代码示例发布时间:2022-05-27
下一篇:
Python programs.is_module_installed函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap