本文整理汇总了Python中spyderlib.widgets.findreplace.FindReplace类的典型用法代码示例。如果您正苦于以下问题:Python FindReplace类的具体用法?Python FindReplace怎么用?Python FindReplace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FindReplace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RichText
class RichText(QWidget):
"""
WebView widget with find dialog
"""
def __init__(self, parent):
QWidget.__init__(self, parent)
self.webview = FrameWebView(self)
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.webview)
self.find_widget.hide()
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.webview)
layout.addWidget(self.find_widget)
self.setLayout(layout)
def set_font(self, font, fixed_font=None):
"""Set font"""
self.webview.set_font(font, fixed_font=fixed_font)
def set_html(self, html_text, base_url):
"""Set html text"""
self.webview.setHtml(html_text, base_url)
def clear(self):
self.set_html('', self.webview.url())
示例2: PlainText
class PlainText(QWidget):
"""
Read-only editor widget with find dialog
"""
# Signals
focus_changed = Signal()
def __init__(self, parent):
QWidget.__init__(self, parent)
self.editor = None
# Read-only editor
self.editor = codeeditor.CodeEditor(self)
self.editor.setup_editor(linenumbers=False, language='py',
scrollflagarea=False, edge_line=False)
self.editor.focus_changed.connect(lambda: self.focus_changed.emit())
self.editor.setReadOnly(True)
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.editor)
self.find_widget.hide()
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.editor)
layout.addWidget(self.find_widget)
self.setLayout(layout)
def set_font(self, font, color_scheme=None):
"""Set font"""
self.editor.set_font(font, color_scheme=color_scheme)
def set_color_scheme(self, color_scheme):
"""Set color scheme"""
self.editor.set_color_scheme(color_scheme)
def set_text(self, text, is_code):
self.editor.set_highlight_current_line(is_code)
self.editor.set_occurrence_highlighting(is_code)
if is_code:
self.editor.set_language('py')
else:
self.editor.set_language(None)
self.editor.set_text(text)
self.editor.set_cursor_position('sof')
def clear(self):
self.editor.clear()
示例3: __init__
def __init__(self, parent):
PluginWidget.__init__(self, parent)
# Read-only editor
self.editor = QsciEditor(self)
self.editor.setup_editor(linenumbers=False, language='py',
code_folding=True)
self.connect(self.editor, SIGNAL("focus_changed()"),
lambda: self.emit(SIGNAL("focus_changed()")))
self.editor.setReadOnly(True)
self.editor.set_font( get_font(self.ID) )
self.editor.toggle_wrap_mode( CONF.get(self.ID, 'wrap') )
# Add entries to read-only editor context-menu
font_action = create_action(self, translate("Editor", "&Font..."), None,
'font.png',
translate("Editor", "Set font style"),
triggered=self.change_font)
wrap_action = create_action(self, translate("Editor", "Wrap lines"),
toggled=self.toggle_wrap_mode)
wrap_action.setChecked( CONF.get(self.ID, 'wrap') )
self.editor.readonly_menu.addSeparator()
add_actions(self.editor.readonly_menu, (font_action, wrap_action))
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.editor)
self.find_widget.hide()
示例4: __init__
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)
示例5: __init__
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)
示例6: __init__
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)
示例7: __init__
def __init__(self, parent):
QWidget.__init__(self, parent)
self.webview = FrameWebView(self)
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.webview)
self.find_widget.hide()
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.webview)
layout.addWidget(self.find_widget)
self.setLayout(layout)
示例8: __init__
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)
示例9: setupUi
def setupUi(self):
self.tabs = QTabWidget()
self.tabs.setTabsClosable(True)
self.tabs.tabCloseRequested.connect(self.close_file)
self.tabs.currentChanged.connect(self._current_editor_changed)
self.tabs.setMovable(True)
self.tabs.setDocumentMode(True)
self.find_widget = FindReplace(self, enable_replace=True)
self.find_widget.hide()
self.content_widget = QWidget()
layout = QGridLayout(self.content_widget)
layout.addWidget(self.tabs)
layout.addWidget(self.find_widget)
self.setWidget(self.content_widget)
self.setAcceptDrops(True)
示例10: __init__
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)
示例11: __init__
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)
示例12: __init__
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)
示例13: __init__
def __init__(self, parent):
QWidget.__init__(self, parent)
self.editor = None
# Read-only editor
self.editor = codeeditor.CodeEditor(self)
self.editor.setup_editor(linenumbers=False, language="py", scrollflagarea=False, edge_line=False)
self.editor.focus_changed.connect(lambda: self.focus_changed.emit())
self.editor.setReadOnly(True)
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.editor)
self.find_widget.hide()
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.editor)
layout.addWidget(self.find_widget)
self.setLayout(layout)
示例14: __init__
def __init__(self, parent=None, namespace=None, commands=None, message="",
debug=False, exitfunc=None, profile=False):
# Shell
self.shell = InteractiveShell(parent, namespace, commands, message,
get_font(self.ID),
debug, exitfunc, profile)
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))
PluginWidget.__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') )
self.connect(self, SIGNAL("executing_command(bool)"),
self.change_cursor)
# Accepting drops
self.setAcceptDrops(True)
示例15: __init__
def __init__(self, parent, commands=None):
self.commands = commands
self.tabwidget = None
self.menu_actions = None
self.docviewer = None
self.historylog = None
self.shells = []
self.filenames = []
self.icons = []
PluginWidget.__init__(self, parent)
layout = QVBoxLayout()
self.tabwidget = Tabs(self, self.menu_actions)
self.connect(self.tabwidget, SIGNAL('currentChanged(int)'),
self.refresh)
self.connect(self.tabwidget, SIGNAL("close_tab(int)"),
self.tabwidget.removeTab)
self.connect(self.tabwidget, SIGNAL('move_data(int,int)'),
self.move_tab)
self.close_button = create_toolbutton(self.tabwidget,
icon=get_icon("fileclose.png"),
triggered=self.close_console,
tip=self.tr("Close current console"))
self.tabwidget.setCornerWidget(self.close_button)
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)