schrodinger.application.livedesign.ld_base_classes module¶
Base classes used for LiveDesign import/export GUIs.
Copyright Schrödinger, LLC. All rights reserved.
-
class
schrodinger.application.livedesign.ld_base_classes.
LDInputType
¶ Bases:
enum.IntEnum
Enum class corresponding to the options that the user has for selecting a live report. The values assigned to each option corresponds to its index in the
ld_input_combo
combo box.-
Project
= 0¶
-
URL
= 1¶
-
-
class
schrodinger.application.livedesign.ld_base_classes.
SwallowEnterFilter
¶ Bases:
PyQt5.QtCore.QObject
-
eventFilter
(widget, event)¶ Swallow certain key presses so that if the user presses “Return” or “Enter” while
widget
is in focus, the only result will be thatwidget
loses focus, and the key press event will not be propagated.Parameters: - widget (
QtWidgets.QWidget
) – the widget being watched by this event filter - event (
QtCore.QEvent
) – an event
Returns: True
if the event should be ignored,False
otherwiseReturn type: bool
- widget (
-
-
exception
schrodinger.application.livedesign.ld_base_classes.
HandledError
¶ Bases:
Exception
-
class
schrodinger.application.livedesign.ld_base_classes.
ImportExportBasePanel
(*args, **kwargs)¶ Bases:
schrodinger.ui.qt.appframework2.wizards.BaseWizardPanel
Main panel for specifying how to import or export the data to/from LD.
The following signals may be emitted for updating status text and color during export process.
-
statusChanged
¶
-
warningRaised
¶
-
errorRaised
¶
-
questionRaised
¶
-
infoUpdated
¶
-
allow_add_live_reports
= True¶
-
TITLE_BASE
= ''¶
-
initSetUp
()¶ Creates widget from
ui
and stores itui_widget
.Suggested subclass use: create and initialize subwidgets, and connect signals.
-
initSetDefaults
()¶ Set widget to its default state. If the widget uses a model/mapper, it’s preferable to reset the widget state by resetting the model.
-
setLiveReportDefaults
()¶ Reset current live report selection and anything that depends on it.
-
clearLR
()¶ Meant to be called when switching between LD Input combo box options. Resets data entered into the panel so that the source of the LiveReport will be unambiguous.
-
evaluateURL
()¶ Parse the URL in the URL line edit and extract information about the specified Live Report. If it is valid, return the project ID and the LR ID. Otherwise, return
(None, None)
and create a helpful popup.Returns: a tuple containing the project ID and Live Report ID, or else (None, None)
Return type: (int, int)
or(None, None)
-
onURLEntered
()¶ Parse data from the URL line edit and import the specified Live Report column names.
Meant to be called automatically when the user finishes editing in the URL line edit.
-
setupTaskWidget
()¶ Set up the task widget and thread runner.
-
setupStatusBar
()¶ Set up the status bar with the help topic and product for the help icon. A separate parent for the status bar is created so the help dialog is opened correctly.
Note: The help topic is set here so an auto help dialog button isn’t added next to the ‘Back’ button.
-
setupTaskMessagingSignals
()¶ Connect the signals for showing QMessageBoxes to the user or updating the status bar message from processTaskMessage().
-
initLayOut
()¶ See parent class for method documentation.
-
processPrevPanel
(state)¶ This is called in BaseWizardPanel.run method.
Parameters: state ( af2.settings.PanelState
) – State of the previous panel
-
processTaskMessage
(message_type, text, options=None, runner=None)¶ This method is used as a callback to the task runner, and emits signals to interact with the main GUI. Signals are used here, instead of directly interacting with the GUI, which causes threading and parenting issues.
Parameters: - message_type (int) – the type of message being sent
- text (str) – the main text to show the user
- options (dict) – extra options
- runner (
tasks.ThreadRunner
) – Task runner.
-
processSettings
(settings=None, runner=None)¶ See parent class for method documentation.
-
onNoProjectSelected
()¶ Slot invoked when no project is selected in the combobox.
-
onProjectSelected
(proj_name, proj_id)¶ Slot invoked when a project is chosen from combobox.
Parameters: - proj_name (str) – the selected project name
- proj_id (int) – the selected project id
-
loadLiveReports
()¶ Fetch the project’s live reports and load them into the combo box.
-
onLRSortMethodChanged
(sort_value)¶ Store the selected sort method in response to the user selecting a new LiveReport sort method.
Parameters: sort_value – an enum value associated with a sort method
-
onLiveReportSelected
(lr_id)¶ Slot invoked when a Live Report is chosen from the combobox.
Parameters: lr_id (str) – id of current live report chosen in tree view.
-
getUserURL
()¶ Return the text entered into the URL line edit, stripped of whitespace.
Returns: the text in the text box, without bordering whitespace Return type: str
-
getLDInputType
()¶ Return how the user has selected to input their live report selection, whether by selecting a project or entering a URL.
Returns: an enum corresponding to the selected input type Return type: LDInputType
-
reject
()¶ See parent class for more info. Resets the custom LiveReport combo box as the SettingsPanelMixin will not know how to set the default option.
-
run
(prev_panel_state=None)¶ Runs the panel. If the panel is being invoked by clicking “Next” on the previous panel, pass in the previous panel’s state so it can be processed.
Parameters: prev_panel_state (settings.PanelState or None) – the previous panel’s state
-
closeEvent
(event)¶ After the panel is closed, forget that the current live report URL has been used before. This allows the URL to be re-evaluated when the panel is opened again.
-
-
class
schrodinger.application.livedesign.ld_base_classes.
ImportExportThreadRunner
(*args, **kwargs)¶ Bases:
schrodinger.ui.qt.appframework2.tasks.ThreadRunner
-
process_type
= 'import/export'¶
-
use_event_loop
= True¶
-
errorHandler
()¶ A context manager for handling errors - catches a few specific error types, creating an error message as a function of the error type and calling. Reraises HandledError(error_msg) if any errors are caught.
Raise: HandledError if any errors are caught.
-
setErrorStatus
(curr_name, error_msg)¶ Update self.status and self.error with the proper error messages. :param curr_name: the name of the task that is reporting the error :param error_msg: the error message
-