schrodinger.ui.qt.schrodinger_ipython module¶
- class schrodinger.ui.qt.schrodinger_ipython.SchrodingerIPython(**kwargs)[source]¶
Bases:
schrodinger.ui.qt.appframework2.af2.App
- setPanelOptions()[source]¶
Configure the panel by setting instance variables here. Always call the parent method. Panel options:
- self.maestro_dockable - whether this panel should be dockable in the
Maestro main window. Setting to false will prevent the panel from docking regardless of Maestro preference. When setting it to true, if Maestro Preference allows docking of panels, it will dock the panel on the right-hand side of the main window if “Location” is set to “Main window”, or a floating window if “Location” is set to “Floating window”. Default is False.
self.title - string to display in the window title bar
self.ui - a Ui_Form instance defining the main ui, default None
- self.allowed_run_modes - subset of [MODE_MAESTRO, MODE_STANDALONE,
MODE_SUBPANEL, MODE_CANVAS] defining how the panel may be run. Default is all.
self.help_topic - string defining the help topic. Default ‘’
- self.input_selector_options - dict of options for the common input
selector widget. Default is an empty dict, meaning do not add an input selector
- self.add_main_layout_stretch - bool of whether to add a stretch to the
main layout under the main ui (if self.ui exists). Default is True
- DrawChildren = 2¶
- DrawWindowBackground = 1¶
- IGNORE_DELAYED_CALLBACKS = False¶
- IgnoreMask = 4¶
- class PaintDeviceMetric¶
Bases:
int
- PdmDepth = 6¶
- PdmDevicePixelRatio = 11¶
- PdmDevicePixelRatioScaled = 12¶
- PdmDpiX = 7¶
- PdmDpiY = 8¶
- PdmHeight = 2¶
- PdmHeightMM = 4¶
- PdmNumColors = 5¶
- PdmPhysicalDpiX = 9¶
- PdmPhysicalDpiY = 10¶
- PdmWidth = 1¶
- PdmWidthMM = 3¶
- class RenderFlag¶
Bases:
int
- class RenderFlags¶
- class RenderFlags(Union[QWidget.RenderFlags, QWidget.RenderFlag]) None
- class RenderFlags(QWidget.RenderFlags) None
Bases:
sip.simplewrapper
- __init__(*args, **kwargs)¶
- __init__(**kwargs)¶
- Parameters
stop_before (int) – Exit the constructor before specified step.
parent (QWidget) – Parent widget, if any.
in_knime (bool) – Whether we are currently running under KNIME - a mode in which input selector is hidden, optionally a custom Workspace Structure is specified, and buttom bar has OK & Cancel buttons.
workspace_st_file (bool) – Structure to be returned by getWorkspaceStructure() when in_knime is True.
- acceptDrops(self) bool ¶
- accessibleDescription(self) str ¶
- accessibleName(self) str ¶
- actionEvent(self, QActionEvent)¶
- actions(self) List[QAction] ¶
- activateWindow(self)¶
- addAction(self, QAction)¶
- addActions(self, Iterable[QAction])¶
- addJaguarMarker(atoms, color=None, icon=None, text='', alt_color=None, highlight=False)¶
Add a marker to the specified atom(s)
- Parameters
atoms (list or
schrodinger.structure._StructureAtom
) – The atom or list of atoms to mark. A list may contain between one and four atoms (inclusive).color (tuple, str, int, or
schrodinger.structutils.color
) – The color of the marker and icon. May be an RGB tuple, color name, color index, orschrodinger.structutils.color
instance. If not given, white will be used.icon (int) – The icon to draw next to the marker. Should be one the self.MARKER_ICONS constants. If not given, no icon will be drawn.
text (str) – The text to display next to the marker. If not given, no text will be displayed. Note that this argument will be ignored when marking a single atom.
alt_color (tuple, str, int, or
schrodinger.structutils.color
) – The alternate marker color. This color is always used for text, and is used for the marker and icon whenhighlight
is True. If not given,color
will be used.highlight (bool) – Whether the marker should be highlighted. A highlighted marker is indicated with thicker lines and is colored using
alt_color
instead ofcolor
.
- Returns
The newly created marker
- Return type
schrodinger.maestro.markers._BaseMarker
- Raises
ValueError – If a marker already exists for the specified atoms
- Note
Either an icon or text may be displayed on a marker, but not both. If both are given, only the text will be shown.
- addMainTaskRunner(runner, taskwidget)¶
A “main” task runner is a runner that is operated by a task widget (generally a job bar) at the very bottom of the panel. A panel may have more than one main task, but there is always one that is the “current” task. This is useful for panels that have multiple modes, with each mode launching a different job.
The related method, self.setCurrentTask(), is used to switch between main runners that have been added via this function.
- Parameters
runner (tasks.AbstractTaskRuner) – the task runner
taskwidget (taskwidgets.TaskUIMixin) – the associated task widget
- addMarker(atoms, color=(1.0, 1.0, 1.0), group_name=None)¶
Generates a set of simple, dot-styled markers for a group of atoms.
- Parameters
atoms (list or
schrodinger.structure._StructureAtom
) – List of atoms to be markedcolor (tuple of 3 floats) – The amount of red, green and blue to use, each ranging from 0.0 to 1.0. Default is white (1., 1., 1.).
@group_name: Optional string to set as the name of this group of markers in Maestro. If not set, a unique identifier will be generated.
- addMarkerFromAsl(asl, color=(1.0, 1.0, 1.0), group_name=None)¶
Generates a set of simple, dot-styled markers for group of Workspace atoms that match the given ASL. Same atoms continue to be marked even if the Workspace is later modified such that ASL matching changes.
- Parameters
asl – ASL for the atoms to mark.
color (tuple of 3 floats) – The amount of red, green and blue to use, each ranging from 0.0 to 1.0. Default is white (1., 1., 1.).
@group_name: Optional string to set as the name of this group of markers in Maestro. If not set, a unique identifier will be generated.
- Returns
Marker object
- Return type
markers.Marker
- adjustSize(self)¶
- applyAliasedSettings(settings)¶
Applies any aliased settings with new values from the dictionary. Any aliases not present in the settings dictionary will be left unchanged.
- Parameters
settings (dict) – a dictionary mapping aliases to new values to apply
- applySettings(settings, target=None)¶
- autoFillBackground(self) bool ¶
- backgroundRole(self) QPalette.ColorRole ¶
- baseSize(self) QSize ¶
- blockSignals(self, bool) bool ¶
- buildCallbackDicts()¶
Create a dictionary of all methods that have a maestro_callback decorator.
- changeEvent(self, QEvent)¶
- childAt(self, QPoint) QWidget ¶
- SchrodingerIPython.childAt(self, int, int) -> QWidget
- childEvent(self, QChildEvent)¶
- children(self) List[QObject] ¶
- childrenRect(self) QRect ¶
- childrenRegion(self) QRegion ¶
- cleanup()¶
- clearFocus(self)¶
- clearMask(self)¶
- close(self) bool ¶
- closeEvent(event)¶
Receives the close event and calls the panel’s ‘close’-decorated appmethod. If the appmethod specifically returns False, the close event will be ignored and the panel will remain open. All other return values (including None) will allow the panel to proceed with closing.
This is a PyQT slot method and should not be explicitly called.
- colorCount(self) int ¶
- connectNotify(self, QMetaMethod)¶
- contentsMargins(self) QMargins ¶
- contentsRect(self) QRect ¶
- contextMenuEvent(self, QContextMenuEvent)¶
- contextMenuPolicy(self) Qt.ContextMenuPolicy ¶
- create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)¶
- createBottomBar()¶
- createInputSelector()¶
- createWindowContainer(QWindow, parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = 0) QWidget ¶
- currentTaskRunner()¶
- cursor(self) QCursor ¶
- customContextMenuRequested¶
customContextMenuRequested(self, QPoint) [signal]
- customEvent(self, QEvent)¶
- definePanelSettings()¶
Override this method to define the settings for the panel. The aliased settings provide an interface for saving/restoring panel state as well as for interacting with task/job runners that need to access the panel state in a way that is agnostic to the specifics of widget names and types.
Each panel setting is defined by a tuple that specifies the mapping of alias to panel setting. An optional third element in the tuple can be used to group settings by category. This allows multiple settings to share the same alias.
Each setting can either point to a specific object (usually a qt widget), or a pair of setter/getter functions.
If the mapped object is a string, this will be interpreted by af2 as referring to an attribute on the panel, and a AttributeSettingWrapper instance will automatically be created. For example, specifying the string ‘num_atoms’ will create a mapping to self.num_atoms which will simply get and set the value of that instance member.
Custom setter and getter functions should take the form getter(), returning a value that can be encoded/decoded by JSON, and setter(value), where the type of value is the same as the return type of the getter.
Commonly used objects/widgets should be handled automatically in settings.py. It’s worth considering whether it makes more sense to use a custom setter/getter here or add support for the widget in settings.py.
- Returns
a list of tuples defining the custom settings.
- Return type
list of tuples. Each tuple can be of type (str, object, str) or (str, (callable, callable), str) where the final str is optional.
Custom settings tuples consists of up to three elements:
alias - a string identier for the setting. Ex. “box_centroid”
either:
an object of a type that is supported by settings.py or
the string name of an existing panel attribute (i.e. member variable), or
a (getter, setter) tuple. The getter should take no arguments, and the setter should take a single value.
optionally, a group identifier. This can be useful if the panel runs two different jobs that both have a parameter with the same name but that needs to map to different widgets. If a setting has a group name, it will be ignored by runners unless the runner name matches the group name.
- deleteLater(self)¶
- depth(self) int ¶
- destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)¶
- destroyed¶
destroyed(self, object: QObject = None) [signal]
- devType(self) int ¶
- devicePixelRatio(self) int ¶
- devicePixelRatioF(self) float ¶
- devicePixelRatioFScale() float ¶
- disconnect(QMetaObject.Connection) bool ¶
- disconnect(self) None
- disconnectNotify(self, QMetaMethod)¶
- dragEnterEvent(self, QDragEnterEvent)¶
- dragLeaveEvent(self, QDragLeaveEvent)¶
- dragMoveEvent(self, QDragMoveEvent)¶
- dropEvent(self, QDropEvent)¶
- dumpObjectInfo(self)¶
- dumpObjectTree(self)¶
- dynamicPropertyNames(self) List[QByteArray] ¶
- effectiveWinId(self) PyQt5.sip.voidptr ¶
- ensurePolished(self)¶
- enterEvent(self, QEvent)¶
- error(text, preferences=None, key='')¶
Display an error dialog with the specified text. If preferences and key are both supplied, then the dialog will contain a “Don’t show this again” checkbox. Future invocations of this dialog with the same preferences and key values will obey the user’s show preference.
- Parameters
text (str) – The information to display in the dialog
preferences – obsolete; ignored.
key (str) – The key to store the preference under. If specified, a “Do not show again” checkbox will be rendered in the dialog box.
- Return type
None
- event(self, QEvent) bool ¶
- eventFilter(self, QObject, QEvent) bool ¶
- find(PyQt5.sip.voidptr) QWidget ¶
- findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject ¶
- findChild(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject
- findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject] ¶
- findChildren(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
- focusInEvent(self, QFocusEvent)¶
- focusNextChild(self) bool ¶
- focusNextPrevChild(self, bool) bool ¶
- focusOutEvent(self, QFocusEvent)¶
- focusPolicy(self) Qt.FocusPolicy ¶
- focusPreviousChild(self) bool ¶
- focusProxy(self) QWidget ¶
- focusWidget(self) QWidget ¶
- font(self) QFont ¶
- fontInfo(self) QFontInfo ¶
- fontMetrics(self) QFontMetrics ¶
- foregroundRole(self) QPalette.ColorRole ¶
- frameGeometry(self) QRect ¶
- frameSize(self) QSize ¶
- geometry(self) QRect ¶
- getAliasedSettings()¶
- getAliasedValue(alias)¶
- getAllJaguarMarkers()¶
Get all markers._BaseMarker currently loaded into the panel
- Returns
An iterator of markers._BaseMarker
- Return type
iterator
- getAllMarkers()¶
Get all markers.Marker loaded into the panel
- Returns
list(markers.Marker)
- Return type
list
- getContentsMargins(self) Tuple[int, int, int, int] ¶
- getJaguarMarker(atoms)¶
Retrieve a marker for the specified atom(s)
- Parameters
atoms (list or
schrodinger.structure._StructureAtom
) – The atom or list of atoms to retrieve the marker for. A list may contain between one and four atoms (inclusive).- Returns
The requested marker
- Return type
schrodinger.maestro.markers._BaseMarker
- Raises
ValueError – If no marker exists for the specified atoms
- Note
As indicated by the return type, this function only returns
schrodinger.maestro.markers._BaseMarker
derived markers. Multi atomschrodinger.maestro.markers.Marker
type markers are not accessible in this way.
- getObjValue(obj)¶
- getPanelState()¶
Gets the current state of the panel in the form of a serializable dict. The state consists of the settings specified in definePanelSettings() as well as the automatically harvested settings.
- getPersistenceKey(alias)¶
Return a unique identifier for saving/restoring a setting in the preferences. Override this method to change the key scheme (this is necessary if creating a common resource which is shared by multiple panels).
- Parameters
alias (str) – the alias for which we are generating a key
- getSettings(target=None, ignore_list=None)¶
- getWorkspaceStructure()¶
If panel is open in Maestro session, returns the current workspace
schrodinger.strucutre.Structure
.If panel is open from outside of Maestro, returns the self.workspace_st if self.workspace_st_file is available. Used while running from command line or starting the panel from KNIME.
Returns None otherwise.
- Return type
schrodinger.structure.Structure
or None- Returns
Maestro workspace structure or None
- grab(self, rectangle: QRect = QRect(QPoint(0, 0), QSize(- 1, - 1))) QPixmap ¶
- grabGesture(self, Qt.GestureType, flags: Union[Qt.GestureFlags, Qt.GestureFlag] = Qt.GestureFlags())¶
- grabKeyboard(self)¶
- grabMouse(self)¶
- grabMouse(self, Union[QCursor, Qt.CursorShape]) None
- grabShortcut(self, Union[QKeySequence, QKeySequence.StandardKey, str, int], context: Qt.ShortcutContext = Qt.WindowShortcut) int ¶
- graphicsEffect(self) QGraphicsEffect ¶
- graphicsProxyWidget(self) QGraphicsProxyWidget ¶
- gui_closed¶
- hasFocus(self) bool ¶
- hasHeightForWidth(self) bool ¶
- hasMouseTracking(self) bool ¶
- hasTabletTracking(self) bool ¶
- height(self) int ¶
- heightForWidth(self, int) int ¶
- heightMM(self) int ¶
- hide(self)¶
- hideAllJaguarMarkers()¶
Hide all
schrodinger.maestro.markers._BaseMarker
markers for this panel
- hideAllMarkers()¶
Hide all
schrodinger.maestro.markers.Marker
markers for this panel.
- hideEvent(self, QHideEvent)¶
- hideLayoutElements(layout)¶
Hide all elements from the given layout. Used for customizing KNIME panel wrappers.
- ignoreMaestroCallbacks()¶
A context manager for temporarily disabling Maestro callbacks created using the decorators above. (Note that callbacks that have been manually added using maestro.*_callback_add() will not be disabled.)
Example:
def includeEntry(self, entry_id): proj = maestro.project_table_get() with self.ignoreMaestroCallbacks(): proj[entry_id].in_workspace = project.IN_WORKSPACE @maestro_callback.project_changed def onProjectChanged(self): print "This method will not be called during includeEntry." @maestro_callback.workspace_changed def onWorkspaceChanged(self): print "Neither will this one."
- info(text, preferences=None, key='')¶
Display an information dialog with the specified text. If preferences and key are both supplied, then the dialog will contain a “Don’t show this again” checkbox. Future invocations of this dialog with the same preferences and key values will obey the user’s show preference.
- Parameters
text (str) – The information to display in the dialog
preferences – obsolete; ignored.
key (str) – The key to store the preference under. If specified, a “Do not show again” checkbox will be rendered in the dialog box.
- Return type
None
- inherits(self, str) bool ¶
- initPainter(self, QPainter)¶
- inputMethodEvent(self, QInputMethodEvent)¶
- inputMethodHints(self) Qt.InputMethodHints ¶
- inputMethodQuery(self, Qt.InputMethodQuery) Any ¶
- SchrodingerIPython.insertAction(self, QAction, QAction)
- insertActions(self, QAction, Iterable[QAction])¶
- installEventFilter(self, QObject)¶
- isActiveWindow(self) bool ¶
- isAncestorOf(self, QWidget) bool ¶
- isEnabled(self) bool ¶
- isEnabledTo(self, QWidget) bool ¶
- isFullScreen(self) bool ¶
- isHidden(self) bool ¶
- isLeftToRight(self) bool ¶
- isMaximized(self) bool ¶
- isMinimized(self) bool ¶
- isModal(self) bool ¶
- isRightToLeft(self) bool ¶
- isSignalConnected(self, QMetaMethod) bool ¶
- isVisible(self) bool ¶
- isVisibleTo(self, QWidget) bool ¶
- isWidgetType(self) bool ¶
- isWindow(self) bool ¶
- isWindowModified(self) bool ¶
- isWindowType(self) bool ¶
- jobname()¶
Return the job name currently set for the current task.
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- keyboardGrabber() QWidget ¶
- killTimer(self, int)¶
- layout(self) QLayout ¶
- layoutDirection(self) Qt.LayoutDirection ¶
- leaveEvent(self, QEvent)¶
- loadPanelState(filename=None)¶
Load the panel state from a JSON file
- Parameters
filename (str) – the JSON filename. Defaults to “panelstate.json”
- loadPersistentOptions()¶
Load all persistent options from the preferences.
- loadSettings(jobname)¶
Load the GUI state for the job in the CWD with the given name. Default implementation will return False. Each KNIME panel will need to implement a custom version. For example, the panel may want to read the <jobname.sh> file, parse the list of command-line options, and populate the GUI accordintly. If a panel writes key/value file, then it would need to read it here.
- Returns
True if panel state was restored, False if saved state was not found.
- Return type
bool
- locale(self) QLocale ¶
- logicalDpiX(self) int ¶
- logicalDpiY(self) int ¶
- lower(self)¶
- mapFrom(self, QWidget, QPoint) QPoint ¶
- mapFromGlobal(self, QPoint) QPoint ¶
- mapFromParent(self, QPoint) QPoint ¶
- mapTo(self, QWidget, QPoint) QPoint ¶
- mapToGlobal(self, QPoint) QPoint ¶
- mapToParent(self, QPoint) QPoint ¶
- mask(self) QRegion ¶
- maximumHeight(self) int ¶
- maximumSize(self) QSize ¶
- maximumWidth(self) int ¶
- metaObject(self) QMetaObject ¶
- metric(self, QPaintDevice.PaintDeviceMetric) int ¶
- minimumHeight(self) int ¶
- minimumSize(self) QSize ¶
- minimumSizeHint(self) QSize ¶
- minimumWidth(self) int ¶
- mouseDoubleClickEvent(self, QMouseEvent)¶
- mouseGrabber() QWidget ¶
- mouseMoveEvent(self, QMouseEvent)¶
- mousePressEvent(self, QMouseEvent)¶
- mouseReleaseEvent(self, QMouseEvent)¶
- move(self, QPoint)¶
- SchrodingerIPython.move(self, int, int) -> None
- moveEvent(self, QMoveEvent)¶
- moveToThread(self, QThread)¶
- nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) Tuple[bool, int] ¶
- nativeParentWidget(self) QWidget ¶
- nextInFocusChain(self) QWidget ¶
- normalGeometry(self) QRect ¶
- objectName(self) str ¶
- objectNameChanged¶
objectNameChanged(self, str) [signal]
- overrideWindowFlags(self, Union[Qt.WindowFlags, Qt.WindowType])¶
- overrideWindowState(self, Union[Qt.WindowStates, Qt.WindowState])¶
- paintEngine(self) QPaintEngine ¶
- paintEvent(self, QPaintEvent)¶
- paintingActive(self) bool ¶
- palette(self) QPalette ¶
- classmethod panel(run=True)¶
Launch a singleton instance of this class. If the panel has already been instantiated, the existing panel instance will be re-opened and brought to the front.
- Parameters
run (bool) – Whether to launch the panel
- Returns
The singleton panel instance
- Return type
- parent(self) QObject ¶
- parentWidget(self) QWidget ¶
- physicalDpiX(self) int ¶
- physicalDpiY(self) int ¶
- pos(self) QPoint ¶
- previousInFocusChain(self) QWidget ¶
- processSettings(settings=None, runner=None)¶
This method is meant to be used as a callback to a task runner. If it is called with no arguments, it returns a dictionary of all the alieased settings. If settings are passed, the settings are first applied to self, and then the newly modified settings are returned.
- Parameters
settings (dict or None) – a settings dictionary to apply to this object
runner (tasks.AbstractTaskRuner) – the task runner that is invoking this callback. This optional argument is necessary for per-runner grouping of settings
- processTaskMessage(message_type, text, options=None, runner=None)¶
This method is meant to be used as a callback to a task runner, and provides a single point of interaction from the runner to the user.
- Parameters
message_type (int) – the type of message being sent
text (str) – the main text to show the user
options – extra options
- property(self, str) Any ¶
- pyqtConfigure(...)¶
Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.
- question(msg, button1='OK', button2='Cancel', title='Question')¶
Display a prompt dialog window with specified text. Returns True if first button (default OK) is pressed, False otherwise.
- raise_(self)¶
- readShFile(jobname)¶
Reads the jobname.sh file (written by _write()) and returns the list of command line arguments
- receivers(self, PYQT_SIGNAL) int ¶
- rect(self) QRect ¶
- releaseKeyboard(self)¶
- releaseMouse(self)¶
- releaseShortcut(self, int)¶
- removeAction(self, QAction)¶
- removeAllJaguarMarkers()¶
Remove all markers
schrodinger.maestro.markers._BaseMarker
markers from this panel
- removeAllJaguarMarkersForEntry(eid)¶
Remove all markers for the specified entry id from this panel
- Parameters
eid (str) – The entry id to remove markers for
- removeAllMarkers()¶
Remove all
schrodinger.maestro.markers.Marker
markers from this panel.
- removeEventFilter(self, QObject)¶
- removeJaguarMarker(marker)¶
Removes the specified marker
- Parameters
marker (
schrodinger.maestro.markers._BaseMarker
) – The marker to remove- Raises
ValueError – If there is no marker on the specified atoms
- removeJaguarMarkerForAtoms(atoms)¶
Removes the marker for specified atom(s)
- Parameters
atoms (list or
schrodinger.structure._StructureAtom
) – The atom or list of atoms to retrieve the marker for. A list may contain between one and four atoms (inclusive).- Raises
ValueError – If no marker exists for the specified atoms
- removeMarker(marker)¶
Remove the
schrodinger.maestro.markers.Marker
- Parameters
marker (
schrodinger.maestro.markers.Marker
) – Marker to remove- Raises
ValueError – If marker is the wrong type or is not associated with the panel.
- render(self, QPaintDevice, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.RenderFlag.DrawWindowBackground | QWidget.RenderFlag.DrawChildren))¶
- render(self, QPainter, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.RenderFlag.DrawWindowBackground | QWidget.RenderFlag.DrawChildren)) None
- repaint(self)¶
- SchrodingerIPython.repaint(self, int, int, int, int) -> None
- repaint(self, QRect) None
- repaint(self, QRegion) None
- reportValidation(results)¶
Present validation messages to the user. This is an implmentation of the
ValidationMixin
interface and does not need to be called directly.This method assumes that
error
andquestion
methods have been defined in the subclass, as in e.g.widget_mixins.MessageBoxMixin
.- Parameters
results (
validation.ValidationResults
) – Set of validation results generated byvalidate
- Returns
if True, there were no validation errors and the user decided to continue despite any warnings. If False, there was at least one validation error or the user decided to abort when faced with a warning.
- resetAllRunners()¶
Resets all task runners associated with this panel (main tasks and other tasks added via setupTaskRunner). This is called from _reset() and normally does not need to be called directly.
- resize(self, QSize)¶
- SchrodingerIPython.resize(self, int, int) -> None
- resizeEvent(self, QResizeEvent)¶
- restoreCursor(app_wide=True)¶
Restore the application level cursor to the default. If ‘app_wide’ is True then if will be restored for the entire application, if it’s False, it will be just for this panel.
- Parameters
app_wide (bool) – If True then this will restore the cursor for the entire application (including Maestro if running there). If False then this will apply only to this panel.
- restoreGeometry(self, Union[QByteArray, bytes, bytearray]) bool ¶
- run()¶
- runCanvas()¶
This handles Canvas-specific logic
- classmethod runKnime(input_selector_file=None, workspace_st_file=None, jobname=None, run=True, load_settings=True, panel_state_file=None)¶
Call this static method to instantiate this panel in KNIME mode - where OK & Cancel buttons are shown at the bottom. Pressing OK button cases the job files to be written to the CWD.
- Parameters
input_selector_file (str) – the filename to be fed into the input selector, replacing interactive input from the user. Required if the panel contains an input selector.
workspace_st_file (str) – the filename containing the
schrodinger.structure.Structure
that replaces the workspace structure in a Maestro session.jobname (str) – Jobname for the panel
run (bool) – Whether to launch the panel. If False, just returns the panel instance without starting the event loop.
load_settings (bool) – Whether to load previous settings for the given jobname from the CWD.
panel_state_file – Unused (added for backwards compatability)
- runMaestro()¶
This can be extended in derived classes to perform maestro-only tasks such as setting up the mini-monitor or connecting maestro callbacks
- runMode()¶
- runStandalone()¶
- runSubpanel()¶
- runValidation(silent=False, validate_children=True, stop_on_fail=True)¶
Runs validation and reports the results (unless run silently).
- Parameters
silent (bool) – run without any reporting (i.e. error messages to the user). This is useful if we want to programmatically test validity. Changes return value of this method from
ValidationResults
to a boolean.validate_children (bool) – run validation on all child objects. See
_validateChildren
for documentation on what this entails.stop_on_fail (bool) – stop validation when first failure is encountered
- Returns
if silent is False, returns the validation results. If silent is True, returns a boolean generated by
reportValidation
.- Return type
ValidationResults
or bool
- saveGeometry(self) QByteArray ¶
- savePersistentOptions()¶
Store all persistent options to the preferences.
- SchrodingerIPython.scroll(self, int, int)
- SchrodingerIPython.scroll(self, int, int, QRect) -> None
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setAcceptDrops(self, bool)¶
- setAccessibleDescription(self, str)¶
- setAccessibleName(self, str)¶
- setAlias(alias, obj, persistent=False)¶
Sets an alias to conveniently access an object.
- Parameters
alias (hashable) – any hashable, but typically a string name
obj (object) – the actual object to be referenced
persistent (bool) – whether to make the setting persistent
- setAliasedValue(alias, value)¶
- setAliases(alias_dict, persistent=False)¶
Sets multiple aliases at once. Already used aliases are overwritten; other existing aliases are not affected.
- Parameters
alias_dict (dict) – map of aliases to objects
persistent (bool) – whether to make the settings persistent
- setAttribute(self, Qt.WidgetAttribute, on: bool = True)¶
- setAutoFillBackground(self, bool)¶
- setBackgroundRole(self, QPalette.ColorRole)¶
- SchrodingerIPython.setBaseSize(self, int, int)
- setBaseSize(self, QSize) None ¶
- SchrodingerIPython.setContentsMargins(self, int, int, int, int)
- setContentsMargins(self, QMargins) None ¶
- setContextMenuPolicy(self, Qt.ContextMenuPolicy)¶
- setCurrentTask(index)¶
Selects the current main task for the panel. Switching to a new task involves several steps. These are 1) saving the current panel state to the task runner, 2) hiding the current task widget (and all others), 3) showing the widget for the new task, and 4) setting the panel state to correspond to the new task runner’s settings.
- Parameters
index (int) – the index of the task to be selected. The index for each main task is set sequentially from 0 as each task as added using self.addMainTaskRunner()
- setCursor(self, Union[QCursor, Qt.CursorShape])¶
- setDefaults()¶
- setDisabled(self, bool)¶
- setEnabled(self, bool)¶
- setFixedHeight(self, int)¶
- setFixedSize(self, QSize)¶
- SchrodingerIPython.setFixedSize(self, int, int) -> None
- setFixedWidth(self, int)¶
- setFocus(self)¶
- setFocus(self, Qt.FocusReason) None
- setFocusPolicy(self, Qt.FocusPolicy)¶
- setFocusProxy(self, QWidget)¶
- setFont(self, QFont)¶
- setForegroundRole(self, QPalette.ColorRole)¶
- setGeometry(self, QRect)¶
- SchrodingerIPython.setGeometry(self, int, int, int, int) -> None
- setGraphicsEffect(self, QGraphicsEffect)¶
- setHidden(self, bool)¶
- setInputMethodHints(self, Union[Qt.InputMethodHints, Qt.InputMethodHint])¶
- setJobname(jobname)¶
Set the job name for the current task.
- setLayout(self, QLayout)¶
- setLayoutDirection(self, Qt.LayoutDirection)¶
- setLocale(self, QLocale)¶
- setMask(self, QBitmap)¶
- setMask(self, QRegion) None
- setMaximumHeight(self, int)¶
- SchrodingerIPython.setMaximumSize(self, int, int)
- setMaximumSize(self, QSize) None ¶
- setMaximumWidth(self, int)¶
- setMinimumHeight(self, int)¶
- SchrodingerIPython.setMinimumSize(self, int, int)
- setMinimumSize(self, QSize) None ¶
- setMinimumWidth(self, int)¶
- setMouseTracking(self, bool)¶
- setObjValue(obj, value)¶
- setObjectName(self, str)¶
- setPalette(self, QPalette)¶
- setPanelState(state)¶
Resets the panel and then sets the panel to the specified state
- Parameters
state (PanelState) – the panel state to set. This object should originate from a call to getPanelState()
- setParent(self, QWidget)¶
- setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType]) None
- setPersistent(alias=None)¶
Set options to be persistent. Any options to be made persistent must be aliased, since the alias is used to form the preference key. If no alias is specified, all aliased settings will be made persistent.
- Parameters
alias (str or None) – the alias to save, or None
- setProperty(self, str, Any) bool ¶
- setShortcutAutoRepeat(self, int, enabled: bool = True)¶
- setShortcutEnabled(self, int, enabled: bool = True)¶
- SchrodingerIPython.setSizeIncrement(self, int, int)
- setSizeIncrement(self, QSize) None ¶
- setSizePolicy(self, QSizePolicy)¶
- setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy) None
- setStatusTip(self, str)¶
- setStyle(self, QStyle)¶
- setStyleSheet(self, str)¶
- SchrodingerIPython.setTabOrder(QWidget, QWidget)
- setTabletTracking(self, bool)¶
- setToolTip(self, str)¶
- setToolTipDuration(self, int)¶
- setUpdatesEnabled(self, bool)¶
- setVisible(self, bool)¶
- setWaitCursor(app_wide=True)¶
Set the cursor to the wait cursor. This will be an hourglass, clock or similar. Call restoreCursor() to return to the default cursor.
- Parameters
app_wide (bool) – If True then this will apply to the entire application (including Maestro if running there). If False then this will apply only to this panel.
- setWhatsThis(self, str)¶
- setWindowFilePath(self, str)¶
- setWindowFlag(self, Qt.WindowType, on: bool = True)¶
- setWindowFlags(self, Union[Qt.WindowFlags, Qt.WindowType])¶
- setWindowIcon(self, QIcon)¶
- setWindowIconText(self, str)¶
- setWindowModality(self, Qt.WindowModality)¶
- setWindowModified(self, bool)¶
- setWindowOpacity(self, float)¶
- setWindowRole(self, str)¶
- setWindowState(self, Union[Qt.WindowStates, Qt.WindowState])¶
- setWindowTitle(self, str)¶
- setupTaskRunner(runner, taskwidget)¶
Connects a task widget to a task runner and associates the runner with this af2 panel via the panel callbacks.
This method is called by self.addMainTaskRunner() and does not need to be called for main tasks; however, it is useful for setting up other tasks that are not main tasks - for example, if there is a smaller job that gets launched from a button in the middle of the panel somewhere.
- Parameters
runner (tasks.AbstractTaskRuner) – the task runner
taskwidget (taskwidgets.TaskUIMixin) – the associated task widget
- show()¶
Re-show all panel markers when the panel is re-shown. This separate method is needed for QDialog instances.
- showAllJaguarMarkers()¶
Show all
schrodinger.maestro.markers._BaseMarker
markers for which all marked atoms are in the workspace. Hide all other markers.
- showAllMarkers()¶
Set all
schrodinger.maestro.markers.Marker
markers to be shown if the relevant atoms are in the workspace. These markers are hidden automatically by Maestro when atoms are excluded.
- showEvent(event)¶
When the panel is shown, call the panel’s ‘show’-decorated methods. Note that restoring a minimized panel will not trigger the ‘show’ methods.
- showFullScreen(self)¶
- showMaximized(self)¶
- showMinimized(self)¶
- showNormal(self)¶
- showProgressBarForJob(job, show_lbl=True, start_timer=True)¶
Show a progress bar that tracks the progress of the specified job
- Parameters
job (
schrodinger.job.jobcontrol.Job
) – The job to trackshow_lbl (bool) – If True, the job progress text description will be shown above the progress bar. If False, the text description will not be shown.
start_timer (bool) – If True, the progress bar will automatically be updated and removed when the job is complete. If False, it is the caller’s responsibility to periodically call self.progress_bar.readJobAndUpdateProgress() and to call self.status_bar.hideProgress() when the job is complete.
- signalsBlocked(self) bool ¶
- size(self) QSize ¶
- sizeHint(self) QSize ¶
- sizeIncrement(self) QSize ¶
- sizePolicy(self) QSizePolicy ¶
- stackUnder(self, QWidget)¶
- startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) int ¶
- startUp()¶
- staticMetaObject = <PyQt5.QtCore.QMetaObject object>¶
- statusTip(self) str ¶
- style(self) QStyle ¶
- styleSheet(self) str ¶
- tabletEvent(self, QTabletEvent)¶
- testAttribute(self, Qt.WidgetAttribute) bool ¶
- thread(self) QThread ¶
- timerEvent(self, QTimerEvent)¶
- property title¶
- toolTip(self) str ¶
- toolTipDuration(self) int ¶
- tr(self, str, disambiguation: str = None, n: int = - 1) str ¶
- underMouse(self) bool ¶
- ungrabGesture(self, Qt.GestureType)¶
- unsetCursor(self)¶
- unsetLayoutDirection(self)¶
- unsetLocale(self)¶
- update(self)¶
- update(self, QRect) None
- update(self, QRegion) None
- SchrodingerIPython.update(self, int, int, int, int) -> None
- updateGeometry(self)¶
- updateMicroFocus(self)¶
- updatesEnabled(self) bool ¶
- validateOPLSDir(opls_dir=None)¶
See
forcefield.validate_opls_dir()
- Parameters
opls_dir (str or None) – the opls dir to validate
- Returns
the validation result
- Return type
- visibleRegion(self) QRegion ¶
- warning(text, preferences=None, key='')¶
Display a warning dialog with the specified text. If preferences and key are both supplied, then the dialog will contain a “Don’t show this again” checkbox. Future invocations of this dialog with the same preferences and key values will obey the user’s show preference.
- Parameters
text (str) – The information to display in the dialog
preferences – obsolete; ignored.
key (str) – The key to store the preference under. If specified, a “Do not show again” checkbox will be rendered in the dialog box.
- Return type
None
- whatsThis(self) str ¶
- wheelEvent(self, QWheelEvent)¶
- width(self) int ¶
- widthMM(self) int ¶
- winId(self) PyQt5.sip.voidptr ¶
- window(self) QWidget ¶
- windowFilePath(self) str ¶
- windowFlags(self) Qt.WindowFlags ¶
- windowHandle(self) QWindow ¶
- windowIcon(self) QIcon ¶
- windowIconChanged¶
windowIconChanged(self, QIcon) [signal]
- windowIconText(self) str ¶
- windowIconTextChanged¶
windowIconTextChanged(self, str) [signal]
- windowModality(self) Qt.WindowModality ¶
- windowOpacity(self) float ¶
- windowRole(self) str ¶
- windowState(self) Qt.WindowStates ¶
- windowTitle(self) str ¶
- windowTitleChanged¶
windowTitleChanged(self, str) [signal]
- windowType(self) Qt.WindowType ¶
- writePanelState(filename=None)¶
Write the panel state to a JSON file
- Parameters
filename (str) – the JSON filename. Defaults to “panelstate.json”
- writeStateAndClose()¶
Called when OK button button is pressed when running in KNIME mode. Will “write” the job files for current task, and close the panel.
- x(self) int ¶
- y(self) int ¶
- class schrodinger.ui.qt.schrodinger_ipython.KernelManagerWithUserModule(**kwargs)[source]¶
Bases:
qtconsole.inprocess.QtInProcessKernelManager
This kernel manager starts its kernel with a custom namespace rather than replacing the __main__ namespace, which is the standard InProcessKernelManager behavior. If the __main__ namespace gets replaced, then we’ll get exceptions every time Maestro runs a Python command. (When executing Python code from C++, Maestro temporarily modifies sys.path to ensure that the executed code can import any modules that it needs. This code is runs in the __main__ namespace, so replacing that namespace removes the sys import and the temporary variables that Maestro expects. See MAE-35487.)
- __init__(*args, **kwargs)[source]¶
Create a configurable given a config config.
- configConfig
If this is empty, default values are used. If config is a
Config
instance, it will be used to configure the instance.- parentConfigurable instance, optional
The parent Configurable instance of this object.
Subclasses of Configurable must call the
__init__()
method ofConfigurable
before doing anything else and usingsuper()
:class MyConfigurable(Configurable): def __init__(self, config=None): super(MyConfigurable, self).__init__(config=config) # Then any other code you need to finish initialization.
This ensures that instances will be configured properly.
- start_kernel(**kwargs)[source]¶
Start the kernel using a non-__main__ namespace. Note that all arguments to this method are ignored, as that’s the behavior of QtInProcessKernelManager.
- add_restart_callback(callback, event='restart')¶
register a callback to be called when a kernel is restarted
- add_traits(**traits)¶
Dynamically add trait attributes to the HasTraits instance.
- autorestart¶
A boolean (True, False) trait.
- blockSignals(self, bool) bool ¶
- blocking_class¶
A trait whose value must be a subclass of a specified class.
- blocking_client()¶
Make a blocking client connected to my kernel
- cache_ports¶
A boolean (True, False) trait.
- childEvent(self, QChildEvent)¶
- children(self) List[QObject] ¶
- classmethod class_config_rst_doc()¶
Generate rST documentation for this class’ config options.
Excludes traits defined on parent classes.
- classmethod class_config_section(classes=None)¶
Get the config section for this class.
- classeslist, optional
The list of other classes in the config file. Used to reduce redundant information.
- classmethod class_get_help(inst=None)¶
Get the help string for this class in ReST format.
If
inst
is given, it’s current trait values will be used in place of class defaults.
- classmethod class_get_trait_help(trait, inst=None, helptext=None)¶
Get the helptext string for a single trait.
- Parameters
inst – If given, it’s current trait values will be used in place of the class default.
helptext – If not given, uses the
help
attribute of the current trait.
- classmethod class_own_trait_events(name)¶
Get a dict of all event handlers defined on this class, not a parent.
Works like
event_handlers
, except for excluding traits from parents.
- classmethod class_own_traits(**metadata)¶
Get a dict of all the traitlets defined on this class, not a parent.
Works like
class_traits
, except for excluding traits from parents.
- classmethod class_print_help(inst=None)¶
Get the help string for a single trait and print it.
- classmethod class_trait_names(**metadata)¶
Get a list of all the names of this class’ traits.
This method is just like the
trait_names()
method, but is unbound.
- classmethod class_traits(**metadata)¶
Get a
dict
of all the traits of this class. The dictionary is keyed on the name and the values are the TraitType objects.This method is just like the
traits()
method, but is unbound.The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
The metadata kwargs allow functions to be passed in which filter traits based on metadata values. The functions should take a single value as an argument and return a boolean. If any function returns False, then the trait is not included in the output. If a metadata key doesn’t exist, None will be passed to the function.
- cleanup(connection_file=True)¶
Clean up resources when the kernel is shut down
- cleanup_connection_file()¶
Cleanup connection file if we wrote it
Will not raise if the connection file was already removed somehow.
- cleanup_ipc_files()¶
Cleanup ipc files if we wrote them.
- cleanup_random_ports()¶
Forgets randomly assigned port numbers and cleans up the connection file.
Does nothing if no port numbers have been randomly assigned. In particular, does nothing unless the transport is tcp.
- cleanup_resources(restart=False)¶
Clean up resources when the kernel is shut down
- client(**kwargs)¶
Create a client configured to connect to our kernel
- client_class = 'qtconsole.inprocess.QtInProcessKernelClient'¶
- client_factory¶
A trait whose value must be a subclass of a specified class.
- config¶
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
- connectNotify(self, QMetaMethod)¶
- connect_control(identity=None)¶
return zmq Socket connected to the Control channel
- connect_hb(identity=None)¶
return zmq Socket connected to the Heartbeat channel
- connect_iopub(identity=None)¶
return zmq Socket connected to the IOPub channel
- connect_shell(identity=None)¶
return zmq Socket connected to the Shell channel
- connect_stdin(identity=None)¶
return zmq Socket connected to the StdIn channel
- connection_file¶
A trait for unicode strings.
- context¶
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
- control_port¶
An int trait.
- property cross_validation_lock¶
A contextmanager for running a block with our cross validation lock set to True.
At the end of the block, the lock’s value is restored to its value prior to entering the block.
- customEvent(self, QEvent)¶
- data_dir¶
A trait for unicode strings.
- deleteLater(self)¶
- destroyed¶
destroyed(self, object: QObject = None) [signal]
- disconnect(QMetaObject.Connection) bool ¶
- disconnect(self) None
- disconnectNotify(self, QMetaMethod)¶
- dumpObjectInfo(self)¶
- dumpObjectTree(self)¶
- dynamicPropertyNames(self) List[QByteArray] ¶
- event(self, QEvent) bool ¶
- eventFilter(self, QObject, QEvent) bool ¶
- findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject ¶
- findChild(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject
- findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject] ¶
- findChildren(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
- finish_shutdown(waittime=None, pollinterval=0.1)¶
Wait for kernel shutdown, then kill process if it doesn’t shutdown.
This does not send shutdown requests - use
request_shutdown()
first.
- format_kernel_cmd(extra_arguments=None)¶
replace templated args (e.g. {connection_file})
- get_connection_info(session=False)¶
Return the connection info as a dict
- sessionbool [default: False]
If True, return our session object will be included in the connection info. If False (default), the configuration parameters of our session object will be included, rather than the session object itself.
- connect_infodict
dictionary of connection information.
- property has_kernel¶
Has a kernel been started that we are managing.
- has_trait(name)¶
Returns True if the object has a trait with the specified name.
- hb_port¶
An int trait.
- hold_trait_notifications()¶
Context manager for bundling trait change notifications and cross validation.
Use this when doing multiple trait assignments (init, config), to avoid race conditions in trait notifiers requesting other trait values. All trait notifications will fire after all values have been assigned.
- inherits(self, str) bool ¶
- installEventFilter(self, QObject)¶
- interrupt_kernel()¶
Interrupts the kernel by sending it a signal.
Unlike
signal_kernel
, this operation is well supported on all platforms.
- iopub_port¶
An int trait.
- ip¶
A trait for unicode strings.
- property ipykernel¶
- isSignalConnected(self, QMetaMethod) bool ¶
- isWidgetType(self) bool ¶
- isWindowType(self) bool ¶
- is_alive()¶
Is the kernel process still running?
- kernel¶
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
- kernel_cmd¶
An instance of a Python list.
- kernel_name¶
A trait for unicode strings.
- kernel_restarted¶
- property kernel_spec¶
- kernel_spec_manager¶
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
- killTimer(self, int)¶
- load_connection_file(connection_file=None)¶
Load connection info from JSON dict in self.connection_file.
- connection_file: unicode, optional
Path to connection file to load. If unspecified, use self.connection_file
- load_connection_info(info)¶
Load connection info from a dict containing connection info.
Typically this data comes from a connection file and is called by load_connection_file.
- info: dict
Dictionary containing connection_info. See the connection_file spec for details.
- log¶
A trait which allows any value.
- metaObject(self) QMetaObject ¶
- moveToThread(self, QThread)¶
- notify_change(change)¶
Notify observers of a change event
- objectName(self) str ¶
- objectNameChanged¶
objectNameChanged(self, str) [signal]
- observe(handler, names=traitlets.All, type='change')¶
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
- handlercallable
A callable that is called when a trait changes. Its signature should be
handler(change)
, wherechange
is a dictionary. The change dictionary at least holds a ‘type’ key. *type
: the type of notification. Other keys may be passed depending on the value of ‘type’. In the case where type is ‘change’, we also have the following keys: *owner
: the HasTraits instance *old
: the old value of the modified trait attribute *new
: the new value of the modified trait attribute *name
: the name of the modified trait attribute.- nameslist, str, All
If names is All, the handler will apply to all traits. If a list of str, handler will apply to all names in the list. If a str, the handler will apply just to that name.
- typestr, All (default: ‘change’)
The type of notification to filter by. If equal to All, then all notifications are passed to the observe handler.
- on_trait_change(handler=None, name=None, remove=False)¶
DEPRECATED: Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
If
remove
is True andhandler
is not specified, all change handlers for the specified name are uninstalled.- handlercallable, None
A callable that is called when a trait changes. Its signature can be handler(), handler(name), handler(name, new), handler(name, old, new), or handler(name, old, new, self).
- namelist, str, None
If None, the handler will apply to all traits. If a list of str, handler will apply to all names in the list. If a str, the handler will apply just to that name.
- removebool
If False (the default), then install the handler. If True then unintall it.
- parent¶
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
- property ports¶
- post_start_kernel(**kw)¶
- pre_start_kernel(**kw)¶
Prepares a kernel for startup in a separate process.
If random ports (port=0) are being used, this method must be called before the channels are created.
**kw
optionalkeyword arguments that are passed down to build the kernel_cmd and launching the kernel (e.g. Popen kwargs).
- property(self, str) Any ¶
- pyqtConfigure(...)¶
Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.
- receivers(self, PYQT_SIGNAL) int ¶
- removeEventFilter(self, QObject)¶
- remove_restart_callback(callback, event='restart')¶
unregister a callback to be called when a kernel is restarted
- request_shutdown(restart=False)¶
Send a shutdown request via control channel
- restart_kernel(now=False, **kwds)¶
Restarts a kernel with the arguments that were used to launch it.
- nowbool, optional
If True, the kernel is forcefully restarted immediately, without having a chance to do any cleanup action. Otherwise the kernel is given 1s to clean up before a forceful restart is issued.
In all cases the kernel is restarted, the only difference is whether it is given a chance to perform a clean shutdown or not.
- newportsbool, optional
If the old kernel was launched with random ports, this flag decides whether the same ports and connection file will be used again. If False, the same ports and connection file are used. This is the default. If True, new random port numbers are chosen and a new connection file is written. It is still possible that the newly chosen random port numbers happen to be the same as the old ones.
**kw
optionalAny options specified here will overwrite those used to launch the kernel.
- classmethod section_names()¶
return section names as a list
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- session¶
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
- setObjectName(self, str)¶
- setParent(self, QObject)¶
- setProperty(self, str, Any) bool ¶
- set_trait(name, value)¶
Forcibly sets trait attribute, including read-only attributes.
- setup_instance(**kwargs)¶
This is called before self.__init__ is called.
- shell_port¶
An int trait.
- shutdown_kernel()¶
Attempts to stop the kernel process cleanly.
This attempts to shutdown the kernels cleanly by:
Sending it a shutdown message over the control channel.
If that fails, the kernel is shutdown forcibly by sending it a signal.
- nowbool
Should the kernel be forcible killed now. This skips the first, nice shutdown attempt.
- restart: bool
Will this kernel be restarted after it is shutdown. When this is True, connection files will not be cleaned up.
- shutdown_wait_time¶
A float trait.
- signal_kernel(signum)¶
Sends a signal to the process group of the kernel (this usually includes the kernel and any subprocesses spawned by the kernel).
Note that since only SIGTERM is supported on Windows, this function is only useful on Unix systems.
- signalsBlocked(self) bool ¶
- startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) int ¶
- start_restarter()¶
- staticMetaObject = <PyQt5.QtCore.QMetaObject object>¶
- stdin_port¶
An int trait.
- stop_restarter()¶
- thread(self) QThread ¶
- timerEvent(self, QTimerEvent)¶
- tr(self, str, disambiguation: str = None, n: int = - 1) str ¶
- trait_defaults(*names, **metadata)¶
Return a trait’s default value or a dictionary of them
Dynamically generated default values may depend on the current state of the object.
- classmethod trait_events(name=None)¶
Get a
dict
of all the event handlers of this class.- namestr (default: None)
The name of a trait of this class. If name is
None
then all the event handlers of this class will be returned instead.
The event handlers associated with a trait name, or all event handlers.
- trait_has_value(name)¶
Returns True if the specified trait has a value.
This will return false even if
getattr
would return a dynamically generated default value. These default values will be recognized as existing only after they have been generated.Example
class MyClass(HasTraits): i = Int() mc = MyClass() assert not mc.trait_has_value("i") mc.i # generates a default value assert mc.trait_has_value("i")
- trait_metadata(traitname, key, default=None)¶
Get metadata values for trait by key.
- trait_names(**metadata)¶
Get a list of all the names of this class’ traits.
- trait_values(**metadata)¶
A
dict
of trait names and their values.The metadata kwargs allow functions to be passed in which filter traits based on metadata values. The functions should take a single value as an argument and return a boolean. If any function returns False, then the trait is not included in the output. If a metadata key doesn’t exist, None will be passed to the function.
A
dict
of trait names and their values.Trait values are retrieved via
getattr
, any exceptions raised by traits or the operations they may trigger will result in the absence of a trait value in the resultdict
.
- traits(**metadata)¶
Get a
dict
of all the traits of this class. The dictionary is keyed on the name and the values are the TraitType objects.The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
The metadata kwargs allow functions to be passed in which filter traits based on metadata values. The functions should take a single value as an argument and return a boolean. If any function returns False, then the trait is not included in the output. If a metadata key doesn’t exist, None will be passed to the function.
- transport¶
An enum of strings where the case should be ignored.
- unobserve(handler, names=traitlets.All, type='change')¶
Remove a trait change handler.
This is used to unregister handlers to trait change notifications.
- handlercallable
The callable called when a trait attribute changes.
- nameslist, str, All (default: All)
The names of the traits for which the specified handler should be uninstalled. If names is All, the specified handler is uninstalled from the list of notifiers corresponding to all changes.
- typestr or All (default: ‘change’)
The type of notification to filter by. If All, the specified handler is uninstalled from the list of notifiers corresponding to all types.
- unobserve_all(name=traitlets.All)¶
Remove trait change handlers of any type for the specified name. If name is not specified, removes all trait notifiers.
- update_config(config)¶
Update config and load the new values
- write_connection_file()¶
Write connection info to JSON dict in self.connection_file.