Package Camelot :: Package camelot :: Package view :: Package controls :: Package delegates |
[frames] | no frames]

# Source Code for Package Camelot.camelot.view.controls.delegates

     1

     2

     3  from delegatemanager import DelegateManager
     4  from booldelegate import BoolDelegate, TextBoolDelegate
     5  from codedelegate import CodeDelegate
     6  from colordelegate import ColorDelegate
     7  from coloredfloatdelegate import ColoredFloatDelegate
     8  from comboboxdelegate import ComboBoxDelegate
     9  from currencydelegate import CurrencyDelegate
    10  from customdelegate import CustomDelegate
    11  from datedelegate import DateDelegate
    12  from datetimedelegate import DateTimeDelegate
    13  from enumerationdelegate import EnumerationDelegate
    14  from filedelegate import FileDelegate
    15  from floatdelegate import FloatDelegate
    16  from imagedelegate import ImageDelegate
    17  from integerdelegate import IntegerDelegate
    18  from intervalsdelegate import IntervalsDelegate
    19  from manytomanydelegate import ManyToManyDelegate
    20  from many2onedelegate import Many2OneDelegate
    21  from one2manydelegate import One2ManyDelegate
    22  from manytoonechoicesdelegate import ManyToOneChoicesDelegate
    23  from plaintextdelegate import PlainTextDelegate
    24  from richtextdelegate import RichTextDelegate
    25  from stardelegate import StarDelegate
    26  from texteditdelegate import TextEditDelegate
    27  from timedelegate import TimeDelegate
    28  from virtualaddressdelegate import VirtualAddressDelegate
    29  from smileydelegate import SmileyDelegate
    30  from notedelegate import NoteDelegate
    31  from labeldelegate import LabelDelegate
    32

    33  doc = """Camelot includes a number of Qt delegates, most of them are used as default

    34  delegates for the various sqlalchemy and camelot field types.

    35

    36  Some delegates take specific arguments into account for their construction.

    37  All :attr:`field_attributes` specified for a certain field will be propagated

    38  towards the constructor of the delegate.  Some of them will be used by the delegate

    39  itself, others will be used by the editor, created by the delegate.

    40

    41  """
    42

    43  custom_delegates = list()
    44

    45 -def _add_subclasses(delegate):
    46      global custom_delegates
    47      subclasses = list(delegate.__subclasses__())
    48      for subclass in subclasses:
    49          _add_subclasses(subclass)
    50      custom_delegates += subclasses
    51

    52  _add_subclasses(CustomDelegate)
    53

    54  custom_delegates.sort(key=lambda d:d.__name__)
    55  for custom_delegate in custom_delegates:
    56      doc = doc + custom_delegate.__name__ + '\n' + '-'*len(custom_delegate.__name__) + '\n'
    57      if hasattr(custom_delegate, '__doc__') and custom_delegate.__doc__:
    58          doc = doc + custom_delegate.__doc__ + '\n'
    59

    60  __doc__ = doc
    61