当前位置: 首页>>代码示例>>Python>>正文


Python qthelpers.create_action函数代码示例

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


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

示例1: setup_common_actions

 def setup_common_actions(self):
     """Setup context menu common actions"""
     self.collapse_all_action = create_action(self,
                                  text=_('Collapse all'),
                                  icon=ima.icon('collapse'),
                                  triggered=self.collapseAll)
     self.expand_all_action = create_action(self,
                                  text=_('Expand all'),
                                  icon=ima.icon('expand'),
                                  triggered=self.expandAll)
     self.restore_action = create_action(self,
                                  text=_('Restore'),
                                  tip=_('Restore original tree layout'),
                                  icon=ima.icon('restore'),
                                  triggered=self.restore)
     self.collapse_selection_action = create_action(self,
                                  text=_('Collapse selection'),
                                  icon=ima.icon('collapse_selection'),
                                  triggered=self.collapse_selection)
     self.expand_selection_action = create_action(self,
                                  text=_('Expand selection'),
                                  icon=ima.icon('expand_selection'),
                                  triggered=self.expand_selection)
     return [self.collapse_all_action, self.expand_all_action,
             self.restore_action, None,
             self.collapse_selection_action, self.expand_selection_action]
开发者ID:0xBADCA7,项目名称:spyder,代码行数:26,代码来源:onecolumntree.py

示例2: get_plugin_actions

    def get_plugin_actions(self):
        """Return a list of actions related to plugin"""
        self.new_project_action = create_action(self,
                                    _("New Project..."),
                                    triggered=self.create_new_project)
        self.open_project_action = create_action(self,
                                    _("Open Project..."),
                                    triggered=lambda v: self.open_project())
        self.close_project_action = create_action(self,
                                    _("Close Project"),
                                    triggered=self.close_project)
        self.clear_recent_projects_action =\
            create_action(self, _("Clear this list"),
                          triggered=self.clear_recent_projects)
        self.edit_project_preferences_action =\
            create_action(self, _("Project Preferences"),
                          triggered=self.edit_project_preferences)
        self.recent_project_menu = QMenu(_("Recent Projects"), self)
        explorer_action = self.toggle_view_action

        self.main.projects_menu_actions += [self.new_project_action,
                                            None,
                                            self.open_project_action,
                                            self.close_project_action,
                                            None,
                                            self.recent_project_menu,
                                            explorer_action]

        self.setup_menu_actions()
        return []
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:30,代码来源:projects.py

示例3: get_options_menu

    def get_options_menu(self):
        """Return options menu"""
        reset_action = create_action(self, _("Remove all variables"),
                                     icon=ima.icon('editdelete'),
                                     triggered=self.reset_namespace)

        self.show_time_action = create_action(self, _("Show elapsed time"),
                                         toggled=self.set_elapsed_time_visible)

        env_action = create_action(
                        self,
                        _("Show environment variables"),
                        icon=ima.icon('environ'),
                        triggered=self.shellwidget.get_env
                     )

        syspath_action = create_action(
                            self,
                            _("Show sys.path contents"),
                            icon=ima.icon('syspath'),
                            triggered=self.shellwidget.get_syspath
                         )

        self.show_time_action.setChecked(self.show_elapsed_time)
        additional_actions = [reset_action,
                              MENU_SEPARATOR,
                              env_action,
                              syspath_action,
                              self.show_time_action]

        if self.menu_actions is not None:
            return self.menu_actions + additional_actions
        else:
            return additional_actions
开发者ID:0xBADCA7,项目名称:spyder,代码行数:34,代码来源:client.py

示例4: get_options_menu

    def get_options_menu(self):
        """Return options menu"""
        env_action = create_action(
                        self,
                        _("Show environment variables"),
                        icon=ima.icon('environ'),
                        triggered=self.shellwidget.get_env
                     )

        syspath_action = create_action(
                            self,
                            _("Show sys.path contents"),
                            icon=ima.icon('syspath'),
                            triggered=self.shellwidget.get_syspath
                         )

        self.show_time_action.setChecked(self.show_elapsed_time)
        additional_actions = [MENU_SEPARATOR,
                              env_action,
                              syspath_action,
                              self.show_time_action]

        if self.menu_actions is not None:
            console_menu = self.menu_actions + additional_actions
            return console_menu

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

示例5: 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

示例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: get_plugin_actions

    def get_plugin_actions(self):
        """Return a list of actions related to plugin"""
        interpreter_action = create_action(self,
                            _("Open a &Python console"), None,
                            ima.icon('python'),
                            triggered=self.open_interpreter)
        if os.name == 'nt':
            text = _("Open &command prompt")
            tip = _("Open a Windows command prompt")
        else:
            text = _("Open a &terminal")
            tip = _("Open a terminal window")
        terminal_action = create_action(self, text, None, None, tip,
                                        triggered=self.open_terminal)
        run_action = create_action(self,
                            _("&Run..."), None,
                            ima.icon('run_small'), _("Run a Python script"),
                            triggered=self.run_script)

        consoles_menu_actions = [interpreter_action]
        tools_menu_actions = [terminal_action]
        self.menu_actions = [interpreter_action, terminal_action, run_action]

        self.main.consoles_menu_actions += consoles_menu_actions
        self.main.tools_menu_actions += tools_menu_actions

        return self.menu_actions+consoles_menu_actions+tools_menu_actions
开发者ID:jitseniesen,项目名称:spyder,代码行数:27,代码来源:externalconsole.py

示例8: setup_toolbar

    def setup_toolbar(self, exclude_private, exclude_uppercase,
                      exclude_capitalized, exclude_unsupported):
        """Setup toolbar"""
        self.setup_in_progress = True
        toolbar = []

        load_button = create_toolbutton(self, text=_('Import data'),
                                        icon=ima.icon('fileimport'),
                                        triggered=lambda: self.import_data())
        self.save_button = create_toolbutton(self, text=_("Save data"),
                            icon=ima.icon('filesave'),
                            triggered=lambda: self.save_data(self.filename))
        self.save_button.setEnabled(False)
        save_as_button = create_toolbutton(self,
                                           text=_("Save data as..."),
                                           icon=ima.icon('filesaveas'),
                                           triggered=self.save_data)
        reset_namespace_button = create_toolbutton(
                self, text=_("Reset the namespace"),
                icon=ima.icon('editclear'), triggered=self.reset_namespace)

        toolbar += [load_button, self.save_button, save_as_button,
                    reset_namespace_button]

        self.exclude_private_action = create_action(self,
                _("Exclude private references"),
                tip=_("Exclude references which name starts"
                            " with an underscore"),
                toggled=lambda state:
                self.sig_option_changed.emit('exclude_private', state))
        self.exclude_private_action.setChecked(exclude_private)
        
        self.exclude_uppercase_action = create_action(self,
                _("Exclude all-uppercase references"),
                tip=_("Exclude references which name is uppercase"),
                toggled=lambda state:
                self.sig_option_changed.emit('exclude_uppercase', state))
        self.exclude_uppercase_action.setChecked(exclude_uppercase)
        
        self.exclude_capitalized_action = create_action(self,
                _("Exclude capitalized references"),
                tip=_("Exclude references which name starts with an "
                      "uppercase character"),
                toggled=lambda state:
                self.sig_option_changed.emit('exclude_capitalized', state))
        self.exclude_capitalized_action.setChecked(exclude_capitalized)
        
        self.exclude_unsupported_action = create_action(self,
                _("Exclude unsupported data types"),
                tip=_("Exclude references to unsupported data types"
                            " (i.e. which won't be handled/saved correctly)"),
                toggled=lambda state:
                self.sig_option_changed.emit('exclude_unsupported', state))
        self.exclude_unsupported_action.setChecked(exclude_unsupported)
        
        self.setup_in_progress = False
        
        return toolbar
开发者ID:rlaverde,项目名称:spyder,代码行数:58,代码来源:namespacebrowser.py

示例9: get_plugin_actions

 def get_plugin_actions(self):
     """Return a list of actions related to plugin"""
     history_action = create_action(self, _("History..."),
                                    None, ima.icon('history'),
                                    _("Set history maximum entries"),
                                    triggered=self.change_history_depth)
     self.wrap_action = create_action(self, _("Wrap lines"),
                                 toggled=self.toggle_wrap_mode)
     self.wrap_action.setChecked( self.get_option('wrap') )
     self.menu_actions = [history_action, self.wrap_action]
     return self.menu_actions
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:11,代码来源:history.py

示例10: __init__

 def __init__(self, parent):
     QWebEngineView.__init__(self, parent)
     self.zoom_factor = 1.
     self.zoom_out_action = create_action(self, _("Zoom out"),
                                          icon=ima.icon('zoom_out'),
                                          triggered=self.zoom_out)
     self.zoom_in_action = create_action(self, _("Zoom in"),
                                         icon=ima.icon('zoom_in'),
                                         triggered=self.zoom_in)
     if WEBENGINE:
         web_page = WebPage(self)
         self.setPage(web_page)
开发者ID:silentquasar,项目名称:spyder,代码行数:12,代码来源:browser.py

示例11: setup_common_actions

 def setup_common_actions(self):
     """Setup context menu common actions"""
     # Filters
     filters_action = create_action(self, _("Edit filename filters..."),
                                    None, ima.icon('filter'),
                                    triggered=self.edit_filter)
     # Show all files
     all_action = create_action(self, _("Show all files"),
                                toggled=self.toggle_all)
     all_action.setChecked(self.show_all)
     self.toggle_all(self.show_all)
     
     return [filters_action, all_action]
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:13,代码来源:explorer.py

示例12: create_toggle_view_action

 def create_toggle_view_action(self):
     """Associate a toggle view action with each plugin"""
     title = self.get_plugin_title()
     if self.CONF_SECTION == 'editor':
         title = _('Editor')
     if self.shortcut is not None:
         action = create_action(self, title,
                          toggled=lambda checked: self.toggle_view(checked),
                          shortcut=QKeySequence(self.shortcut),
                          context=Qt.WidgetShortcut)
     else:
         action = create_action(self, title, toggled=lambda checked:
                                             self.toggle_view(checked))
     self.toggle_view_action = action
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:14,代码来源:__init__.py

示例13: register_plugin

    def register_plugin(self):
        """Register plugin in Spyder's main window."""
        # Get information from Spyder proper into plugin
        self.update_pythonpath()
        self.update_default_wdir()

        # Connect to relevant signals
        self.main.sig_pythonpath_changed.connect(self.update_pythonpath)
        self.main.workingdirectory.set_explorer_cwd.connect(
            self.update_default_wdir)
        self.main.projects.sig_project_created.connect(
            self.handle_project_change)
        self.main.projects.sig_project_loaded.connect(
            self.handle_project_change)
        self.main.projects.sig_project_closed.connect(
            self.handle_project_change)
        self.unittestwidget.sig_newconfig.connect(self.save_config)
        self.unittestwidget.sig_edit_goto.connect(self.goto_in_editor)

        # Add plugin as dockwidget to main window
        self.main.add_dockwidget(self)

        # Create action and add it to Spyder's menu
        unittesting_act = create_action(
            self,
            _("Run unit tests"),
            icon=ima.icon('profiler'),
            shortcut="Shift+Alt+F11",
            triggered=self.maybe_configure_and_start)
        self.main.run_menu_actions += [unittesting_act]
        self.main.editor.pythonfile_dependent_actions += [unittesting_act]

        # Save all files before running tests
        self.unittestwidget.pre_test_hook = self.main.editor.save_all
开发者ID:jitseniesen,项目名称:spyder.unittest,代码行数:34,代码来源:unittestplugin.py

示例14: create_undock_action

 def create_undock_action(self):
     """Create the undock action for the plugin."""
     self.undock_action = create_action(self,
                                        _("Undock"),
                                        icon=ima.icon('newwindow'),
                                        tip=_("Undock the plugin"),
                                        triggered=self.undock_plugin)
开发者ID:0xBADCA7,项目名称:spyder,代码行数:7,代码来源:base.py

示例15: __init__

    def __init__(self, parent=None, show_fullpath=True, fullpath_sorting=True,
                 show_all_files=True, show_comments=True):
        QWidget.__init__(self, parent)

        self.treewidget = OutlineExplorerTreeWidget(self,
                                            show_fullpath=show_fullpath,
                                            fullpath_sorting=fullpath_sorting,
                                            show_all_files=show_all_files,
                                            show_comments=show_comments)

        self.visibility_action = create_action(self,
                                           _("Show/hide outline explorer"),
                                           icon='outline_explorer_vis.png',
                                           toggled=self.toggle_visibility)
        self.visibility_action.setChecked(True)
        
        btn_layout = QHBoxLayout()
        btn_layout.setAlignment(Qt.AlignLeft)
        for btn in self.setup_buttons():
            btn_layout.addWidget(btn)

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addLayout(btn_layout)
        layout.addWidget(self.treewidget)
        self.setLayout(layout)
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:26,代码来源:editortools.py


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