schrodinger.ui.qt.standard.icons.icons module

Module to access all Schrodinger standard icons filepaths. Instructions on using, adding, and editing icons can be found below.

Using standard icons

Standard icon filepaths are exposed as constants. To browse the available icons and what constants they correspond to, run:

$SCHRODINGER/run catalog_gui.py

Once an icon of interest has been identified, import icons.py and access the icon’s path. Example:

from schrodinger.ui.qt.standard.icons import icons
from schrodinger.Qt import QtGui
ok_lb_icon = QtGui.QIcon(icons.OK_LB)

Adding standard icons

  1. If the new icon belongs to an existing family (e.g. a new icon state

    variation), skip to step 2.

    If the new icon does not belong to an existing family, add a blank row to the metadata csv (schrodinger/ui/qt/standard/icons/icon_data/icon_data.csv) and fill in the columns.

    Action: The action for the icon (UX should provide) Keywords: Any words not already present in Action that would be helpful

    to search for that icon. Should be space-separated. (UX can provide, but devs can also supplement with whatever seems helpful)

    Directory name: The name of the directory where all icons in this family

    will be stored. This should pretty much be the same as the action in most cases but lowercase and hyphen-separated. (UX won’t provide. Use best judgment to make most concise name possible)

    Original File Name: Copy/paste the file name that UX gives you. This

    helps map the new filenames to the old ones that UX has in case UX needs to know which is which.

    Current or Proposed Symbol: What the symbol looks like (Include if UX

    provides, but not essential)

  2. Rename the icon file according to the naming convention outlined below in

    “File structure”. If this is a completely new family of icons, also create the icon subdirectory, as outlined in “File structure”.

  3. Place the icon into the appropriate icon subdirectory.

  4. Run unit tests. If test_get_icon_metadata_from_csv() fails, run

    test_identify_undetected_files() (skipped by default) to identify which icon files are not being registered by the module. Most likely there is misspelling in the metadata csv, the directory name, or the file name.

  5. Confirm the icon appears as expected in the icon viewer with the desired

    search terms. If not, edit the metadata csv as needed.

  6. Commit changes.

Editing standard icons

  1. Edit the metadata csv as needed. See 1) from “Adding standard icons” for

    information on each of the csv columns.

  2. Perform 4) - 6) from “Adding standard icons”

File structure

The following must be true in order for this to work properly.

  1. An icon metadata csv must be present at

    schrodinger/ui/qt/standard/icons/icon_data/icon_data.csv.

  2. The first four columns of the CSV must be ‘Variable name’, ‘Action’,

    ‘Keywords’, and ‘Directory name’ in that order. Other columns are ignored, so they can contain other any information helpful to whoever is editing the CSV.

  3. Each row of the CSV corresponds to only the default version of an icon.

  4. The icons directory MUST follow a particular structure:

    - icons
    | - <icon-dir-name-1>
      | - <icon-dir-name-1>_<icon_state_information_1>.png
      | - <icon-dir-name-1>_<icon_state_information_2>.png
      | - ...
      | - <icon-dir-name-1>_<icon_state_information_N>.png
    | - <icon-dir-name-2>
      | - etc.
    
    Note that each icon in an icon subdirectory must have a base name equal
    to the directory name. Dashes are used in place of spaces for the dir name.
    Each icon filename then has additional information denoting its icon state
    and is separated by underscores. This naming convention helps us identify
    the icon family name from just the icon's file name.
    
    Here's an example using the collapse-chevron-vert subdirectory::
    
    | - collapse-chevron-vert
      | - collapse-chevron-vert_db_d.png
      | - collapse-chevron-vert_db_h.png
      | - collapse-chevron-vert_db.png
      | - collapse-chevron-vert_lb_d.png
      | - collapse-chevron-vert_lb_h.png
      | - collapse-chevron-vert_lb.png
    
  5. See LEGEND_TEXT below for a description of the different icon suffixes.

class schrodinger.ui.qt.standard.icons.icons.IconMetadata(*args, _param_type=<object object>, **kwargs)[source]

Bases: schrodinger.models.parameters.CompoundParam

Param to store the metadata for a given icon file.

var_name: str

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
action: str

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
filepath: str

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
filter_terms: str

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
DataClass

This class can be used to declare a public attribute on a CompoundParam. Declared public attributes can be used without error.

Example usage:

class Coord(CompoundParam):
    x: int
    y: int
    note = NonParamAttribute()

coord = Coord()
coord.note = "hello" # No error
__init__(default_value=<object object>, _param_type=<object object>, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

actionChanged
actionReplaced
classmethod addSubParam(name, param, update_owner=True)
blockSignals(self, bool) → bool
block_signal_propagation()
childEvent(self, QChildEvent)
children(self) → List[QObject]
classmethod configureParam()

Override this class method to set up the abstract param class (e.g. setParamReference on child params.)

connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
classmethod defaultValue(*args, **kwargs)
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(self)
disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) → List[QByteArray]
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
filepathChanged
filepathReplaced
filter_termsChanged
filter_termsReplaced
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]

classmethod fromJson(json_obj)

A factory method which constructs a new object from a given dict loaded from a json string or file.

Parameters

json_obj (dict) – A json-loaded dictionary to create an object from.

Returns

An instance of this class.

Return type

cls

classmethod fromJsonImplementation(json_dict)

Sets the value of this compound param value object from a JSON dict.

Warning

This should never be called directly.

getAbstractParam(*args, **kwargs)
classmethod getJsonBlacklist()

Override to customize what params are serialized.

Implementations should return a list of abstract params that should be omitted from serialization.

..NOTE

Returned abstract params must be direct child params of cls, e.g. cls.name, not cls.coord.x.

classmethod getParamSignal(*args, **kwargs)
classmethod getParamValue(*args, **kwargs)
classmethod getSubParam(name)

Get the value of a subparam using the string name:

c = Coord()
assert c.getSubParam('x') == 0

Note

Using the string name to access params is generally discouraged, but can be useful for serializing/deserializing param data.

Parameters

name (str) – The name of the subparam to get the value for.

classmethod getSubParams()

Return a dictionary mapping subparam names to their values.

getTypeHint()
get_version()

Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.

inherits(self, str) → bool
initAbstract()
initConcrete()

Override to customize initialization of concrete params.

initializeValue()

Override to dynamically set up the default value of the param. Useful for default values that are determined at runtime. This is called any time the param is reset.

installEventFilter(self, QObject)
classmethod isAbstract()

Whether the param is an “abstract” param.

isDefault(*args, **kwargs)
isSignalConnected(self, QMetaMethod) → bool
isWidgetType(self) → bool
isWindowType(self) → bool
killTimer(self, int)
metaObject(self) → QMetaObject
moveToThread(self, QThread)
objectName(self) → str
objectNameChanged

objectNameChanged(self, str) [signal]

classmethod owner()

Get the owner of the param:

# Can be called on an abstract param:
assert Coord.x.owner() == Coord

# ...or on an instance of a CompoundParam
a = Atom()
assert a.coord.owner() == a
classmethod ownerChain()

Returns a list of param owners starting from the toplevel param and ending with self. Examples:

foo.bar.atom.coord.ownerChain() will return [foo, bar, atom, coord] where every item is a concrete param.

Foo.bar.atom.coord.x.ownerChain() will return [Foo, Foo.bar, Foo.atom.coord, Foo.atom.coord.x] where every item is an abstract params.

classmethod paramName()

Get the name of the param:

# Can be called on an abstract param:
print(Coord.x.paramName()) # 'x'

# ...or on an instance of a CompoundParam
a = Atom()
a.coord.paramName() # 'coord'
parent(self) → QObject
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)
reset(*args, **kwargs)
sender(self) → QObject
senderSignalIndex(self) → int
setObjectName(self, str)
classmethod setParamValue(*args, **kwargs)
setParent(self, QObject)
setProperty(self, str, Any) → bool
classmethod setReference(param1, param2)

Call this class method from configureParam to indicate that two params should be kept in sync. The initial values will start with the default value of param1. Example:

class Square(CompoundParam):
    width: float = 5
    height: float = 10

    @classmethod
    def configureParam(cls):
        super().configureParam()
        cls.setReference(cls.width, cls.height)

square = Square()
assert square.width == square.height == 5 # Default value of width
                                          # takes priority
square.height = 7
assert square.width == square.height == 7
square.width = 6
assert square.width == square.height == 6
Parameters
  • param1 – The first abstract param to keep synced

  • param2 – The second abstract param. After instantiation, this param will take on the value of param1.

setValue(*args, **kwargs)
signalsBlocked(self) → bool
skip_eq_check()
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
thread(self) → QThread
timerEvent(self, QTimerEvent)
toDict(*args, **kwargs)
toJson(_mark_version=True)

Create and returns a data structure made up of jsonable items.

Return type

An instance of one the classes from NATIVE_JSON_DATATYPES

toJsonImplementation(*args, **kwargs)

Abstract method that must be defined by all derived classes. Converts an instance of the derived class into a jsonifiable object.

Returns

A dict made up of JSON native datatypes or Jsonable objects. See the link below for a table of such types. https://docs.python.org/2/library/json.html#encoders-and-decoders

tr(self, str, disambiguation: str = None, n: int = - 1) → str
valueChanged
var_nameChanged
var_nameReplaced
schrodinger.ui.qt.standard.icons.icons.get_icon_metadata_from_csv()[source]

Get the icon metadata for all icons files in the icons dir from _ICON_DATA_CSV. Results are stored in a module-level dictionary mapping variable names to the corresponding IconMetadata object.

If the module-level dictionary has already been populated, simply return it without reading the metadata csv again.

Returns

Mapping of icon variable names to their IconMetadata objects

Return type

dict(str: IconMetadata)