Skip to content

text_editor

Full documentation pages are generated for docstring reference only and may contain symbols imported from other modules. Imported symbols are not distinguished from locally defined symbols and will appear in any module that they are imported into. For better information on where symbols should be imported from, review the sourcecode on the github.

FoSpy.ui.app.editors.text_editor

BasePropEditor

Bases: BaseEditorWidget

Source code in FoSpy/ui/app/editors/_base.py
class BasePropEditor(BaseEditorWidget):
    def __init__(self, block_widget, line_edit, editor_widget, on_apply, prop_name):
        self.on_apply = on_apply
        self.line_edit = line_edit
        self.prop_name = prop_name

        super().__init__(block_widget, editor_widget)

line_edit instance-attribute

line_edit = line_edit

on_apply instance-attribute

on_apply = on_apply

prop_name instance-attribute

prop_name = prop_name

__init__

__init__(
    block_widget,
    line_edit,
    editor_widget,
    on_apply,
    prop_name,
)
Source code in FoSpy/ui/app/editors/_base.py
def __init__(self, block_widget, line_edit, editor_widget, on_apply, prop_name):
    self.on_apply = on_apply
    self.line_edit = line_edit
    self.prop_name = prop_name

    super().__init__(block_widget, editor_widget)

TextEditorWidget

Bases: BasePropEditor

Source code in FoSpy/ui/app/editors/text_editor.py
class TextEditorWidget(BasePropEditor):
    def __init__(self, block_widget, line_edit, on_apply, prop_name):
        super().__init__(block_widget, line_edit, QPlainTextEdit(), on_apply, prop_name)

    def refresh_editor(self):
        self.editor.setPlainText(self.line_edit.text())
        self.line_edit.setCursorPosition(0)

    def apply(self):
        self.line_edit.setText(self.editor.toPlainText())
        super().apply()

    def is_changed(self):
        return self.editor.toPlainText() != self.line_edit.text()

__init__

__init__(block_widget, line_edit, on_apply, prop_name)
Source code in FoSpy/ui/app/editors/text_editor.py
def __init__(self, block_widget, line_edit, on_apply, prop_name):
    super().__init__(block_widget, line_edit, QPlainTextEdit(), on_apply, prop_name)

apply

apply()
Source code in FoSpy/ui/app/editors/text_editor.py
def apply(self):
    self.line_edit.setText(self.editor.toPlainText())
    super().apply()

is_changed

is_changed()
Source code in FoSpy/ui/app/editors/text_editor.py
def is_changed(self):
    return self.editor.toPlainText() != self.line_edit.text()

refresh_editor

refresh_editor()
Source code in FoSpy/ui/app/editors/text_editor.py
def refresh_editor(self):
    self.editor.setPlainText(self.line_edit.text())
    self.line_edit.setCursorPosition(0)