workspace — Open documents and manage it¶
Terminology:
Workspace - main working area, where documents are placed.
Document - opened file, widget on workspace. enki.core.document.Document
instance
-
class
enki.core.workspace.
Workspace
(mainWindow)¶ Bases:
QStackedWidget
Class manages set of opened documents, allows to open new file
instance is accessible as:
from enki.core.core import core core.workspace()
-
documentOpened
¶ documentOpened(
enki.core.document.Document
)Signal emitted, when document has been created, i.e. textual file opened, or some other document added to workspace
-
documentClosed
¶ documentClosed(
enki.core.document.Document
)Signal emitted, when document was closed
-
currentDocumentChanged
¶ currentDocumentChanged(
enki.core.document.Document
old,enki.core.document.Document
current)Signal emitted, when current document changed, i.e. user selected another document, new document opened, current closed
-
modificationChanged
¶ modificationChanged(document, modified)
Signal emitted, when modified state of a document had been changed (file edited, or saved) Bool parameter contains new value
Convenience signal, which retransmits original signal, sent by the document
-
cursorPositionChanged
¶ cursorPositionChanged(document)
Signal emitted, when cursor position has been changed
Convenience signal, which retransmits original signal, sent by the document
-
textChanged
¶ textChanged(document)
Signal emitted, when text has been chagned
Convenience signal, which retransmits original signal, sent by the document
-
languageChanged
¶ languageChanged(document, language)
Signal emitted, when highlighting (programming) language of a file has been changed
Convenience signal, which retransmits original signal, sent by `Qutepart<qutepart.rtfd.org>`_
-
indentWidthChanged
¶ indentWidthChanged(document, width)
Signal emitted, when indentation with has been changed
Convenience signal, which retransmits original signal, sent by the document
-
indentUseTabsChanged
¶ indentUseTabsChanged(document, use)
Signal emitted, when indentation mode has been changed
Convenience signal, which retransmits original signal, sent by the document
-
eolChanged
¶ eolChanged(document, eol)
Signal emitted, when EOL mode has been changed
Convenience signal, which retransmits original signal, sent by the document
-
escPressed
¶ escPressed()
Signal emitted, when Esc pressed in the editor. Search widget closes themselves on this signal
-
del_
()¶ Terminate workspace. Called by the core to clear actions
-
eventFilter
(obj, event)¶
-
keyPressEvent
(event)¶
-
currentDocument
()¶ Returns currently active (focused) document. None, if no documents are opened
-
setCurrentDocument
(document)¶ Select active (focused and visible) document form list of opened documents
-
activateNextDocument
()¶ Activate next document in the list
-
activatePreviousDocument
()¶ Activate previous document in the list
-
focusCurrentDocument
()¶ Set focus (cursor) to current document.
Used if user has finished work with some dialog, and, probably, want’s to edit text
-
goTo
(filePath, absPos=None, line=None, column=None, selectionLength=None)¶ Open file, activate it, and go to specified position. Select text after position, if necessary.
selectionLength specifies, how much characters should be selected
-
openFile
(filePath)¶ Open file.
Return document, if opened, None otherwise
Open modal message box, if failed to open the file
-
openFiles
(filePaths)¶ Open files.
Open modal message box and stop opening files, if failed to open any file
-
findDocumentForPath
(filePath)¶ Try to find document for path. Fimilar to open(), but doesn’t open file, if it is not opened On Unix may return file, for which path is not equal, if soft or hards links are used Return None, if not found
-
createEmptyNotSavedDocument
(filePath=None)¶ Create empty not saved document. Used on startup, if no file was specified, and after File->New file has been triggered
-
documents
()¶ Get list of opened documents (
enki.core.document.Document
instances)
-
closeDocument
(document)¶ Close opened file, remove document from workspace and delete the widget.
Ask for confirmation with dialog, if modified.
-
askToCloseAll
()¶ If have unsaved documents, ask user to save it and close all. Will save documents, checked by user.
Returns True, if user hasn’t pressed Cancel Close
-
closeAllDocuments
()¶ Close all documents
If there are not saved documents, dialog will be shown.
Handler of File->Close->All
Returns True, if all files had been closed, and False, if save dialog rejected
If hideMainWindow is True, main window will be hidden, if user hadn’t pressed “Cancel Close”
-
forceCloseAllDocuments
()¶ Close all documents without asking user to save
-