schrodinger.application.job_monitor.job_monitor_file_browser module

schrodinger.application.job_monitor.job_monitor_file_browser.normalize_and_join_paths(*paths)

Normalize and join paths.

Parameters

paths (Iterable[str or os.PathLike]) – File paths to normalize and join.

class schrodinger.application.job_monitor.job_monitor_file_browser.JobMonitorFileBrowser(*args, **kwargs)

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

The file browser is designed to have a combobox which contains a list of files, and a text edit field to view them. Theoretically, the widget that creates this should only be passing in valid files, but this dialog will have a spot for error messages if the file 1) cant be found or 2) is not a text file

Variables

updateStatusBar (QtCore.pyqtSignal) – a signal to update the status of job file being viewed currently.

ui_module = <module 'schrodinger.application.job_monitor.file_browser_ui' from '/scr/buildbot/savedbuilds/2024-2/NB/build-134/internal/lib/python3.11/site-packages/schrodinger/application/job_monitor/file_browser_ui.py'>
model_class

alias of schrodinger.application.job_monitor.job_monitor_models.JobModel

updateStatusBar

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.

initSetUp()

Creates widget from ui and stores it ui_widget.

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

defineMappings()

Override this in the subclass to define mappings. Should return a list of tuples [(<target>, <param>)]. Targets can be:

  1. a basic widget, like QLineEdit or QComboBox

  2. a custom object that inherits MapperMixin or TargetMixin

  3. a TargetSpec instance

  4. a slot

For common widgets, standard signals and getter/setter methods will be used, as defined in mappers._get_default_access_names().

For more fine-grained custom control, instantiate a TargetSpec object, which allows custom setters, getters, and signals to be specified.

Supplying a slot as the first element of the tuple is equivalent to providing TargetSpec(slot=my_slot).

Note that all target slots are triggered on setModel() as well as in response to the specified signal.

The param is an abstract param reference, e.g. MyModel.my_param.

Example:

def defineMappings(self):
    combo = self.style_combo
    return [(self.name_le, MyModel.name),
            (TargetSpec(combo,
                    getter=combo.currentText,
                    setter=combo.setCurrentText), MyModel.style),
            (self.coord_widget, MyModel.coord),
            (self._onASLTextChanged, MyModel.asl_text)]
getSignalsAndSlots(model)

Override this method to specify signal and slot pairs that need to be connected/disconnected whenever the model instance is switched using setModel. The model instance is provided as an argument so that instance-specific signals can be used, but any pairs of signals and slots may be returned from this method.

Returns

a list of 2-tuples where each tuple is a signal, slot pair

onFileListChanged()
showEvent(self, a0: QShowEvent)
setFileList(file_list)

Set the list of files in the combo box. Attempt to retain current selection, if possible. :param file_list: A list of file paths :type file_list: list[str]

addFile(file_name)

Add a new file to the combo box. The visible text is the basename, and the combo box data is the full path. :param file_name: the full path to the file :type file_name: str

getCurrentFile()

Return the path of the current selected file relative to the job directory. :return: Current file path. :rtype: str

setCurrentFile(file_name)

Set the current combo box selection to be the given file name. :param file_name: The full path of the file :type file_name: str

onFileIndexChanged()

When the chosen file changes in the combo box, set the contents of the file to the text edit.

loadCurrentFile()

Load the currently selected file into the text edit

appendFileContent(text)

Append the latest content for the file being viewed currently to the textedit.

setBrowserText(text, rich_text=False)

Load the given text into the text edit while maintaining the vertical scroll position. :param text: Plain text to be loaded into the text edit :type text: str :param rich_text: Whether rich text. :type rich_text: bool

clearBrowserText()
moveBrowserToBottom()

Move the text edit to the bottom of the file. This should be called whenever viewing a new file, but not when the user is already viewing the file.

TODO: Ideally, we want this method to move the scroll bar to the bottom via the scroll bar object. This doesnt work when text is first loaded into the text edit though, because the scrollbar hasnt been updated to reflect the new text

maintainFileChoice()

Maintain file choice in the file combo box.

maintainVerticalScroll()

Maintain vertical scroll position in the text edit

class schrodinger.application.job_monitor.job_monitor_file_browser.SubprocessStdOutStreamer

Bases: PyQt6.QtCore.QObject

This class provides the support to stream files for data continuously as and when new data is flushed into the file.

Variables
  • textAppended (QtCore.pyqtSignal) – a signal emitted when there’s new data in the file being streamed.

  • streamingDone (QtCore.pyqtSignal) – a signal emitted to indicate that the streaming being run got finished.

textAppended

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.

streamingDone

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__()
startStreaming(cmd)
Parameters

cmd (list[str]) – command-line arguments for the streaming process

stopStreaming()
isStreamingRunning()