schrodinger.ui.qt.directory_selector module

Module containing DirectorySelector. The widget’s directory selection can be obtained by mapping the widget to a param or alternatively by connecting a slot to the directoryChanged signal.

To use without mapping, hook up the directoryChanged signal to a slot that calls DirectorySelector.getDirPath().

class schrodinger.ui.qt.directory_selector.DirectorySelector(parent: Optional[PyQt6.QtWidgets.QWidget] = None, initial_dir: Optional[str] = None)

Bases: schrodinger.models.mappers.TargetMixin, schrodinger.ui.qt.basewidgets.BaseWidget

Widget for showing an entry field and a browse button to let the user specify a single directory.

Variables

directoryChanged (QtCore.pyqtSignal) – Signal emitted when the directory selection changes.

directoryChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

__init__(parent: Optional[PyQt6.QtWidgets.QWidget] = None, initial_dir: Optional[str] = None)
Parameters
  • parent – Parent widget.

  • initial_dir – Initial directory. Default is CWD.

initSetUp()

Creates widget from ui and stores it ui_widget.

Suggested subclass use: create and initialize subwidgets, and connect signals.

initLayOut()

Create a vertical layout for the widget (widget_layout) and populate it with two vertical sub-layouts: main_layout and bottom_layout.

If the user has specified the ui data member, insert the resultant ui_widget into main_layout.

If the widget already has a layout defined, this method will produce a warning (but not a traceback). main_layout and bottom_layout will be inserted into the existing widget layout, which will not be the same as widget_layout. It is therefore recommended that this mixin is used only with widgets that do not already have a layout.

Suggested subclass use: create, initialize, and populate layouts.

setLabelText(text: str)

Set the label text to the left of the line edit.

getDirectoryPath() str

Return the currently selected directory path. Allows access to target

targetGetValue() str

Return the line edit text.

targetSetValue(value: str)

Set the line edit text based for a valid value and emit two signals: targetValueChanged for when this widget mapped to a param, and directoryChanged for when it is not.

Parameters

value – The directory path to set to the line edit.