本文整理汇总了Python中spyderlib.utils.qthelpers.get_std_icon函数的典型用法代码示例。如果您正苦于以下问题:Python get_std_icon函数的具体用法?Python get_std_icon怎么用?Python get_std_icon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_std_icon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_warning
def update_warning(self, warning_type=NO_WARNING, conflicts=[]):
"""Update warning label to reflect conflict status of new shortcut"""
if warning_type == NO_WARNING:
warn = False
tip = 'This shortcut is correct!'
elif warning_type == SEQUENCE_CONFLICT:
template = '<i>{0}<b>{1}</b></i>'
tip_title = _('The new shorcut conflicts with:') + '<br>'
tip_body = ''
for s in conflicts:
tip_body += ' - {0}: {1}<br>'.format(s.context, s.name)
tip_body = tip_body[:-4] # Removing last <br>
tip = template.format(tip_title, tip_body)
warn = True
elif warning_type == SEQUENCE_LENGTH:
# Sequences with 5 keysequences (i.e. Ctrl+1, Ctrl+2, Ctrl+3,
# Ctrl+4, Ctrl+5) are invalid
template = '<i>{0}</i>'
tip = _('A compound sequence can have {break} a maximum of '
'4 subsequences.{break}').format(**{'break': '<br>'})
warn = True
elif warning_type == INVALID_KEY:
template = '<i>{0}</i>'
tip = _('Invalid key entered') + '<br>'
warn = True
self.helper_button.show()
if warn:
self.label_warning.show()
self.helper_button.setIcon(get_std_icon('MessageBoxWarning'))
self.button_ok.setEnabled(False)
else:
self.helper_button.setIcon(get_std_icon('DialogApplyButton'))
self.label_warning.setText(tip)
示例2: __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=get_std_icon("ArrowBack"),
triggered=self.treewidget.go_to_previous_directory)
self.toolbar.addAction(self.previous_action)
self.previous_action.setEnabled(False)
self.connect(self.treewidget, SIGNAL("set_previous_enabled(bool)"),
self.previous_action.setEnabled)
self.next_action = create_action(self, text=_("Next"),
icon=get_std_icon("ArrowForward"),
triggered=self.treewidget.go_to_next_directory)
self.toolbar.addAction(self.next_action)
self.next_action.setEnabled(False)
self.connect(self.treewidget, SIGNAL("set_next_enabled(bool)"),
self.next_action.setEnabled)
parent_action = create_action(self, text=_("Parent"),
icon=get_std_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=get_icon('tooloptions.png'))
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)
示例3: setup_context_menu
def setup_context_menu(self):
"""Reimplement PythonShellWidget method"""
PythonShellWidget.setup_context_menu(self)
self.help_action = create_action(self, _("Help..."),
icon=get_std_icon('DialogHelpButton'),
triggered=self.help)
self.menu.addAction(self.help_action)
示例4: 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=get_std_icon('DirOpenIcon'),
tip=_("Set current working directory"),
triggered=self.set_current_working_directory)
self.env_button = create_action(self, _("Environment variables"),
icon=get_icon('environ.png'),
triggered=self.show_env)
self.syspath_button = create_action(self,
_("Show sys.path contents"),
icon=get_icon('syspath.png'),
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
示例5: get_toolbar_buttons
def get_toolbar_buttons(self):
ExternalShellBase.get_toolbar_buttons(self)
if self.namespacebrowser_button is None and self.stand_alone:
self.namespacebrowser_button = create_toolbutton(self,
get_icon('dictedit.png'), self.tr("Variables"),
tip=self.tr("Show/hide global variables explorer"),
toggled=self.toggle_globals_explorer)
if self.cwd_button is None:
self.cwd_button = create_toolbutton(self,
get_std_icon('DirOpenIcon'), self.tr("Working directory"),
tip=self.tr("Set current working directory"),
triggered=self.set_current_working_directory)
if self.terminate_button is None:
self.terminate_button = create_toolbutton(self,
get_icon('terminate.png'), self.tr("Terminate"),
tip=self.tr("Attempts to terminate the process.\n"
"The process may not exit as a result of "
"clicking this button\n"
"(it is given the chance to prompt "
"the user for any unsaved files, etc)."))
buttons = [self.cwd_button]
if self.namespacebrowser_button is not None:
buttons.append(self.namespacebrowser_button)
buttons += [self.run_button, self.options_button,
self.terminate_button, self.kill_button]
return buttons
示例6: __init__
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.runconf = RunConfiguration()
common_group = QGroupBox(_("General settings"))
common_layout = QGridLayout()
common_group.setLayout(common_layout)
self.clo_cb = QCheckBox(_("Command line options:"))
common_layout.addWidget(self.clo_cb, 0, 0)
self.clo_edit = QLineEdit()
self.connect(self.clo_cb, SIGNAL("toggled(bool)"), self.clo_edit.setEnabled)
self.clo_edit.setEnabled(False)
common_layout.addWidget(self.clo_edit, 0, 1)
self.wd_cb = QCheckBox(_("Working directory:"))
common_layout.addWidget(self.wd_cb, 1, 0)
wd_layout = QHBoxLayout()
self.wd_edit = QLineEdit()
self.connect(self.wd_cb, SIGNAL("toggled(bool)"), self.wd_edit.setEnabled)
self.wd_edit.setEnabled(False)
wd_layout.addWidget(self.wd_edit)
browse_btn = QPushButton(get_std_icon("DirOpenIcon"), "", self)
browse_btn.setToolTip(_("Select directory"))
self.connect(browse_btn, SIGNAL("clicked()"), self.select_directory)
wd_layout.addWidget(browse_btn)
common_layout.addLayout(wd_layout, 1, 1)
radio_group = QGroupBox(_("Interpreter"))
radio_layout = QVBoxLayout()
radio_group.setLayout(radio_layout)
self.current_radio = QRadioButton(_("Execute in current Python " "or IPython interpreter"))
radio_layout.addWidget(self.current_radio)
self.new_radio = QRadioButton(_("Execute in a new dedicated " "Python interpreter"))
radio_layout.addWidget(self.new_radio)
self.systerm_radio = QRadioButton(_("Execute in an external " "system terminal"))
radio_layout.addWidget(self.systerm_radio)
new_group = QGroupBox(_("Dedicated Python interpreter"))
self.connect(self.current_radio, SIGNAL("toggled(bool)"), new_group.setDisabled)
new_layout = QGridLayout()
new_group.setLayout(new_layout)
self.interact_cb = QCheckBox(_("Interact with the Python " "interpreter after execution"))
new_layout.addWidget(self.interact_cb, 1, 0, 1, -1)
self.pclo_cb = QCheckBox(_("Command line options:"))
new_layout.addWidget(self.pclo_cb, 2, 0)
self.pclo_edit = QLineEdit()
self.connect(self.pclo_cb, SIGNAL("toggled(bool)"), self.pclo_edit.setEnabled)
self.pclo_edit.setEnabled(False)
new_layout.addWidget(self.pclo_edit, 2, 1)
pclo_label = QLabel(_("The <b>-u</b> option is " "added to these commands"))
pclo_label.setWordWrap(True)
new_layout.addWidget(pclo_label, 3, 1)
# TODO: Add option for "Post-mortem debugging"
layout = QVBoxLayout()
layout.addWidget(common_group)
layout.addWidget(radio_group)
layout.addWidget(new_group)
self.setLayout(layout)
示例7: update_list
def update_list(self):
"""Update path list"""
self.listwidget.clear()
for name in self.pathlist:
item = QListWidgetItem(name)
item.setIcon(get_std_icon('DirClosedIcon'))
self.listwidget.addItem(item)
self.refresh()
示例8: create_dir_item
def create_dir_item(dirname, parent):
if dirname != root_path:
displayed_name = osp.basename(dirname)
else:
displayed_name = dirname
item = QTreeWidgetItem(parent, [displayed_name])
item.setIcon(0, get_std_icon('DirClosedIcon'))
return item
示例9: update_warning
def update_warning(self):
""" """
widget = self._button_warning
if not self.is_valid():
tip = _('Array dimensions not valid')
widget.setIcon(get_std_icon('MessageBoxWarning'))
widget.setToolTip(tip)
QToolTip.showText(self._widget.mapToGlobal(QPoint(0, 5)), tip)
else:
self._button_warning.setToolTip('')
示例10: update_list
def update_list(self):
"""Update path list"""
self.listwidget.clear()
for name in self.pathlist + self.ro_pathlist:
item = QListWidgetItem(name)
item.setIcon(get_std_icon("DirClosedIcon"))
if name in self.ro_pathlist:
item.setFlags(Qt.NoItemFlags)
self.listwidget.addItem(item)
self.refresh()
示例11: update_warning
def update_warning(self, reset=False):
""" """
conflicts = self.check_conflicts()
if reset:
conflicts = []
widget = self.helper_button
if conflicts:
tip_title = _('The new entered shorcut conflicts with:') + '\n'
tip_body = ''
for s in conflicts:
tip_body += ' - {0}: {1}\n'.format(s.context, s.name)
tip = '{0}{1}'.format(tip_title, tip_body)
widget.setIcon(get_std_icon('MessageBoxWarning'))
widget.setToolTip(tip)
QToolTip.showText(widget.mapToGlobal(QPoint(0, 5)), tip)
else:
widget.setToolTip('')
QToolTip.hideText()
widget.setIcon(get_std_icon('DialogApplyButton'))
示例12: __init__
def __init__(self):
QToolButton.__init__(self)
self.setIcon(get_std_icon('MessageBoxInformation'))
style = """
QToolButton {
border: 1px solid grey;
padding:0px;
border-radius: 2px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #f6f7fa, stop: 1 #dadbde);
}
"""
self.setStyleSheet(style)
示例13: create_browsedir
def create_browsedir(self, text, option, default=NoDefault, tip=None):
widget = self.create_lineedit(text, option, default,
alignment=Qt.Horizontal)
for edit in self.lineedits:
if widget.isAncestorOf(edit):
break
msg = _("Invalid directory path")
self.validate_data[edit] = (osp.isdir, msg)
browse_btn = QPushButton(get_std_icon('DirOpenIcon'), "", self)
browse_btn.setToolTip(_("Select directory"))
browse_btn.clicked.connect(lambda: self.select_directory(edit))
layout = QHBoxLayout()
layout.addWidget(widget)
layout.addWidget(browse_btn)
layout.setContentsMargins(0, 0, 0, 0)
browsedir = QWidget(self)
browsedir.setLayout(layout)
return browsedir
示例14: 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("Ctrl+I"),
icon=get_std_icon('MessageBoxInformation'),
triggered=self.inspect_object)
clear_line_action = create_action(self, _("Clear line or block"),
QKeySequence("Shift+Escape"),
icon=get_icon('eraser.png'),
triggered=self.clear_line)
clear_console_action = create_action(self, _("Clear console"),
QKeySequence("Ctrl+L"),
icon=get_icon('clear.png'),
triggered=self.clear_console)
quit_action = create_action(self, _("&Quit"), icon='exit.png',
triggered=self.exit_callback)
add_actions(menu, (None, inspect_action, clear_line_action,
clear_console_action, None, quit_action))
return menu
示例15: create_browsefile
def create_browsefile(self, text, option, default=NoDefault, tip=None,
filters=None):
widget = self.create_lineedit(text, option, default,
alignment=Qt.Horizontal)
for edit in self.lineedits:
if widget.isAncestorOf(edit):
break
msg = _("Invalid file path")
self.validate_data[edit] = (osp.isfile, msg)
browse_btn = QPushButton(get_std_icon('FileIcon'), "", self)
browse_btn.setToolTip(_("Select file"))
self.connect(browse_btn, SIGNAL("clicked()"),
lambda: self.select_file(edit, filters))
layout = QHBoxLayout()
layout.addWidget(widget)
layout.addWidget(browse_btn)
layout.setContentsMargins(0, 0, 0, 0)
browsedir = QWidget(self)
browsedir.setLayout(layout)
return browsedir