Package Camelot :: Package camelot :: Package view :: Package controls :: Package editors :: Module textediteditor |
[frames] | no frames]

# Source Code for Module Camelot.camelot.view.controls.editors.textediteditor

     1  from wideeditor import WideEditor
     2  from customeditor import AbstractCustomEditor, QtGui
     3

     4 -class TextEditEditor(QtGui.QTextEdit, AbstractCustomEditor, WideEditor):
     5

     6 -    def __init__(self, parent, length=20, editable=True, **kwargs):
     7          QtGui.QTextEdit.__init__(self, parent)
     8          AbstractCustomEditor.__init__(self)
     9          self.setReadOnly(not editable)
    10

    11 -    def set_value(self, value):
    12          value = AbstractCustomEditor.set_value(self, value)
    13          if value:
    14              self.setText(unicode(value))
    15          else:
    16              self.setText('')
    17          return value
    18

    19 -    def get_value(self):
    20          return AbstractCustomEditor.get_value(self) or unicode(self.toPlainText())
    21

    22

    23 -    def set_enabled(self, editable=True):
    24          self.setEnabled(editable)
    25