本文整理汇总了Python中spyderlib.config.get_icon函数的典型用法代码示例。如果您正苦于以下问题:Python get_icon函数的具体用法?Python get_icon怎么用?Python get_icon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_icon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_context_menu
def setup_context_menu(self):
"""Setup shell context menu"""
self.menu = QMenu(self)
self.cut_action = create_action(self,
translate("ShellBaseWidget", "Cut"),
shortcut=keybinding('Cut'),
icon=get_icon('editcut.png'),
triggered=self.cut)
self.copy_action = create_action(self,
translate("ShellBaseWidget", "Copy"),
shortcut=keybinding('Copy'),
icon=get_icon('editcopy.png'),
triggered=self.copy)
paste_action = create_action(self,
translate("ShellBaseWidget", "Paste"),
shortcut=keybinding('Paste'),
icon=get_icon('editpaste.png'),
triggered=self.paste)
save_action = create_action(self,
translate("ShellBaseWidget",
"Save history log..."),
icon=get_icon('filesave.png'),
tip=translate("ShellBaseWidget",
"Save current history log (i.e. all "
"inputs and outputs) in a text file"),
triggered=self.save_historylog)
add_actions(self.menu, (self.cut_action, self.copy_action,
paste_action, None, save_action) )
示例2: __init__
def __init__(self, parent, data, readonly=False, title="",
names=False, truncate=True, minmax=False,
inplace=False, collvalue=True):
BaseTableView.__init__(self, parent)
self.dictfilter = None
self.readonly = readonly or isinstance(data, tuple)
self.model = None
self.delegate = None
DictModelClass = ReadOnlyDictModel if self.readonly else DictModel
self.model = DictModelClass(self, data, title, names=names,
truncate=truncate, minmax=minmax,
collvalue=collvalue)
self.setModel(self.model)
self.delegate = DictDelegate(self, inplace=inplace)
self.setItemDelegate(self.delegate)
self.setup_table()
self.menu = self.setup_menu(truncate, minmax, inplace, collvalue)
self.copy_action = create_action(self,
translate("DictEditor", "Copy"),
icon=get_icon('editcopy.png'),
triggered=self.copy)
self.paste_action = create_action(self,
translate("DictEditor", "Paste"),
icon=get_icon('editpaste.png'),
triggered=self.paste)
self.menu.insertAction(self.remove_action, self.copy_action)
self.menu.insertAction(self.remove_action, self.paste_action)
self.empty_ws_menu = QMenu(self)
self.empty_ws_menu.addAction(self.paste_action)
示例3: add_history
def add_history(self, filename):
"""
Add new history tab
Slot for SIGNAL('add_history(QString)') emitted by shell instance
"""
filename = encoding.to_unicode(filename)
if filename in self.filenames:
return
editor = CodeEditor(self)
if osp.splitext(filename)[1] == '.py':
language = 'py'
icon = get_icon('python.png')
else:
language = 'bat'
icon = get_icon('cmdprompt.png')
editor.setup_editor(linenumbers=False, language=language,
code_folding=True, scrollflagarea=False)
self.connect(editor, SIGNAL("focus_changed()"),
lambda: self.emit(SIGNAL("focus_changed()")))
editor.setReadOnly(True)
editor.set_font( get_font(self.ID) )
editor.toggle_wrap_mode( CONF.get(self.ID, '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: setup_common_actions
def setup_common_actions(self):
"""Setup context menu common actions"""
self.collapse_all_action = create_action(self,
text=_('Collapse all'),
icon=get_icon('collapse.png'),
triggered=self.collapseAll)
self.expand_all_action = create_action(self,
text=_('Expand all'),
icon=get_icon('expand.png'),
triggered=self.expandAll)
self.restore_action = create_action(self,
text=_('Restore'),
tip=_('Restore original tree layout'),
icon=get_icon('restore.png'),
triggered=self.restore)
self.collapse_selection_action = create_action(self,
text=_('Collapse selection'),
icon=get_icon('collapse_selection.png'),
triggered=self.collapse_selection)
self.expand_selection_action = create_action(self,
text=_('Expand selection'),
icon=get_icon('expand_selection.png'),
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]
示例5: get_toolbar_buttons
def get_toolbar_buttons(self):
if self.run_button is None:
self.run_button = create_toolbutton(self, text=_("Run"),
icon=get_icon('run.png'),
tip=_("Run again this program"),
triggered=self.start_shell)
if self.kill_button is None:
self.kill_button = create_toolbutton(self, text=_("Kill"),
icon=get_icon('kill.png'),
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=get_icon('tooloptions.png'))
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
示例6: setup_bottom_toolbar
def setup_bottom_toolbar(self, layout, sync=True):
toolbar = []
add_button = create_toolbutton(
self, text=_("Add path"), icon=get_icon("edit_add.png"), triggered=self.add_path, text_beside_icon=True
)
toolbar.append(add_button)
remove_button = create_toolbutton(
self,
text=_("Remove path"),
icon=get_icon("edit_remove.png"),
triggered=self.remove_path,
text_beside_icon=True,
)
toolbar.append(remove_button)
self.selection_widgets.append(remove_button)
self._add_widgets_to_layout(layout, toolbar)
layout.addStretch(1)
if os.name == "nt" and sync:
self.sync_button = create_toolbutton(
self,
text=_("Synchronize..."),
icon=get_icon("synchronize.png"),
triggered=self.synchronize,
tip=_("Synchronize Spyder's path list with PYTHONPATH " "environment variable"),
text_beside_icon=True,
)
layout.addWidget(self.sync_button)
return toolbar
示例7: 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
示例8: 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)
run_settings_menu = QMenu(_("Run settings"), self)
add_actions(run_settings_menu,
(self.interact_action, self.debug_action, self.args_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
示例9: __init__
def __init__(self, parent=None, name_filters=['*.py', '*.pyw'],
valid_types=('.py', '.pyw'), show_all=False,
show_cd_only=None, show_toolbar=True, show_icontext=True):
QWidget.__init__(self, parent)
self.treewidget = ExplorerTreeWidget(self, show_cd_only=show_cd_only)
self.treewidget.setup(name_filters=name_filters,
valid_types=valid_types, show_all=show_all)
self.treewidget.chdir(os.getcwdu())
toolbar_action = create_action(self, _("Show toolbar"),
toggled=self.toggle_toolbar)
icontext_action = create_action(self, _("Show icons and text"),
toggled=self.toggle_icontext)
self.treewidget.common_actions += [None,
toolbar_action, icontext_action]
# Setup toolbar
self.toolbar = QToolBar(self)
self.toolbar.setIconSize(QSize(16, 16))
self.previous_action = create_action(self, text=_("Previous"),
icon=get_icon('previous.png'),
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_icon('next.png'),
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_icon('up.png'),
triggered=self.treewidget.go_to_parent_directory)
self.toolbar.addAction(parent_action)
options_action = create_action(self, text=_("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)
toolbar_action.setChecked(show_toolbar)
self.toggle_toolbar(show_toolbar)
icontext_action.setChecked(show_icontext)
self.toggle_icontext(show_icontext)
vlayout = QVBoxLayout()
vlayout.addWidget(self.toolbar)
vlayout.addWidget(self.treewidget)
self.setLayout(vlayout)
示例10: 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(get_icon("bold.png"))
cb_bold.setToolTip(_("Bold"))
cb_italic = QCheckBox()
cb_italic.setIcon(get_icon("italic.png"))
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
示例11: setup_top_toolbar
def setup_top_toolbar(self, layout):
toolbar = []
movetop_button = create_toolbutton(self,
text=self.tr("Move to top"),
icon=get_icon('2uparrow.png'),
triggered=lambda: self.move_to(absolute=0))
toolbar.append(movetop_button)
moveup_button = create_toolbutton(self,
text=self.tr("Move up"),
icon=get_icon('1uparrow.png'),
triggered=lambda: self.move_to(relative=-1))
toolbar.append(moveup_button)
movedown_button = create_toolbutton(self,
text=self.tr("Move down"),
icon=get_icon('1downarrow.png'),
triggered=lambda: self.move_to(relative=1))
toolbar.append(movedown_button)
movebottom_button = create_toolbutton(self,
text=self.tr("Move to bottom"),
icon=get_icon('2downarrow.png'),
triggered=lambda: self.move_to(absolute=1))
toolbar.append(movebottom_button)
self.selection_widgets.extend(toolbar)
self._add_widgets_to_layout(layout, toolbar)
return toolbar
示例12: __init__
def __init__(self, parent):
QWebView.__init__(self, parent)
self.zoom_factor = 1.
self.zoom_out_action = create_action(self, _("Zoom out"),
icon=get_icon('zoom_out.png'),
triggered=self.zoom_out)
self.zoom_in_action = create_action(self, _("Zoom in"),
icon=get_icon('zoom_in.png'),
triggered=self.zoom_in)
示例13: get_toolbar_buttons
def get_toolbar_buttons(self):
self.run_button = create_toolbutton(self, get_icon('run.png'),
self.tr("Run"),
tip=self.tr("Run again this program"),
triggered=self.start)
self.kill_button = create_toolbutton(self, get_icon('kill.png'),
self.tr("Kill"),
tip=self.tr("Kills the current process, "
"causing it to exit immediately"))
return [self.run_button, self.kill_button]
示例14: setup_common_actions
def setup_common_actions(self):
"""Setup context menu common actions"""
collapse_act = create_action(self,
text=self.tr('Collapse all'),
icon=get_icon('collapse.png'),
triggered=self.collapseAll)
expand_act = create_action(self,
text=self.tr('Expand all'),
icon=get_icon('expand.png'),
triggered=self.expandAll)
return [collapse_act, expand_act]
示例15: populate_classes
def populate_classes(self):
"""Populate classes"""
self.lines = {}
for lineno, c_name, methods in self.classes:
item = QTreeWidgetItem(self, [c_name])
self.lines[item] = lineno
if methods is None:
item.setIcon(0, get_icon('function.png'))
else:
item.setIcon(0, get_icon('class.png'))
if methods:
self.populate_methods(item, c_name, methods)