schrodinger.ui.qt.appframework2.maestro_callback module

A module for decorating AF2 methods as Maestro callbacks. The decorators may be used outside of Maestro, but they will have no effect.

class schrodinger.ui.qt.appframework2.maestro_callback.CallbackInfo(add, remove, maestro_check_callback)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

add

Alias for field number 0

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

maestro_check_callback

Alias for field number 2

remove

Alias for field number 1

schrodinger.ui.qt.appframework2.maestro_callback.project_changed(func)

A decorator for methods that should be called when the project updates but not when the project closes. Decorated methods that take one argument will be called with the active project (schrodinger.project.Project). Decorated methods may also take no arguments.

Note

Decorated methods will not be called when the panel is closed. If a callback occurred while the panel was closed, then the decorated method will be called when the panel is re-opened.

schrodinger.ui.qt.appframework2.maestro_callback.project_close(func)

A decorator for methods that should be called immediately before the project closes. Decorated methods will be called with no arguments.

Note

Decorated methods will not be called when the panel is closed. If a callback occurred while the panel was closed, then the decorated method will be called when the panel is re-opened.

schrodinger.ui.qt.appframework2.maestro_callback.project_updated(func)

A decorator for methods that should be called when the project updates, regardless of whether the project was closed. Decorated methods will be called with no arguments. Consider using project_changed and/or project_close instead.

Note

Decorated methods will not be called when the panel is closed. If a callback occurred while the panel was closed, then the decorated method will be called when the panel is re-opened.

schrodinger.ui.qt.appframework2.maestro_callback.workspace_changed(func)

A decorator for methods that should be called when the workspace changes, regardless of whether the workspace change was triggered by a project closure. Decorated methods will be called with the what changed flag from Maestro.

Note

Decorated methods will not be called when the panel is closed. If a callback occurred while the panel was closed, then the decorated method will be called when the panel is re-opened.

schrodinger.ui.qt.appframework2.maestro_callback.workspace_changed_active_project(func)

A decorator for methods that should be called when the workspace changes, but not when the workspace change was triggered by a project closure. Decorated methods that take one argument will be called with:

  • The what changed flag from Maestro

Decorated methods that take two arguments will be called with:

  • The what changed flag from Maestro

  • The active project (schrodinger.project.Project)

Note

Decorated methods will not be called when the panel is closed. If a callback occurred while the panel was closed, then the decorated method will be called when the panel is re-opened.

schrodinger.ui.qt.appframework2.maestro_callback.entries_included(func)

A decorator for methods that should be called when an entry enters the Workspace

The decorated method is passed a set of newly included entries when the Workspace changes

Note

Decorated methods will not be called when the panel is closed. If a callback occurred while the panel was closed, then the decorated method will be called when the panel is re-opened.

schrodinger.ui.qt.appframework2.maestro_callback.entries_excluded(func)

A decorator for methods that should be called when an entry exits the Workspace

The decorated method is passed a set of newly excluded entries when the Workspace changes

Note

Decorated methods will not be called when the panel is closed. If a callback occurred while the panel was closed, then the decorated method will be called when the panel is re-opened.

class schrodinger.ui.qt.appframework2.maestro_callback.AbstractMaestroCallbackMixin(*args, **kwargs)

Bases: object

A mixin that allows the above decorators to be used for maestro callbacks. Any callbacks that occur while the panel is closed will be monitored and the appropriate callback methods will be called when the panel is re-opened. This class may only be mixed in to PyQt5.QtWidgets.QWidget`s.  Note this widget should not be used directly.  Instead, use `MaestroCallbackMixin or MaestroCallbackWidgetMixin.

Variables

IGNORE_DELAYED_CALLBACKS (bool) – Whether or not delayed Maestro callbacks (e.g. those triggered when a panel is closed) should be ignored by the panel.

IGNORE_DELAYED_CALLBACKS = False
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."
__init__(*args, **kwargs)
buildCallbackDicts()

Create a dictionary of all methods that have a maestro_callback decorator.

class schrodinger.ui.qt.appframework2.maestro_callback.MaestroCallbackMixin(*args, **kwargs)

Bases: schrodinger.ui.qt.appframework2.maestro_callback.AbstractMaestroCallbackMixin

A mixin that allows the maestro callback decorators to be used in a panel class or in any QtWidgets.QWidget that will be its own window.

showEvent(event)
closeEvent(event)
IGNORE_DELAYED_CALLBACKS = False
__init__(*args, **kwargs)
buildCallbackDicts()

Create a dictionary of all methods that have a maestro_callback decorator.

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."
class schrodinger.ui.qt.appframework2.maestro_callback.MaestroCallbackWidgetMixin(*args, **kwargs)

Bases: schrodinger.ui.qt.appframework2.maestro_callback.AbstractMaestroCallbackMixin

A mixin that allows the maestro callback decorators to be used on a widget that will be part of a panel or part of a QtWidgets.QWidget.

__init__(*args, **kwargs)
eventFilter(obj, event)

Respond to the window being shown or closed.

See QObject.eventFilter documentation for argument documentation.

IGNORE_DELAYED_CALLBACKS = False
buildCallbackDicts()

Create a dictionary of all methods that have a maestro_callback decorator.

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."
class schrodinger.ui.qt.appframework2.maestro_callback.MaestroCallbackModelMixin(*args, **kwargs)

Bases: schrodinger.ui.qt.appframework2.maestro_callback.MaestroCallbackWidgetMixin

A mixin that allows the maestro callback decorators to be used on a QtCore.QAbstractItemModel. Any model that uses this mixin must have a QtWidgets.QWidget parent.

window()
IGNORE_DELAYED_CALLBACKS = False
__init__(*args, **kwargs)
buildCallbackDicts()

Create a dictionary of all methods that have a maestro_callback decorator.

eventFilter(obj, event)

Respond to the window being shown or closed.

See QObject.eventFilter documentation for argument documentation.

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."
class schrodinger.ui.qt.appframework2.maestro_callback.MonitoredCallbacks

Bases: object

Data describing which callbacks have occurred since a panel was closed

__init__()
reset()
class schrodinger.ui.qt.appframework2.maestro_callback.CallbackMonitor

Bases: object

Monitoring for Maestro callbacks that occur while a panel is closed

__init__()
startMonitoring()

Start monitoring all callbacks

stopMonitoring()

Stop monitoring all callbacks

Returns

The callbacks that have occurred since monitoring was started

Return type

MonitoredCallbacks

class schrodinger.ui.qt.appframework2.maestro_callback.InclusionStateMixin(*args, **kwargs)

Bases: object

A mixin for AF2 panels that emits a single signal when an entry is included or excluded from the workspace.

Only one signal is emitted even if multiple inclusions/exclusions are happening - such as when including a new entry excludes the current entry.

The signal is emitted only when the PT state is stable - ie. checking if entries are included or not works fine. This is accomplished by emitting the signal in a different thread.

The signal does not contain information about what entries changed state or what entries are included.

The signal obeys the same rules as the normal callbacks do - it is not emitted if the panel is closed, but is emitted upon panel show if a state changed while the panel is hidden

Inclusion/Exclusion actions generated by the inclusionStateChanged slot will be ignored and will not generate a new signal.

inclusionStateChanged
__init__(*args, **kwargs)

Create an InclusionStateMixin instance