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

# Source Code for Module Camelot.camelot.view.controls.delegates.manytomanydelegate

     1  from PyQt4 import QtCore
     2

     3  from camelot.view.controls import editors
     4  from one2manydelegate import One2ManyDelegate
     5

     6 -class ManyToManyDelegate(One2ManyDelegate):
     7      """

     8    .. image:: ../_static/manytomany.png

     9    """
    10

    11 -    def createEditor(self, parent, option, index):
    12          editor = editors.ManyToManyEditor(parent=parent, **self.kwargs)
    13          self.setEditorData(editor, index)
    14          self.connect(editor,

    15                       editors.editingFinished,

    16                       self.commitAndCloseEditor)
    17          return editor
    18

    19 -    def commitAndCloseEditor(self):
    20          editor = self.sender()
    21          self.emit(QtCore.SIGNAL('commitData(QWidget*)'), editor)
    22

    23 -    def setModelData(self, editor, model, index):
    24          if editor.getModel():
    25              model.setData(index, editor.getModel().collection_getter)
    26