Package schrodinger :: Module antibody_db_manage_gui :: Class EditableDelegate
[hide private]
[frames] | no frames]

Class EditableDelegate

           object --+                            
                    |                            
    sip.simplewrapper --+                        
                        |                        
              sip.wrapper --+                    
                            |                    
         PyQt4.QtCore.QObject --+                
                                |                
PyQt4.QtGui.QAbstractItemDelegate --+            
                                    |            
            PyQt4.QtGui.QItemDelegate --+        
                                        |        
        ui.qt.table.GenericViewerDelegate --+    
                                            |    
      ui.qt.table.StructureDataViewerDelegate --+
                                                |
                                               EditableDelegate

The table delegate, modified to shade the background of read-only cells, align data types accordingly and store data in the model when the user edits a cell.

Nested Classes [hide private]

Inherited from PyQt4.QtGui.QAbstractItemDelegate: EndEditHint

Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
Intialize the StructreDataViewerDelegate
 
paint(self, painter, option, index)
This handles the logic behind painting/not-painting when the scrollbar is being dragged.
 
createEditor(self, *args)
Modified from the parent to fill the editor background so the cell contents don't show through.
 
setModelData(self, editor, model, index)
Sets the data in the model once the user is done editing a cell
 
drawDataIntoRect(self, painter, data, rect, selected_brush=False)
Draws string data onto a cell

Inherited from ui.qt.table.StructureDataViewerDelegate: clearCache, generatePicture, isStructure, paintCell, paintStructure, sizeHint

Inherited from ui.qt.table.StructureDataViewerDelegate (private): _paint, _paint_passive

Inherited from ui.qt.table.GenericViewerDelegate: paintWait, setPaintWait

Inherited from PyQt4.QtGui.QItemDelegate: drawBackground, drawCheck, drawDecoration, drawDisplay, drawFocus, editorEvent, eventFilter, hasClipping, itemEditorFactory, setClipping, setEditorData, setItemEditorFactory, updateEditorGeometry

Inherited from PyQt4.QtGui.QAbstractItemDelegate: closeEditor, commitData, elidedText, helpEvent, sizeHintChanged

Inherited from PyQt4.QtCore.QObject: __getattr__, blockSignals, childEvent, children, connect, connectNotify, customEvent, deleteLater, destroyed, disconnect, disconnectNotify, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, emit, event, findChild, findChildren, inherits, installEventFilter, isWidgetType, killTimer, metaObject, moveToThread, objectName, parent, property, pyqtConfigure, receivers, removeEventFilter, sender, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent, tr, trUtf8

Inherited from sip.simplewrapper: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from PyQt4.QtGui.QAbstractItemDelegate: EditNextItem, EditPreviousItem, NoHint, RevertModelCache, SubmitModelCache

Inherited from PyQt4.QtCore.QObject: staticMetaObject

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

 

Intialize the StructreDataViewerDelegate

Parameters:
  • tableview - Table this delegate paints to
  • tablemodel - DEPRECATED Model containing the data this delegate paints This parameter should not be used, because a delegate should only get information from a QModelIndex, not a model directly
  • structure_class - class (or superclass) of the objects that should be displayed in the table as 2D pictures - usually schrodinger.structure.Structure (the default)
  • max_scale - restricts the maximum scale-up of 2D structure images so that very small molecules don't look so large.
  • elide - Determines where '...' should occur in strings that are too large to fit in the table cell. Common values are Qt.ElideLeft, Qt.ElideRight, Qt.ElideMiddle, Qt.ElideNone
  • alignment - The alignment of text in the cells.

    To put a structure in a cell, store a structure_class object in that cell of the model. To put any other type of data in a cell, store that data in that cell of the model.

Overrides: object.__init__
(inherited documentation)

paint(self, painter, option, index)

 

This handles the logic behind painting/not-painting when the scrollbar is being dragged.

Parameters:
  • painter (QPainter) - The painter that does the painting
  • index (QModelIndex) - A proxymodel index pointing to a cell.
Overrides: PyQt4.QtGui.QAbstractItemDelegate.paint

createEditor(self, *args)

 

Modified from the parent to fill the editor background so the cell contents don't show through.

Overrides: PyQt4.QtGui.QAbstractItemDelegate.createEditor

setModelData(self, editor, model, index)

 

Sets the data in the model once the user is done editing a cell

Parameters:
  • editor (QWidget) - The widget the user used to edit the cell
  • model (QSortFilterProxyModel) - The model currently used by the view
  • index (QModelIndex) - The index of the cell edited
Overrides: PyQt4.QtGui.QAbstractItemDelegate.setModelData

drawDataIntoRect(self, painter, data, rect, selected_brush=False)

 

Draws string data onto a cell

Parameters:
  • painter (QtGui.QtPainter) - The painter that is drawing the table
  • data (string, int, or float) - the information to be drawn on the table
  • rect (QtCore.Qrect) - The rectangle that defines the current cell of the table
Overrides: ui.qt.table.StructureDataViewerDelegate.drawDataIntoRect