本文整理汇总了Python中spyderlib.plugins.SpyderPluginWidget.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python SpyderPluginWidget.__init__方法的具体用法?Python SpyderPluginWidget.__init__怎么用?Python SpyderPluginWidget.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.plugins.SpyderPluginWidget
的用法示例。
在下文中一共展示了SpyderPluginWidget.__init__方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from spyderlib.plugins import SpyderPluginWidget [as 别名]
# 或者: from spyderlib.plugins.SpyderPluginWidget import __init__ [as 别名]
def __init__(self, parent):
self.tabwidget = None
self.menu_actions = None
self.dockviewer = None
self.editors = []
self.filenames = []
self.icons = []
SpyderPluginWidget.__init__(self, parent)
layout = QVBoxLayout()
self.tabwidget = Tabs(self, self.menu_actions)
self.connect(self.tabwidget, SIGNAL('currentChanged(int)'),
self.refresh_plugin)
self.connect(self.tabwidget, SIGNAL('move_data(int,int)'),
self.move_tab)
layout.addWidget(self.tabwidget)
# Menu as corner widget
options_button = create_toolbutton(self, text=self.tr("Options"),
icon=get_icon('tooloptions.png'))
options_button.setPopupMode(QToolButton.InstantPopup)
menu = QMenu(self)
add_actions(menu, self.menu_actions)
options_button.setMenu(menu)
self.tabwidget.setCornerWidget(options_button)
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.hide()
layout.addWidget(self.find_widget)
self.setLayout(layout)
示例2: __init__
# 需要导入模块: from spyderlib.plugins import SpyderPluginWidget [as 别名]
# 或者: from spyderlib.plugins.SpyderPluginWidget import __init__ [as 别名]
def __init__(self, parent):
self.tabwidget = None
self.menu_actions = None
self.dockviewer = None
self.wrap_action = None
self.editors = []
self.filenames = []
self.icons = []
if PYQT5:
SpyderPluginWidget.__init__(self, parent, main = parent)
else:
SpyderPluginWidget.__init__(self, parent)
# Initialize plugin
self.initialize_plugin()
self.set_default_color_scheme()
layout = QVBoxLayout()
self.tabwidget = Tabs(self, self.menu_actions)
self.tabwidget.currentChanged.connect(self.refresh_plugin)
self.tabwidget.move_data.connect(self.move_tab)
if sys.platform == 'darwin':
tab_container = QWidget()
tab_container.setObjectName('tab-container')
tab_layout = QHBoxLayout(tab_container)
tab_layout.setContentsMargins(0, 0, 0, 0)
tab_layout.addWidget(self.tabwidget)
layout.addWidget(tab_container)
else:
layout.addWidget(self.tabwidget)
self.tabwidget.setStyleSheet("QTabWidget::pane {border: 0;}")
# Menu as corner widget
options_button = create_toolbutton(self, text=_('Options'),
icon=ima.icon('tooloptions'))
options_button.setPopupMode(QToolButton.InstantPopup)
menu = QMenu(self)
add_actions(menu, self.menu_actions)
options_button.setMenu(menu)
self.tabwidget.setCornerWidget(options_button)
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.hide()
self.register_widget_shortcuts("Editor", self.find_widget)
layout.addWidget(self.find_widget)
self.setLayout(layout)
示例3: __init__
# 需要导入模块: from spyderlib.plugins import SpyderPluginWidget [as 别名]
# 或者: from spyderlib.plugins.SpyderPluginWidget import __init__ [as 别名]
def __init__(
self, parent=None, namespace=None, commands=[], message=None, exitfunc=None, profile=False, multithreaded=False
):
if PYQT5:
SpyderPluginWidget.__init__(self, parent, main=parent)
else:
SpyderPluginWidget.__init__(self, parent)
debug_print(" ..internal console: initializing")
self.dialog_manager = DialogManager()
# Shell
light_background = self.get_option("light_background")
self.shell = InternalShell(
parent,
namespace,
commands,
message,
self.get_option("max_line_count"),
self.get_plugin_font(),
exitfunc,
profile,
multithreaded,
light_background=light_background,
)
self.shell.status.connect(lambda msg: self.show_message.emit(msg, 0))
self.shell.go_to_error.connect(self.go_to_error)
self.shell.focus_changed.connect(lambda: self.focus_changed.emit())
# Redirecting some signals:
self.shell.redirect_stdio.connect(lambda state: self.redirect_stdio.emit(state))
# Initialize plugin
self.initialize_plugin()
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.shell)
self.find_widget.hide()
self.register_widget_shortcuts("Editor", self.find_widget)
# Main layout
layout = QVBoxLayout()
layout.addWidget(self.shell)
layout.addWidget(self.find_widget)
self.setLayout(layout)
# Parameters
self.shell.toggle_wrap_mode(self.get_option("wrap"))
# Accepting drops
self.setAcceptDrops(True)
示例4: __init__
# 需要导入模块: from spyderlib.plugins import SpyderPluginWidget [as 别名]
# 或者: from spyderlib.plugins.SpyderPluginWidget import __init__ [as 别名]
def __init__(self, parent=None, namespace=None, commands=[], message=None,
exitfunc=None, profile=False, multithreaded=False):
SpyderPluginWidget.__init__(self, parent)
debug_print(" ..internal console: initializing")
self.dialog_manager = DialogManager()
# Shell
light_background = self.get_option('light_background')
self.shell = InternalShell(parent, namespace, commands, message,
self.get_option('max_line_count'),
self.get_plugin_font(), exitfunc, profile,
multithreaded,
light_background=light_background)
self.connect(self.shell, SIGNAL('status(QString)'),
lambda msg:
self.emit(SIGNAL('show_message(QString,int)'), msg, 0))
self.connect(self.shell, SIGNAL("go_to_error(QString)"),
self.go_to_error)
self.connect(self.shell, SIGNAL("focus_changed()"),
lambda: self.emit(SIGNAL("focus_changed()")))
# Redirecting some SIGNALs:
self.connect(self.shell, SIGNAL('redirect_stdio(bool)'),
lambda state: self.emit(SIGNAL('redirect_stdio(bool)'),
state))
# Initialize plugin
self.initialize_plugin()
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.shell)
self.find_widget.hide()
self.register_widget_shortcuts("Editor", self.find_widget)
# Main layout
layout = QVBoxLayout()
layout.addWidget(self.shell)
layout.addWidget(self.find_widget)
self.setLayout(layout)
# Parameters
self.shell.toggle_wrap_mode(self.get_option('wrap'))
# Accepting drops
self.setAcceptDrops(True)
示例5: __init__
# 需要导入模块: from spyderlib.plugins import SpyderPluginWidget [as 别名]
# 或者: from spyderlib.plugins.SpyderPluginWidget import __init__ [as 别名]
def __init__(self, parent):
SpyderPluginWidget.__init__(self, parent)
self.tabwidget = None
self.menu_actions = None
self.extconsole = None # External console plugin
self.inspector = None # Object inspector plugin
self.historylog = None # History log plugin
self.variableexplorer = None # Variable explorer plugin
self.clients = []
# Initialize plugin
self.initialize_plugin()
layout = QVBoxLayout()
self.tabwidget = Tabs(self, self.menu_actions)
if hasattr(self.tabwidget, 'setDocumentMode')\
and not sys.platform == 'darwin':
# Don't set document mode to true on OSX because it generates
# a crash when the console is detached from the main window
# Fixes Issue 561
self.tabwidget.setDocumentMode(True)
self.connect(self.tabwidget, SIGNAL('currentChanged(int)'),
self.refresh_plugin)
self.connect(self.tabwidget, SIGNAL('move_data(int,int)'),
self.move_tab)
self.tabwidget.set_close_function(self.close_client)
layout.addWidget(self.tabwidget)
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.hide()
self.register_widget_shortcuts("Editor", self.find_widget)
layout.addWidget(self.find_widget)
self.setLayout(layout)
# Accepting drops
self.setAcceptDrops(True)
示例6: __init__
# 需要导入模块: from spyderlib.plugins import SpyderPluginWidget [as 别名]
# 或者: from spyderlib.plugins.SpyderPluginWidget import __init__ [as 别名]
def __init__(self, parent, light_mode):
self.light_mode = light_mode
self.commands = []
self.tabwidget = None
self.menu_actions = None
self.inspector = None
self.historylog = None
self.variableexplorer = None # variable explorer plugin
self.ipython_count = 0
self.python_count = 0
self.terminal_count = 0
if CONF.get(self.ID, 'ipython_options', None) is None:
CONF.set(self.ID, 'ipython_options',
self.get_default_ipython_options())
self.shells = []
self.filenames = []
self.icons = []
SpyderPluginWidget.__init__(self, parent)
layout = QVBoxLayout()
self.tabwidget = Tabs(self, self.menu_actions)
self.connect(self.tabwidget, SIGNAL('currentChanged(int)'),
self.refresh_plugin)
self.connect(self.tabwidget, SIGNAL('move_data(int,int)'),
self.move_tab)
self.tabwidget.set_close_function(self.close_console)
layout.addWidget(self.tabwidget)
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.hide()
layout.addWidget(self.find_widget)
self.setLayout(layout)
# Accepting drops
self.setAcceptDrops(True)
示例7: __init__
# 需要导入模块: from spyderlib.plugins import SpyderPluginWidget [as 别名]
# 或者: from spyderlib.plugins.SpyderPluginWidget import __init__ [as 别名]
def __init__(self, parent):
self.tabwidget = None
self.menu_actions = None
self.dockviewer = None
self.wrap_action = None
self.editors = []
self.filenames = []
self.icons = []
if PYQT5:
SpyderPluginWidget.__init__(self, parent, main = parent)
else:
SpyderPluginWidget.__init__(self, parent)
# Initialize plugin
self.initialize_plugin()
self.set_default_color_scheme()
layout = QVBoxLayout()
self.tabwidget = Tabs(self, self.menu_actions)
self.tabwidget.currentChanged.connect(self.refresh_plugin)
self.tabwidget.move_data.connect(self.move_tab)
layout.addWidget(self.tabwidget)
# Menu as corner widget
options_button = create_toolbutton(self, text=_('Options'),
icon=ima.icon('tooloptions'))
options_button.setPopupMode(QToolButton.InstantPopup)
menu = QMenu(self)
add_actions(menu, self.menu_actions)
options_button.setMenu(menu)
self.tabwidget.setCornerWidget(options_button)
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.hide()
self.register_widget_shortcuts("Editor", self.find_widget)
layout.addWidget(self.find_widget)
self.setLayout(layout)
示例8: __init__
# 需要导入模块: from spyderlib.plugins import SpyderPluginWidget [as 别名]
# 或者: from spyderlib.plugins.SpyderPluginWidget import __init__ [as 别名]
def __init__(self, parent=None, namespace=None, commands=[], message="",
debug=False, exitfunc=None, profile=False, multithreaded=True):
# Shell
self.shell = InternalShell(parent, namespace, commands, message,
CONF.get(self.ID, 'max_line_count'),
get_font(self.ID),
debug, exitfunc, profile, multithreaded)
self.connect(self.shell, SIGNAL('status(QString)'),
lambda msg:
self.emit(SIGNAL('show_message(QString,int)'), msg, 0))
self.connect(self.shell, SIGNAL("go_to_error(QString)"),
self.go_to_error)
self.connect(self.shell, SIGNAL("focus_changed()"),
lambda: self.emit(SIGNAL("focus_changed()")))
# Redirecting some SIGNALs:
self.connect(self.shell, SIGNAL('redirect_stdio(bool)'),
lambda state: self.emit(SIGNAL('redirect_stdio(bool)'),
state))
SpyderPluginWidget.__init__(self, parent)
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.shell)
self.find_widget.hide()
# Main layout
layout = QVBoxLayout()
layout.addWidget(self.shell)
layout.addWidget(self.find_widget)
self.setLayout(layout)
# Parameters
self.shell.toggle_wrap_mode( CONF.get(self.ID, 'wrap') )
# Accepting drops
self.setAcceptDrops(True)
示例9: __init__
# 需要导入模块: from spyderlib.plugins import SpyderPluginWidget [as 别名]
# 或者: from spyderlib.plugins.SpyderPluginWidget import __init__ [as 别名]
def __init__(self, parent):
if PYQT5:
SpyderPluginWidget.__init__(self, parent, main = parent)
else:
SpyderPluginWidget.__init__(self, parent)
self.internal_shell = None
# Initialize plugin
self.initialize_plugin()
self.no_doc_string = _("No further documentation available")
self._last_console_cb = None
self._last_editor_cb = None
self.set_default_color_scheme()
self.plain_text = PlainText(self)
self.rich_text = RichText(self)
color_scheme = get_color_scheme(self.get_option('color_scheme_name'))
self.set_plain_text_font(self.get_plugin_font(), color_scheme)
self.plain_text.editor.toggle_wrap_mode(self.get_option('wrap'))
# Add entries to read-only editor context-menu
font_action = create_action(self, _("&Font..."), None,
ima.icon('font'), _("Set font style"),
triggered=self.change_font)
self.wrap_action = create_action(self, _("Wrap lines"),
toggled=self.toggle_wrap_mode)
self.wrap_action.setChecked(self.get_option('wrap'))
self.plain_text.editor.readonly_menu.addSeparator()
add_actions(self.plain_text.editor.readonly_menu,
(font_action, self.wrap_action))
self.set_rich_text_font(self.get_plugin_font('rich_text'))
self.shell = None
self.external_console = None
# locked = disable link with Console
self.locked = False
self._last_texts = [None, None]
self._last_editor_doc = None
# Object name
layout_edit = QHBoxLayout()
layout_edit.setContentsMargins(0, 0, 0, 0)
txt = _("Source")
if sys.platform == 'darwin':
source_label = QLabel(" " + txt)
else:
source_label = QLabel(txt)
layout_edit.addWidget(source_label)
self.source_combo = QComboBox(self)
self.source_combo.addItems([_("Console"), _("Editor")])
self.source_combo.currentIndexChanged.connect(self.source_changed)
if (not programs.is_module_installed('rope') and
not programs.is_module_installed('jedi', '>=0.8.1')):
self.source_combo.hide()
source_label.hide()
layout_edit.addWidget(self.source_combo)
layout_edit.addSpacing(10)
layout_edit.addWidget(QLabel(_("Object")))
self.combo = ObjectComboBox(self)
layout_edit.addWidget(self.combo)
self.object_edit = QLineEdit(self)
self.object_edit.setReadOnly(True)
layout_edit.addWidget(self.object_edit)
self.combo.setMaxCount(self.get_option('max_history_entries'))
self.combo.addItems( self.load_history() )
self.combo.setItemText(0, '')
self.combo.valid.connect(lambda valid: self.force_refresh())
# Plain text docstring option
self.docstring = True
self.rich_help = sphinxify is not None \
and self.get_option('rich_mode', True)
self.plain_text_action = create_action(self, _("Plain Text"),
toggled=self.toggle_plain_text)
# Source code option
self.show_source_action = create_action(self, _("Show Source"),
toggled=self.toggle_show_source)
# Rich text option
self.rich_text_action = create_action(self, _("Rich Text"),
toggled=self.toggle_rich_text)
# Add the help actions to an exclusive QActionGroup
help_actions = QActionGroup(self)
help_actions.setExclusive(True)
help_actions.addAction(self.plain_text_action)
help_actions.addAction(self.rich_text_action)
# Automatic import option
self.auto_import_action = create_action(self, _("Automatic import"),
toggled=self.toggle_auto_import)
#.........这里部分代码省略.........
示例10: __init__
# 需要导入模块: from spyderlib.plugins import SpyderPluginWidget [as 别名]
# 或者: from spyderlib.plugins.SpyderPluginWidget import __init__ [as 别名]
def __init__(self, parent):
SpyderPluginWidget.__init__(self, parent)
# Initialize plugin
self.initialize_plugin()
self.no_doc_string = _("No documentation available")
self._last_console_cb = None
self._last_editor_cb = None
self.set_default_color_scheme()
self.plain_text = PlainText(self)
self.rich_text = RichText(self)
color_scheme = get_color_scheme(self.get_option('color_scheme_name'))
self.set_plain_text_font(self.get_plugin_font(), color_scheme)
self.plain_text.editor.toggle_wrap_mode(self.get_option('wrap'))
# Add entries to read-only editor context-menu
font_action = create_action(self, _("&Font..."), None,
'font.png', _("Set font style"),
triggered=self.change_font)
self.wrap_action = create_action(self, _("Wrap lines"),
toggled=self.toggle_wrap_mode)
self.wrap_action.setChecked(self.get_option('wrap'))
self.plain_text.editor.readonly_menu.addSeparator()
add_actions(self.plain_text.editor.readonly_menu,
(font_action, self.wrap_action))
self.set_rich_text_font(self.get_plugin_font('rich_text'))
self.shell = None
self.external_console = None
# locked = disable link with Console
self.locked = False
self._last_texts = [None, None]
self._last_rope_data = None
# Object name
layout_edit = QHBoxLayout()
layout_edit.setContentsMargins(0, 0, 0, 0)
source_label = QLabel(_("Source"))
layout_edit.addWidget(source_label)
self.source_combo = QComboBox(self)
self.source_combo.addItems([_("Console"), _("Editor")])
self.connect(self.source_combo, SIGNAL('currentIndexChanged(int)'),
self.source_changed)
if not programs.is_module_installed('rope'):
self.source_combo.hide()
source_label.hide()
layout_edit.addWidget(self.source_combo)
layout_edit.addSpacing(10)
layout_edit.addWidget(QLabel(_("Object")))
self.combo = ObjectComboBox(self)
layout_edit.addWidget(self.combo)
self.object_edit = QLineEdit(self)
self.object_edit.setReadOnly(True)
layout_edit.addWidget(self.object_edit)
self.combo.setMaxCount(self.get_option('max_history_entries'))
self.combo.addItems( self.load_history() )
self.connect(self.combo, SIGNAL("valid(bool)"),
lambda valid: self.force_refresh())
# Plain text docstring option
self.docstring = True
self.rich_help = sphinxify is not None \
and self.get_option('rich_mode', True)
self.plain_text_action = create_action(self, _("Plain Text"),
toggled=self.toggle_plain_text)
# Source code option
self.show_source_action = create_action(self, _("Show Source"),
toggled=self.toggle_show_source)
# Rich text option
self.rich_text_action = create_action(self, _("Rich Text"),
toggled=self.toggle_rich_text)
# Add the help actions to an exclusive QActionGroup
help_actions = QActionGroup(self)
help_actions.setExclusive(True)
help_actions.addAction(self.plain_text_action)
help_actions.addAction(self.rich_text_action)
# Automatic import option
self.auto_import_action = create_action(self, _("Automatic import"),
toggled=self.toggle_auto_import)
auto_import_state = self.get_option('automatic_import')
self.auto_import_action.setChecked(auto_import_state)
# Lock checkbox
self.locked_button = create_toolbutton(self,
triggered=self.toggle_locked)
layout_edit.addWidget(self.locked_button)
self._update_lock_icon()
#.........这里部分代码省略.........