本文整理汇总了Python中spyder.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: 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
示例3: 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]
示例4: 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
示例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
示例6: 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
示例7: 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
示例8: 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
示例9: 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
示例10: setup_arrow_buttons
def setup_arrow_buttons(self):
"""
Setup the up and down arrow buttons that are placed at the top and
bottom of the scrollarea.
"""
# Get the height of the up/down arrow of the default vertical
# scrollbar :
vsb = self.scrollarea.verticalScrollBar()
style = vsb.style()
opt = QStyleOptionSlider()
vsb.initStyleOption(opt)
vsb_up_arrow = style.subControlRect(
QStyle.CC_ScrollBar, opt, QStyle.SC_ScrollBarAddLine, self)
# Setup the up and down arrow button :
up_btn = up_btn = QPushButton(icon=ima.icon('last_edit_location'))
up_btn.setFlat(True)
up_btn.setFixedHeight(vsb_up_arrow.size().height())
up_btn.clicked.connect(self.go_up)
down_btn = QPushButton(icon=ima.icon('folding.arrow_down_on'))
down_btn.setFlat(True)
down_btn.setFixedHeight(vsb_up_arrow.size().height())
down_btn.clicked.connect(self.go_down)
return up_btn, down_btn
示例11: update_dependencies
def update_dependencies(self, dependencies):
self.clear()
headers = (_("Module"), _(" Required "),
_(" Installed "), _("Provided features"))
self.setHeaderLabels(headers)
mandatory_item = QTreeWidgetItem(["Mandatory"])
font = mandatory_item.font(0)
font.setBold(True)
mandatory_item.setFont(0, font)
optional_item = QTreeWidgetItem(["Optional"])
optional_item.setFont(0, font)
self.addTopLevelItems([mandatory_item, optional_item])
for dependency in dependencies:
item = QTreeWidgetItem([dependency.modname,
dependency.required_version,
dependency.installed_version,
dependency.features])
if dependency.check():
item.setIcon(0, ima.icon('dependency_ok'))
elif dependency.optional:
item.setIcon(0, ima.icon('dependency_warning'))
item.setForeground(2, QColor('#ff6a00'))
else:
item.setIcon(0, ima.icon('dependency_error'))
item.setForeground(2, QColor(Qt.darkRed))
if dependency.optional:
optional_item.addChild(item)
else:
mandatory_item.addChild(item)
self.expandAll()
示例12: __init__
def __init__(self, path, treewidget, is_python=True):
QTreeWidgetItem.__init__(self, treewidget, QTreeWidgetItem.Type)
self.path = path
self.setIcon(
0, ima.icon('python') if is_python else ima.icon('TextFileIcon'))
self.setToolTip(0, path)
set_item_user_text(self, path)
示例13: 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
示例14: 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
示例15: icon
def icon(self, icontype_or_qfileinfo):
"""Reimplement Qt method"""
if isinstance(icontype_or_qfileinfo, QFileIconProvider.IconType):
return super(IconProvider, self).icon(icontype_or_qfileinfo)
else:
qfileinfo = icontype_or_qfileinfo
fname = osp.normpath(to_text_string(qfileinfo.absoluteFilePath()))
if osp.isdir(fname):
return ima.icon('DirOpenIcon')
else:
return ima.icon('FileIcon')