本文整理汇总了Python中ninja_ide.gui.editor.editor.create_editor函数的典型用法代码示例。如果您正苦于以下问题:Python create_editor函数的具体用法?Python create_editor怎么用?Python create_editor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_editor函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_follow_mode
def show_follow_mode(self):
tempTab = self.actualTab
self.actualTab = self._tabMain
editorWidget = self.get_actual_editor()
if not editorWidget:
return
if self._tabSecondary.isVisible() and not self._followMode:
self.show_split(self.orientation())
if self._followMode:
self._followMode = False
self._tabSecondary.close_tab()
self._tabSecondary.hide()
self._tabSecondary.setTabsClosable(True)
self._tabMain._follow_mode = False
self._tabSecondary._follow_mode = False
else:
#check if is instance of Editor
self._followMode = True
self.setOrientation(Qt.Horizontal)
name = unicode(self._tabMain.tabText(self._tabMain.currentIndex()))
editor2 = editor.create_editor(fileName=name)
editor2.setPlainText(editorWidget.get_text())
editor2.setReadOnly(True)
self._tabSecondary.add_tab(editor2, name)
if editorWidget.textModified:
self._tabSecondary.tab_was_modified(True)
self._tabMain._follow_mode = True
self._tabSecondary._follow_mode = True
self._tabSecondary.show()
editor2.verticalScrollBar().setRange(
editorWidget._sidebarWidget.highest_line - 2, 0)
self._tabSecondary.setTabsClosable(False)
self.setSizes([1, 1])
self.actualTab = tempTab
self.emit(SIGNAL("enabledFollowMode(bool)"), self._followMode)
示例2: show_follow_mode
def show_follow_mode(self):
tempTab = self.actualTab
self.actualTab = self._tabMain
editorWidget = self.get_actual_editor()
if not editorWidget:
return
if self._tabSecondary.isVisible() and not self._followMode:
self.show_split(self.orientation())
if self._followMode:
self._exit_follow_mode()
else:
self._followMode = True
self.setOrientation(Qt.Horizontal)
name = self._tabMain.tabText(self._tabMain.currentIndex())
editor2 = editor.create_editor()
editor2.setDocument(editorWidget.document())
self._tabSecondary.add_tab(editor2, name)
if editorWidget.textModified:
self._tabSecondary.tab_was_modified(True)
self._tabSecondary.show()
editor2.verticalScrollBar().setRange(
editorWidget._sidebarWidget.highest_line - 2, 0)
self._tabSecondary.setTabsClosable(False)
self._tabSecondary.follow_mode = True
self.setSizes([1, 1])
self.emit(SIGNAL("enabledFollowMode(bool)"), self._followMode)
self.actualTab = tempTab
示例3: add_editor
def add_editor(self, fileName="", project=None, tabIndex=None, content=None, syntax=None):
editorWidget = editor.create_editor(fileName=fileName, project=project, syntax=syntax)
if not fileName:
tabName = "New Document"
else:
tabName = file_manager.get_basename(fileName)
# add the tab
inserted_index = self.add_tab(editorWidget, tabName, tabIndex=tabIndex)
self.actualTab.setTabToolTip(inserted_index, fileName)
self.connect(editorWidget, SIGNAL("modificationChanged(bool)"), self._editor_tab_was_modified)
self.connect(editorWidget, SIGNAL("fileSaved(QPlainTextEdit)"), self._editor_tab_was_saved)
self.connect(editorWidget, SIGNAL("openDropFile(QString)"), self.open_file)
self.connect(
editorWidget, SIGNAL("addBackItemNavigation()"), lambda: self.emit(SIGNAL("addBackItemNavigation()"))
)
self.connect(editorWidget, SIGNAL("locateFunction(QString, QString, bool)"), self._editor_locate_function)
self.connect(editorWidget, SIGNAL("warningsFound(QPlainTextEdit)"), self._show_warning_tab_indicator)
self.connect(editorWidget, SIGNAL("errorsFound(QPlainTextEdit)"), self._show_error_tab_indicator)
self.connect(editorWidget, SIGNAL("cleanDocument(QPlainTextEdit)"), self._hide_icon_tab_indicator)
self.connect(editorWidget, SIGNAL("findOcurrences(QString)"), self._find_occurrences)
# Cursor position changed
self.connect(editorWidget, SIGNAL("cursorPositionChange(int, int)"), self._cursor_position_changed)
# keyPressEventSignal for plugins
self.connect(editorWidget, SIGNAL("keyPressEvent(QEvent)"), self._editor_keyPressEvent)
# insert the content if present
if content:
editorWidget.setPlainText(content)
# emit a signal about the file open
self.emit(SIGNAL("fileOpened(QString)"), fileName)
return editorWidget
示例4: create_editor_from_editable
def create_editor_from_editable(self, editable):
editorWidget = editor.create_editor(editable)
#Connect signals
self.connect(editorWidget, SIGNAL("fileSaved(QPlainTextEdit)"),
self._editor_tab_was_saved)
self.connect(editorWidget, SIGNAL("openDropFile(QString)"),
self.open_file)
self.connect(editorWidget, SIGNAL("addBackItemNavigation()"),
self.add_back_item_navigation)
self.connect(editorWidget,
SIGNAL("locateFunction(QString, QString, bool)"),
self._editor_locate_function)
self.connect(editorWidget,
SIGNAL("checksFound(QPlainTextEdit, PyQt_PyObject)"),
self._show_tab_indicator)
self.connect(editorWidget, SIGNAL("cleanDocument(QPlainTextEdit)"),
self._hide_icon_tab_indicator)
self.connect(editorWidget, SIGNAL("findOcurrences(QString)"),
self._find_occurrences)
self.connect(editorWidget, SIGNAL("migrationAnalyzed()"),
lambda: self.emit(SIGNAL("migrationAnalyzed()")))
#keyPressEventSignal for plugins
self.connect(editorWidget, SIGNAL("keyPressEvent(QEvent)"),
self._editor_keyPressEvent)
return editorWidget
示例5: create_editor_from_editable
def create_editor_from_editable(self, editable):
neditor = editor.create_editor(editable)
# Connect signals
neditor.zoomChanged[int].connect(self._show_zoom_indicator)
neditor.destroyed.connect(self._editor_destroyed)
editable.fileSaved.connect(self._editor_tab_was_saved)
neditor.addBackItemNavigation.connect(self.add_back_item_navigation)
# self.connect(editable, SIGNAL("fileSaved(PyQt_PyObject)"),
# self._editor_tab_was_saved)
# editorWidget.font_changed.connect(self.show_zoom_indicator)
# self.connect(editorWidget, SIGNAL("openDropFile(QString)"),
# self.open_file)
# self.connect(editorWidget, SIGNAL("addBackItemNavigation()"),
# self.add_back_item_navigation)
# self.connect(editorWidget,
# SIGNAL("locateFunction(QString, QString, bool)"),
# self._editor_locate_function)
# self.connect(editorWidget, SIGNAL("findOcurrences(QString)"),
# self._find_occurrences)
# keyPressEventSignal for plugins
# self.connect(editorWidget, SIGNAL("keyPressEvent(QEvent)"),
# self._editor_keyPressEvent)
return neditor
示例6: create_editor_from_editable
def create_editor_from_editable(self, editable):
neditor = editor.create_editor(editable)
neditor.zoomChanged.connect(self._on_zoom_changed)
neditor.addBackItemNavigation.connect(self.add_back_item_navigation)
editable.fileSaved.connect(
lambda neditable: self._explore_file_code(neditable.file_path))
return neditor
示例7: create_editor_from_editable
def create_editor_from_editable(self, editable):
editorWidget = editor.create_editor(editable)
#Connect signals
editable.fileSaved.connect(self._editor_tab_was_saved)
editorWidget.openDropFile.connect(self.open_file)
editorWidget.addBackItemNavigation.connect(self.add_back_item_navigation)
editorWidget.locateFunction.connect(self._editor_locate_function)
editorWidget.findOcurrences.connect(self._find_occurrences)
#keyPressEventSignal for plugins
editorWidget.keyPressSignal.connect(self._editor_keyPressEvent)
return editorWidget
示例8: create_editor_from_editable
def create_editor_from_editable(self, editable):
editorWidget = editor.create_editor(editable)
# Connect signals
self.connect(editable, SIGNAL("fileSaved(PyQt_PyObject)"), self._editor_tab_was_saved)
self.connect(editorWidget, SIGNAL("openDropFile(QString)"), self.open_file)
self.connect(editorWidget, SIGNAL("addBackItemNavigation()"), self.add_back_item_navigation)
self.connect(editorWidget, SIGNAL("locateFunction(QString, QString, bool)"), self._editor_locate_function)
self.connect(editorWidget, SIGNAL("findOcurrences(QString)"), self._find_occurrences)
# keyPressEventSignal for plugins
self.connect(editorWidget, SIGNAL("keyPressEvent(QEvent)"), self._editor_keyPressEvent)
return editorWidget
示例9: __init__
def __init__(self):
super(ComboTabs, self).__init__()
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
self.bar = ActionBar()
vbox.addWidget(self.bar)
self.stacked = QStackedLayout()
self.editable = neditable.NEditable('')
self.editor_widget = editor.create_editor(self.editable)
self.stacked.addWidget(self.editor_widget)
vbox.addLayout(self.stacked)
示例10: add_editor
def add_editor(self, fileName="", tabIndex=None):
ninjaide = IDE.get_service('ide')
project = ninjaide.get_project_for_file(fileName)
editable = ninjaide.get_editable(fileName, project)
editorWidget = editor.create_editor(editable)
tab_name = editable.display_name
#add the tab
index = self.add_tab(editorWidget, tab_name, tabIndex=tabIndex)
self.tabs.setTabToolTip(index, QDir.toNativeSeparators(fileName))
#Connect signals
self.connect(editorWidget, SIGNAL("modificationChanged(bool)"),
self._editor_tab_was_modified)
self.connect(editorWidget, SIGNAL("fileSaved(QPlainTextEdit)"),
self._editor_tab_was_saved)
self.connect(editorWidget, SIGNAL("openDropFile(QString)"),
self.open_file)
self.connect(editorWidget, SIGNAL("addBackItemNavigation()"),
self.add_back_item_navigation)
self.connect(editorWidget,
SIGNAL("locateFunction(QString, QString, bool)"),
self._editor_locate_function)
self.connect(editorWidget,
SIGNAL("checksFound(QPlainTextEdit, PyQt_PyObject)"),
self._show_tab_indicator)
self.connect(editorWidget, SIGNAL("cleanDocument(QPlainTextEdit)"),
self._hide_icon_tab_indicator)
self.connect(editorWidget, SIGNAL("findOcurrences(QString)"),
self._find_occurrences)
self.connect(editorWidget, SIGNAL("migrationAnalyzed()"),
lambda: self.emit(SIGNAL("migrationAnalyzed()")))
#Cursor position changed
self.connect(editorWidget, SIGNAL("cursorPositionChange(int, int)"),
self._cursor_position_changed)
#keyPressEventSignal for plugins
self.connect(editorWidget, SIGNAL("keyPressEvent(QEvent)"),
self._editor_keyPressEvent)
#emit a signal about the file open
self.emit(SIGNAL("fileOpened(QString)"), fileName)
return editorWidget
示例11: add_editor
def add_editor(self, fileName=None, tabIndex=None, ignore_checkers=False):
ninjaide = IDE.get_service('ide')
editable = ninjaide.get_or_create_editable(fileName)
if editable.editor:
self.combo_area.set_current(editable)
return editable.editor
else:
editable.ignore_checkers = ignore_checkers
editorWidget = editor.create_editor(editable)
#add the tab
self.combo_area.add_editor(editable)
#index = self.add_tab(editorWidget, tab_name, tabIndex=tabIndex)
#self.tabs.setTabToolTip(index, QDir.toNativeSeparators(fileName))
#Connect signals
self.connect(editorWidget, SIGNAL("fileSaved(QPlainTextEdit)"),
self._editor_tab_was_saved)
self.connect(editorWidget, SIGNAL("openDropFile(QString)"),
self.open_file)
self.connect(editorWidget, SIGNAL("addBackItemNavigation()"),
self.add_back_item_navigation)
self.connect(editorWidget,
SIGNAL("locateFunction(QString, QString, bool)"),
self._editor_locate_function)
self.connect(editorWidget,
SIGNAL("checksFound(QPlainTextEdit, PyQt_PyObject)"),
self._show_tab_indicator)
self.connect(editorWidget, SIGNAL("cleanDocument(QPlainTextEdit)"),
self._hide_icon_tab_indicator)
self.connect(editorWidget, SIGNAL("findOcurrences(QString)"),
self._find_occurrences)
self.connect(editorWidget, SIGNAL("migrationAnalyzed()"),
lambda: self.emit(SIGNAL("migrationAnalyzed()")))
#keyPressEventSignal for plugins
self.connect(editorWidget, SIGNAL("keyPressEvent(QEvent)"),
self._editor_keyPressEvent)
#emit a signal about the file open
self.emit(SIGNAL("fileOpened(QString)"), fileName)
return editorWidget
示例12: add_editor
def add_editor(self, fileName="", project=None, tabIndex=None,
syntax=None, use_open_highlight=False):
print("add_editor_2.3", fileName)
project_obj = self._parent.explorer.get_project_given_filename(
fileName)
editorWidget = editor.create_editor(fileName=fileName, project=project,
syntax=syntax, use_open_highlight=use_open_highlight,
project_obj=project_obj)
if not fileName:
tabName = "New Document"
else:
tabName = file_manager.get_basename(fileName)
#add the tab
inserted_index = self.add_tab(editorWidget, tabName, tabIndex=tabIndex)
self.actualTab.setTabToolTip(inserted_index,
QDir.toNativeSeparators(fileName))
#Connect signals
editorWidget.modificationChanged[bool].connect(self._editor_tab_was_modified)
editorWidget.fileSaved['QPlainTextEdit*'].connect(self._editor_tab_was_saved)
editorWidget.openDropFile[str].connect(self.open_file)
editorWidget.addBackItemNavigation.connect(self.addBackItemNavigation.emit)
editorWidget.locateFunction[str, str, bool].connect(self._editor_locate_function)
editorWidget.warningsFound['QPlainTextEdit*'].connect(self._show_warning_tab_indicator)
editorWidget.errorsFound['QPlainTextEdit*'].connect(self._show_error_tab_indicator)
editorWidget.cleanDocument['QPlainTextEdit*'].connect(self._hide_icon_tab_indicator)
editorWidget.findOcurrences[str].connect(self._find_occurrences)
editorWidget.migrationAnalyzed.connect(self.migrationAnalyzed.emit)
#Cursor position changed
editorWidget.cursorPositionChange[int, int].connect(self._cursor_position_changed)
#keyPressEventSignal for plugins
editorWidget.keyPressSignal['QEvent*'].connect(self._editor_keyPressEvent)
#emit a signal about the file open
self.fileOpened.emit(fileName)
return editorWidget
示例13: editor_bot
def editor_bot(qtbot):
editable = Mock()
editable.document = QTextDocument()
_editor = editor.create_editor(editable)
return _editor