本文整理汇总了Python中spyderlib.utils.icon_manager.icon函数的典型用法代码示例。如果您正苦于以下问题:Python icon函数的具体用法?Python icon怎么用?Python icon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例2: setup_top_toolbar
def setup_top_toolbar(self, layout):
toolbar = []
movetop_button = create_toolbutton(self,
text=_("Move to top"),
icon=ima.icon('2uparrow'),
triggered=lambda: self.move_to(absolute=0),
text_beside_icon=True)
toolbar.append(movetop_button)
moveup_button = create_toolbutton(self,
text=_("Move up"),
icon=ima.icon('1uparrow'),
triggered=lambda: self.move_to(relative=-1),
text_beside_icon=True)
toolbar.append(moveup_button)
movedown_button = create_toolbutton(self,
text=_("Move down"),
icon=ima.icon('1downarrow'),
triggered=lambda: self.move_to(relative=1),
text_beside_icon=True)
toolbar.append(movedown_button)
movebottom_button = create_toolbutton(self,
text=_("Move to bottom"),
icon=ima.icon('2downarrow'),
triggered=lambda: self.move_to(absolute=1),
text_beside_icon=True)
toolbar.append(movebottom_button)
self.selection_widgets.extend(toolbar)
self._add_widgets_to_layout(layout, toolbar)
return toolbar
示例3: add_history
def add_history(self, filename):
"""
Add new history tab
Slot for add_history signal emitted by shell instance
"""
filename = encoding.to_unicode_from_fs(filename)
if filename in self.filenames:
return
editor = codeeditor.CodeEditor(self)
if osp.splitext(filename)[1] == '.py':
language = 'py'
icon = ima.icon('python')
else:
language = 'bat'
icon = ima.icon('cmdprompt')
editor.setup_editor(linenumbers=False, language=language,
scrollflagarea=False)
editor.focus_changed.connect(lambda: self.focus_changed.emit())
editor.setReadOnly(True)
color_scheme = get_color_scheme(self.get_option('color_scheme_name'))
editor.set_font( self.get_plugin_font(), color_scheme )
editor.toggle_wrap_mode( self.get_option('wrap') )
text, _ = encoding.read(filename)
editor.set_text(text)
editor.set_cursor_position('eof')
self.editors.append(editor)
self.filenames.append(filename)
self.icons.append(icon)
index = self.tabwidget.addTab(editor, osp.basename(filename))
self.find_widget.set_editor(editor)
self.tabwidget.setTabToolTip(index, filename)
self.tabwidget.setTabIcon(index, icon)
self.tabwidget.setCurrentIndex(index)
示例4: create_scedit
def create_scedit(self, text, option, default=NoDefault, tip=None,
without_layout=False):
label = QLabel(text)
clayout = ColorLayout(QColor(Qt.black), self)
clayout.lineedit.setMaximumWidth(80)
if tip is not None:
clayout.setToolTip(tip)
cb_bold = QCheckBox()
cb_bold.setIcon(ima.icon('bold'))
cb_bold.setToolTip(_("Bold"))
cb_italic = QCheckBox()
cb_italic.setIcon(ima.icon('italic'))
cb_italic.setToolTip(_("Italic"))
self.scedits[(clayout, cb_bold, cb_italic)] = (option, default)
if without_layout:
return label, clayout, cb_bold, cb_italic
layout = QHBoxLayout()
layout.addWidget(label)
layout.addLayout(clayout)
layout.addSpacing(10)
layout.addWidget(cb_bold)
layout.addWidget(cb_italic)
layout.addStretch(1)
layout.setContentsMargins(0, 0, 0, 0)
widget = QWidget(self)
widget.setLayout(layout)
return widget
示例5: get_toolbar_buttons
def get_toolbar_buttons(self):
ExternalShellBase.get_toolbar_buttons(self)
if self.namespacebrowser_button is None and self.stand_alone is not None:
self.namespacebrowser_button = create_toolbutton(
self,
text=_("Variables"),
icon=ima.icon("dictedit"),
tip=_("Show/hide global variables explorer"),
toggled=self.toggle_globals_explorer,
text_beside_icon=True,
)
if self.terminate_button is None:
self.terminate_button = create_toolbutton(
self,
text=_("Terminate"),
icon=ima.icon("stop"),
tip=_(
"Attempts to stop the process. The process\n"
"may not exit as a result of clicking this\n"
"button (it is given the chance to prompt\n"
"the user for any unsaved files, etc)."
),
)
buttons = []
if self.namespacebrowser_button is not None:
buttons.append(self.namespacebrowser_button)
buttons += [self.run_button, self.terminate_button, self.kill_button, self.options_button]
return buttons
示例6: add_actions_to_context_menu
def add_actions_to_context_menu(self, menu):
"""Add actions to IPython widget context menu"""
# See spyderlib/widgets/ipython.py for more details on this method
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+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
示例7: create_file_new_actions
def create_file_new_actions(self, fnames):
"""Return actions for submenu 'New...'"""
if not fnames:
return []
new_file_act = create_action(
self,
_("File..."),
icon=ima.icon('filenew'),
triggered=lambda: self.new_file(fnames[-1]))
new_module_act = create_action(
self,
_("Module..."),
icon=ima.icon('spyder'),
triggered=lambda: self.new_module(fnames[-1]))
new_folder_act = create_action(
self,
_("Folder..."),
icon=ima.icon('folder_new'),
triggered=lambda: self.new_folder(fnames[-1]))
new_package_act = create_action(
self,
_("Package..."),
icon=ima.icon('package_new'),
triggered=lambda: self.new_package(fnames[-1]))
return [
new_file_act, new_folder_act, None, new_module_act, new_package_act
]
示例8: 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]
示例9: 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
示例10: 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
示例11: __init__
def __init__(self, parent):
QWebView.__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)
示例12: __init__
def __init__(self, *args, **kwargs):
super(IconLineEdit, self).__init__(*args, **kwargs)
self._status = True
self._status_set = True
self._valid_icon = ima.icon('todo')
self._invalid_icon = ima.icon('warning')
self._set_icon = ima.icon('todo_list')
self._application_style = QApplication.style().objectName()
self._refresh()
self._paint_count = 0
self._icon_visible = False
示例13: __init__
def __init__(self, parent=None, name_filters=['*.py', '*.pyw'],
show_all=False, show_cd_only=None, show_icontext=True):
QWidget.__init__(self, parent)
self.treewidget = ExplorerTreeWidget(self, show_cd_only=show_cd_only)
self.treewidget.setup(name_filters=name_filters, show_all=show_all)
self.treewidget.chdir(getcwd())
icontext_action = create_action(self, _("Show icons and text"),
toggled=self.toggle_icontext)
self.treewidget.common_actions += [None, icontext_action]
# Setup toolbar
self.toolbar = QToolBar(self)
self.toolbar.setIconSize(QSize(16, 16))
self.previous_action = create_action(self, text=_("Previous"),
icon=ima.icon('ArrowBack'),
triggered=self.treewidget.go_to_previous_directory)
self.toolbar.addAction(self.previous_action)
self.previous_action.setEnabled(False)
self.treewidget.set_previous_enabled.connect(
self.previous_action.setEnabled)
self.next_action = create_action(self, text=_("Next"),
icon=ima.icon('ArrowForward'),
triggered=self.treewidget.go_to_next_directory)
self.toolbar.addAction(self.next_action)
self.next_action.setEnabled(False)
self.treewidget.set_next_enabled.connect(self.next_action.setEnabled)
parent_action = create_action(self, text=_("Parent"),
icon=ima.icon('ArrowUp'),
triggered=self.treewidget.go_to_parent_directory)
self.toolbar.addAction(parent_action)
self.toolbar.addSeparator()
options_action = create_action(self, text='', tip=_('Options'),
icon=ima.icon('tooloptions'))
self.toolbar.addAction(options_action)
widget = self.toolbar.widgetForAction(options_action)
widget.setPopupMode(QToolButton.InstantPopup)
menu = QMenu(self)
add_actions(menu, self.treewidget.common_actions)
options_action.setMenu(menu)
icontext_action.setChecked(show_icontext)
self.toggle_icontext(show_icontext)
vlayout = QVBoxLayout()
vlayout.addWidget(self.toolbar)
vlayout.addWidget(self.treewidget)
self.setLayout(vlayout)
示例14: __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)
示例15: create_folder_manage_actions
def create_folder_manage_actions(self, fnames):
"""Return folder management actions"""
actions = []
if os.name == "nt":
_title = _("Open command prompt here")
else:
_title = _("Open terminal here")
action = create_action(self, _title, icon=ima.icon("cmdprompt"), triggered=lambda: self.open_terminal(fnames))
actions.append(action)
_title = _("Open Python console here")
action = create_action(self, _title, icon=ima.icon("python"), triggered=lambda: self.open_interpreter(fnames))
actions.append(action)
return actions