schrodinger.application.matsci.appbase module

Module for customizing af2 app features

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.appbase.MatSciAppMixin

Bases: object

General mixin for MatSci panels

WAM_LOAD_SELECTED = 'selected_entries'
WAM_LOAD_INCLUDED = 'included_entry'
initMixinOptions(wam_input_state=None, wam_load_function=None, wam_run_singleton=True, wam_set_panel_input_state=True)

Initialize the options for the mixin

Parameters
  • wam_input_state (str) – The input state to use to get the WAM entries

  • wam_load_function (callable) – Function that takes no arguments and loads the entries into the panel.

  • wam_run_singleton (bool) – Whether the panel singleton should be run (i.e. displayed) or not.

  • wam_set_panel_input_state (bool) – Whether to set panel’s input_selector state to the corresponding wam_input_state

classmethod panel(*entry_ids)

Launch a singleton instance of the panel and load entries if applicable. See af2.App.panel for more information.

Parameters

entry_ids (tuple) – Entry ids to load into the panel

Raises

RuntimeError – If the input state is invalid

class schrodinger.application.matsci.appbase.ProcessPtStructuresApp(**kwargs)

Bases: schrodinger.ui.qt.appframework2.af2.App

Base class for panels that process pt structures and either replace them or creates new entries

REPLACE_ENTRIES = 'Replace current entries'
NEW_ENTRIES = 'Create new entries'
RUN_BUTTON_TEXT = 'Run'
TEMP_DIR = '/scr/buildbot'
DEFAULT_GROUP_NAME = 'new_structures'
setPanelOptions()

Override the generic parent class to set panel options

layOut()

Lay out the widgets for the panel

outputTypeChanged()

React to a change in output type

myStartMethod()

Process the selected or included rows’ structures

setUp()

Make any preparations required for processing structures

processStructure(struct)

Process each structure. Should be implemented in derived classes.

Parameters

struct (structure.Structure) – The structure to process

wrapUp()

Wrap up processing the structures

reset()

Reset the panel

exception schrodinger.application.matsci.appbase.WorkflowError

Bases: ValueError

Custom exception for when the workflow should be stopped

class schrodinger.application.matsci.appbase.BaseAnalysisGui

Bases: object

Base class for other mixin gui class in the module

LIC_TOKEN = 94
getIncludedEntry()

Get included entry in maestro

Return schrodinger.structure.Structureschrodinger.structure.Structure

Structure in workspace

resetPanel()

Reset the panel variables and widgets set by this mixin

toggleStateMain(state)

Class to enable/disable widgets in panel when structure is added/removed.

Parameters

state (bool) – If True it will enable the panel and will disable if false

Raises

NotImplementedError – Will raise error if it is not overwritten.

class schrodinger.application.matsci.appbase.StructureLoadButton(layout, command, label='Load from Workspace', no_struct_label='No structure loaded')

Bases: schrodinger.ui.qt.swidgets.SPushButton

Class to load workspace structure to the panel

LOAD_FROM_WORKSPACE = 'Load from Workspace'
NO_STRUCT_LABEL = 'No structure loaded'
MAX_TITLE_LENGTH = 20
__init__(layout, command, label='Load from Workspace', no_struct_label='No structure loaded')

Load structure button along with elided title next to it.

Parameters
  • layout (QLayout) – layout to add the button to

  • command (function) – function to load structure. Function should return structure.

  • label (str) – Label for the structure load button

  • no_struct_label (str) – title when no structure is loaded

loadStruct()

Load structure using the provided command and set the title as label

getElidedTitle(title)

Return right elided string for according to the maximum length

Return str

Will return right elided text for the passed title if longer than the maximum length else will return the title

reset()

Reset the title label

class schrodinger.application.matsci.appbase.ViewerGuiMixin

Bases: schrodinger.application.matsci.appbase.MatSciAppMixin, schrodinger.application.matsci.appbase.BaseAnalysisGui

Class for extension of af2 to add widgets to gui for calculation viewer

addLoadStructButton(layout, file_endings, filename_props=None, files_optional=False)

Load button to load structure from workspace and associated data file

Parameters
  • layout (QLayout) – layout to add the button to

  • file_endings (list) – The strings at the end of the data file paths, including the extensions. Note that this parameter is not ignored if filename_props is given, and must be set to None if only filename_props is intended to be used.

  • filename_props (list) – The structure property which contain data property

  • files_optional (bool) – If data files are optional and if the structure should be loaded in case of no data file or data file property. If True, the structure will be loaded even if no data files are available. If False, raises a warning if data files are not found. Default is False. Note that this does not affect the behavior of setFilesUsingExt or setFilesUsingStProp, so those functions still prompt user with a fileDialog when the data files are not found. If it is desired to not prompt the user, a workaround is to set the file path property to an empty string.

Raises
  • NotImplementedError – If panel_id was not set in the __init__ before adding the load structure button

  • ValueError – If filename_props is not None and the length of file endings is not equal to it.

setFilesUsingExt(path)

Sets the data files using extension

Parameters

path (str) – The source/job path

setFilesUsingStProp(path)

Sets the data files using structure properties

Parameters

path (str) – The source/job path

loadData()

Class to load data to the panel

Raises

NotImplementedError – Will raise error if it is not overwritten.

Return type

bool or None

Returns

False means the setup failed. True or None means it succeeded.

resetPanel()

Reset the panel variables and widgets set by this mixin