Package schrodinger :: Package application :: Package jaguar :: Package gui :: Module input_tab_widgets_pka :: Class AtomSelectionDelegate
[hide private]
[frames] | no frames]

Class AtomSelectionDelegate

     PyQt4.QtGui.QStyledItemDelegate --+    
                                       |    
input_tab_widgets.CommitMultipleDelegate --+
                                           |
      ui.qt.utils.DefaultMessageDelegate --+
                                           |
                                          AtomSelectionDelegate

A delegate for selecting a pKa atom. The atom name can either be typed into the line edit or selected from the workspace. A tool tip containing instructions will appear when the editor is first open and any time the user hovers their mouse over the editor. If the user clicks on an atom from the wrong structure, the atom will be ignored and a tool tip warning will appear. Clicking on an atom does not close the editor so that the user can immediately pick a different atom if desired.

Instance Methods [hide private]
 
__init__(self, parent)
 
createEditor(self, parent, option, index)
 
_ensureEntryIncluded(self, index)
Make sure that an entry is included in the workspace.
 
setEditorData(self, editor, index)
 
setModelData(self, editor, model, index)
 
_setEditorAtom(self, atom_num, editor, index)
Respond to the user clicking an atom in the workspace.
list or None
_getAtoms(self, struc, text)
This function returns a list of pka atoms by parsing a given text string that contains atom names and matching them to the atom names in the input structure.
 
_updateEditorText(self, editor, atom_name)
This function checks whether a given atom_name is present in the editor's string.
 
_resetMarker(self, editor, hint)
If a pKa atom was selected via the user clicking in the workspace, reset the currently marked atom to the table value.
 
eventFilter(self, editor, event)
Make sure that the editor doesn't close when the user clicks on another window since that will prevent the user from being able to click on an atom.
 
_showToolTip(self, widget, text)
Show a tool tip centered on the specified widget
 
_showToolTipTimer(self, widget, text, delay=0)
Show a tool tip centered on the specified widget after a delay
Class Variables [hide private]
  MAESTRO_STATUS_MESSAGE = "Pick an atom to be treated as the pK...
  TOOL_TIP_INSTRUCTIONS = "Click an atom in the workspace to\n" ...
  TOOL_TIP_WRONG_EID = "The atom you selected is not\n" "part of...
Instance Variables [hide private]
PyQt4.QtCore.pyqtSignal set_pka_marker = QtCore.pyqtSignal(str, object)
A signal emitted when a new pKa atom should be marked in the workspace.

Inherited from input_tab_widgets.CommitMultipleDelegate: commitDataToSelected

Method Details [hide private]

_ensureEntryIncluded(self, index)

 

Make sure that an entry is included in the workspace. If it isn't, include only that structure.

Parameters:
  • index (QtCore.QModelIndex) - The model index corresponding to the structure to include

_setEditorAtom(self, atom_num, editor, index)

 

Respond to the user clicking an atom in the workspace. If the atom does not belong to this structure, display a warning. Otherwise, enter the Jaguar-ified atom name into the line edit and display a marker on the atom. If atom is already included in the list of pka atoms we remove it from the list.

Parameters:
  • atom_num (int) - The atom number (relative to the workspace structure) that was selected.
  • editor (PyQt4.QtGui.QLineEdit) - The line edit to enter the atom name into
  • index (PyQt4.QCore.QModelIndex) - The index of the cell being edited

_getAtoms(self, struc, text)

 

This function returns a list of pka atoms by parsing a given text string that contains atom names and matching them to the atom names in the input structure. This is needed when user edits pka atom names in the input tab table.

Parameters:
  • struc (structure.Structure) - current structure
  • text (str) - text string that contains comma separated list of pka atoms.
Returns: list or None
list of structure atoms or None

_updateEditorText(self, editor, atom_name)

 

This function checks whether a given atom_name is present in the editor's string. If not found, add it to editor's text. If found delete it from the editor text and reformat the text.

Parameters:
  • editor (PyQt4.QtGui.QLineEdit) - The line edit to enter the atom name into
  • atom_name (string) - Name of picked atom

_resetMarker(self, editor, hint)

 

If a pKa atom was selected via the user clicking in the workspace, reset the currently marked atom to the table value.

Parameters:
  • editor (PyQt4.QtGui.QLineEdit) - The delegate editor
  • hint - Not used, but present for Qt compatibility

eventFilter(self, editor, event)

 

Make sure that the editor doesn't close when the user clicks on another window since that will prevent the user from being able to click on an atom.

Parameters:
  • editor (PyQt4.QtGui.QWidget) - The pKa atom line edit
  • event - A Qt event
  • event - PyQt4.QtCore.QEvent
Overrides: input_tab_widgets.CommitMultipleDelegate.eventFilter

Note: We don't need to worry about the case where the user clicks on a different widget in the pKa panel after selecting an atom. Since the editor was the last widget with focus in the pKa panel, it will receive another FocusOut event when the other widget receives focus, and that FocusOut event will cause the editor to close.

_showToolTip(self, widget, text)

 

Show a tool tip centered on the specified widget

Parameters:
  • widget (PyQt4.QtGui.QWidget) - The widget to center the tool tip on
  • text (str) - The text to display in the tool tip

_showToolTipTimer(self, widget, text, delay=0)

 

Show a tool tip centered on the specified widget after a delay

Parameters:
  • widget (PyQt4.QtGui.QWidget) - The widget to center the tool tip on
  • text (str) - The text to display in the tool tip
  • delay (int) - How long of a delay

Class Variable Details [hide private]

MAESTRO_STATUS_MESSAGE

Value:
"Pick an atom to be treated as the pKa atom"

TOOL_TIP_INSTRUCTIONS

Value:
"Click an atom in the workspace to\n" "set it as the pKa atom or type \
the\n" "atom name here."

TOOL_TIP_WRONG_EID

Value:
"The atom you selected is not\n" "part of this structure."

Instance Variable Details [hide private]

set_pka_marker

A signal emitted when a new pKa atom should be marked in the workspace. Emitted with two arguments:
Type:
PyQt4.QtCore.pyqtSignal
Value:
QtCore.pyqtSignal(str, object)