schrodinger.ui.qt.messagebox module

schrodinger.ui.qt.messagebox.show_message_box(parent, text, title, save_response_key=None, icon=None, detailed_text=None)

Shows a general popup message box. For parameter documentation see MessageBox.

schrodinger.ui.qt.messagebox.show_warning(parent, text, title='Warning', save_response_key=None, detailed_text=None)

Shows a popup warning message box. For parameter documentation see MessageBox.

schrodinger.ui.qt.messagebox.show_error(parent, text, title='Error', save_response_key=None, detailed_text=None)

Shows a popup error message box. For parameter documentation see MessageBox.

schrodinger.ui.qt.messagebox.show_info(parent, text, title='Info', save_response_key=None)

Shows a popup information message box. For parameter documentation see MessageBox.

schrodinger.ui.qt.messagebox.show_question(parent, text, title='Question', save_response_key=None, yes_text='OK', no_text=None, add_cancel_btn=True, more_btns_list=None, default_btn_txt=<object object>, icon=Icon.Question)

Shows a popup question message box. For parameter documentation see QuestionMessageBox.

schrodinger.ui.qt.messagebox.show_product_missing_info(parent=None)

Show the information about getting license and how to download the product, when the product is missing in the installation.

class schrodinger.ui.qt.messagebox.MessageBox(parent=None, title='', text='', save_response_key=None, add_prefix_to_key=True, icon=None)

Bases: PyQt6.QtWidgets.QMessageBox

A modal dialog for presenting a text message to the user. Provides an optional “Do not show this again” checkbox, which stores a value in the preferences.

TYPED_RESPONSES = {'FALSE_RESPONSE': False, 'NONE_RESPONSE': None, 'TRUE_RESPONSE': True}
STRINGED_RESPONSES = {True: 'TRUE_RESPONSE', False: 'FALSE_RESPONSE', None: 'NONE_RESPONSE'}
__init__(parent=None, title='', text='', save_response_key=None, add_prefix_to_key=True, icon=None)
Parameters
  • parent (QtWidgets.QWidget) – the parent widget

  • title (str) – the dialog title

  • text (str) – the message

  • save_response_key (str or NoneType) –

    When set, message box will show a “Do not show again” checkbox. The value provided will be used to generate a preference key. See add_prefix_to_key for more information on how the preference key is generated.

    The preference is only stored if the checkbox is checked. If it is unchecked, instead of storing a False, no preference is stored at all. This allows subclasses to make the distinction between saving a False response and not saving the response at all.

  • add_prefix_to_key

    Whether to prepend some basic context to the response_key (module_name, class_name`*`) in order to unique-ify the key. If set to False, the value provided for save_response_key will be used as-is, and the user is responsible for ensuring the key does not clash with any other preference keys.

    * If a parent is set for the messagebox, then the class name of parent will be used for class_name, otherwise the class name of the message box will be used.

  • icon – the icon to show - see QMessageBox documentation for details

setWindowTitle(self, title: str)
exec(self) int
forgetResponse()
getResponse()

Override this method to specify the nature of the “response” to save. Here it is simply True, to indicate that the “Do not show this again” checkbox has been checked.

class schrodinger.ui.qt.messagebox.QuestionMessageBox(yes_text='Yes', no_text='No', add_cancel_btn=False, more_btns_list=None, default_btn_txt=<object object>, icon=Icon.Question, *args, **kwargs)

Bases: schrodinger.ui.qt.messagebox.MessageBox

Simple popup dialog for asking a question to the user which can be answered by clicking on a button. The button configuration is customizable. By default, the choices are Yes and No, which return True and False, respectively. The text for these two buttons may be modified via the yes_text and no_text arguments (e.g. Continue/Abort, Save/Discard).

The optional “Cancel” button returns a None return value, and a “Cancel” choice is never saved, irrespective of the checkbox state.

Additional buttons can be added via the more_btns_list. These additional buttons will be placed between the standard yes and no buttons.

The yes and no buttons can also be omitted by passing in None for yes_text or no_text.

__init__(yes_text='Yes', no_text='No', add_cancel_btn=False, more_btns_list=None, default_btn_txt=<object object>, icon=Icon.Question, *args, **kwargs)
Parameters
  • yes_text (str) – The text to show on the yes button. If None is passed in, the yes button will not be added. The question box return True when the yes button is clicked. If the yes button text is changed from “Yes” to something else, consider updating the default_btn option to match.

  • add_cancel_btn (bool) – Set to true to add a “Cancel” button. The cancel button differs from the “No” button only in that the response will not be saved, irrespective of the save_response checkbox state.

  • more_btns_list (list of str) – a list of text for extra buttons to be included between the yes and no buttons. If any of these buttons are clicked, the return value will simply be the button text. Note that this means that if the response is to be saved, the button text is the value that is saved.

  • default_btn_txt (str) – the text for the default button (selected when user presses Enter on the keyboard). Set to None for no default button.

  • icon (int) – Icon for this message box.

getResponse()

Provides the return value for the user’s choice. Also provides the value to save if the “Remember my choice” option is checked.