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

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

     1  from PyQt4 import QtGui, QtCore
     2
     3  from customeditor import AbstractCustomEditor
     4
     5 -class NoteEditor(QtGui.QLabel, AbstractCustomEditor):
     6      """An editor that behaves like a note, the editor hides itself when
     7      there is no text to display"""
     8
     9 -    def __init__(self, parent=None, **kwargs):
    10          QtGui.QLabel.__init__(self, parent)
    11          AbstractCustomEditor.__init__(self)
    12          self.setTextFormat(QtCore.Qt.RichText)
    13          from camelot.view.art import ColorScheme
    14          style = """
    15          QLabel {
    16            margin: 0px;
    17            padding: 3px;
    18            border: 1px solid black;
    19            color: black;
    20            background-color: %s;
    21          }
    22          """%(ColorScheme.yellow_1.name())
    23          self.setStyleSheet( style );
    24
    25 -    def set_value(self, value):
    26          value = super(NoteEditor, self).set_value(value)
    27          self.setVisible(value!=None)
    28          if value:
    29              self.setText(unicode(value))
    30