Source code for schrodinger.application.livedesign.ld_base_classes
# -*- coding: utf-8 -*-
"""
Base classes used for LiveDesign import/export GUIs.
Copyright Schrödinger, LLC. All rights reserved.
"""
from schrodinger.ui.qt import basewidgets
from . import login
from .live_report_widget import LiveReportWidget
LR_ID = 'live_report_id'
LR_COLUMNS = 'live_report_columns'
LR_STRUCTS = 'live_report_structs'
CLIENT = login.CLIENT
MODELS = login.MODELS
# User message colors
WARNING_COLOR = 'firebrick'
SUCCESS_COLOR = 'green'
[docs]class HandledError(Exception):
pass
[docs]class ImportExportBasePanel(basewidgets.Panel):
"""
Main panel for specifying how to import or export the data to/from LD.
"""
ALLOW_ADD_LIVE_REPORTS = False
[docs] def initSetUp(self):
super().initSetUp()
self.lr_widget = LiveReportWidget(
parent=self, allow_add_live_reports=self.ALLOW_ADD_LIVE_REPORTS)
[docs] def initSetDefaults(self):
super().initSetDefaults()
self.lr_widget.initSetDefaults()
[docs] def initLayOut(self):
super().initLayOut()
self.ui.lr_widget_layout.addWidget(self.lr_widget)
[docs] def closeEvent(self, 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.
"""
self.initSetDefaults()
super().closeEvent(event)
@property
def project_name(self):
return self.lr_widget.getProjectName()
@property
def project_id(self):
return self.lr_widget.getProjectID()
@property
def live_report_id(self):
return self.lr_widget.getLiveReportID()