# Path: argos/qt/bindings.py
# API_PYSIDE2 = 'pyside2'
# API_PYQT5 = 'pyqt5'
# ALL_API = [API_PYQT5, API_PYSIDE2]
# QT_API_NAME = os.environ.get('QT_API')
#     QT_API_NAME = None
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2
# 
# Path: argos/repo/detailpanes.py
# class DetailBasePane(QtWidgets.QStackedWidget):
#     """ Base class for plugins that show details of the current repository tree item.
#         Serves as an interface but can also be instantiated for debugging purposes.
#         A detail pane is a stacked widget; it has a contents page and and error page.
#     """
#     _label = "Details"
# 
#     ERROR_PAGE_IDX = 0
#     CONTENTS_PAGE_IDX = 1
# 
#     def __init__(self, repoTreeView, parent=None):
#         """ Constructor takes a reference to the repository tree view it monitors
#         """
#         super(DetailBasePane, self).__init__(parent)
# 
#         self._isConnected = False
#         self._repoTreeView = repoTreeView
# 
#         self.errorWidget = MessageDisplay()
#         self.addWidget(self.errorWidget)
# 
#         self.contentsWidget = BasePanel()
#         self.addWidget(self.contentsWidget)
# 
#         self.contentsLayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom)
#         self.contentsLayout.setSpacing(DOCK_SPACING)
#         self.contentsLayout.setContentsMargins(DOCK_MARGIN, DOCK_MARGIN, DOCK_MARGIN, DOCK_MARGIN)
#         self.contentsWidget.setLayout(self.contentsLayout)
# 
#         self.setCurrentIndex(self.CONTENTS_PAGE_IDX)
# 
# 
#     @classmethod
#     def classLabel(cls):
#         """ Returns a short string that describes this class. For use in menus, headers, etc.
#         """
#         return cls._label
# 
# 
#     @property
#     def isConnected(self):
#         "Returns True if this pane is connected to the currentChanged signal of the repoTreeView"
#         return self._isConnected
# 
# 
#     def sizeHint(self):
#         """ The recommended size for the widget."""
#         return QtCore.QSize(LEFT_DOCK_WIDTH, 250)
# 
# 
#     def repoItemChanged(self, rti):
#         """ Updates the content when the current repo tree item changes.
#             The rti parameter can be None when no RTI is selected in the repository tree.
#         """
#         check_class(rti, (BaseRti, int), allow_none=True)
#         assert type(rti) != int, "rti: {}".format(rti)
#         try:
#             self._drawContents(rti)
#             self.setCurrentIndex(self.CONTENTS_PAGE_IDX)
#         except Exception as ex:
#             if DEBUGGING:
#                 raise
#             logger.exception(ex)
#             self.errorWidget.setError(msg=str(ex), title=get_class_name(ex))
#             self.setCurrentIndex(self.ERROR_PAGE_IDX)
# 
# 
#     def _drawContents(self, currentRti=None):
#         """ Draws the contents for the current RTI. Descendants should override this.
#             Descendants should draw 'empty' contents if currentRti is None. No need to
#             handle exceptions though, these are handled by the called (currentChanged).
#         """
#         pass
# 
# 
#     def marshall(self):
#         """ Returns a dictionary to save in the persistent settings
#         """
#         raise NotImplementedError("Not implemented. Please override")
# 
# 
#     def unmarshall(self, cfg):
#         """ Initializes itself from a config dict form the persistent settings.
#         """
#         raise NotImplementedError("Not implemented. Please override")
# 
# Path: argos/widgets/constants.py
# MONO_FONT = 'Monospace'
# 
# FONT_SIZE = 10


import logging
import numpy as np
from argos.qt import QtGui, QtWidgets
from argos.repo.detailpanes import DetailBasePane
from argos.widgets.constants import MONO_FONT, FONT_SIZE
#
# Argos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Argos. If not, see <http://www.gnu.org/licenses/>.

""" RTI quicklook.
"""



logger = logging.getLogger(__name__)


class QuickLookPane(DetailBasePane):
    """ Shows a string representation of the RTI contents.
    """
    _label = "Quick Look"

    def __init__(self, repoTreeView, parent=None):
        super(QuickLookPane, self).__init__(repoTreeView, parent=parent)

        self._currentRti = None

        self.editor = QtWidgets.QPlainTextEdit()
        self.editor.setReadOnly(True)
        self.editor.setWordWrapMode(QtGui.QTextOption.NoWrap)

# Path: argos/qt/bindings.py
# API_PYSIDE2 = 'pyside2'
# API_PYQT5 = 'pyqt5'
# ALL_API = [API_PYQT5, API_PYSIDE2]
# QT_API_NAME = os.environ.get('QT_API')
#     QT_API_NAME = None
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2
# 
# Path: argos/repo/detailpanes.py
# class DetailBasePane(QtWidgets.QStackedWidget):
#     """ Base class for plugins that show details of the current repository tree item.
#         Serves as an interface but can also be instantiated for debugging purposes.
#         A detail pane is a stacked widget; it has a contents page and and error page.
#     """
#     _label = "Details"
# 
#     ERROR_PAGE_IDX = 0
#     CONTENTS_PAGE_IDX = 1
# 
#     def __init__(self, repoTreeView, parent=None):
#         """ Constructor takes a reference to the repository tree view it monitors
#         """
#         super(DetailBasePane, self).__init__(parent)
# 
#         self._isConnected = False
#         self._repoTreeView = repoTreeView
# 
#         self.errorWidget = MessageDisplay()
#         self.addWidget(self.errorWidget)
# 
#         self.contentsWidget = BasePanel()
#         self.addWidget(self.contentsWidget)
# 
#         self.contentsLayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.TopToBottom)
#         self.contentsLayout.setSpacing(DOCK_SPACING)
#         self.contentsLayout.setContentsMargins(DOCK_MARGIN, DOCK_MARGIN, DOCK_MARGIN, DOCK_MARGIN)
#         self.contentsWidget.setLayout(self.contentsLayout)
# 
#         self.setCurrentIndex(self.CONTENTS_PAGE_IDX)
# 
# 
#     @classmethod
#     def classLabel(cls):
#         """ Returns a short string that describes this class. For use in menus, headers, etc.
#         """
#         return cls._label
# 
# 
#     @property
#     def isConnected(self):
#         "Returns True if this pane is connected to the currentChanged signal of the repoTreeView"
#         return self._isConnected
# 
# 
#     def sizeHint(self):
#         """ The recommended size for the widget."""
#         return QtCore.QSize(LEFT_DOCK_WIDTH, 250)
# 
# 
#     def repoItemChanged(self, rti):
#         """ Updates the content when the current repo tree item changes.
#             The rti parameter can be None when no RTI is selected in the repository tree.
#         """
#         check_class(rti, (BaseRti, int), allow_none=True)
#         assert type(rti) != int, "rti: {}".format(rti)
#         try:
#             self._drawContents(rti)
#             self.setCurrentIndex(self.CONTENTS_PAGE_IDX)
#         except Exception as ex:
#             if DEBUGGING:
#                 raise
#             logger.exception(ex)
#             self.errorWidget.setError(msg=str(ex), title=get_class_name(ex))
#             self.setCurrentIndex(self.ERROR_PAGE_IDX)
# 
# 
#     def _drawContents(self, currentRti=None):
#         """ Draws the contents for the current RTI. Descendants should override this.
#             Descendants should draw 'empty' contents if currentRti is None. No need to
#             handle exceptions though, these are handled by the called (currentChanged).
#         """
#         pass
# 
# 
#     def marshall(self):
#         """ Returns a dictionary to save in the persistent settings
#         """
#         raise NotImplementedError("Not implemented. Please override")
# 
# 
#     def unmarshall(self, cfg):
#         """ Initializes itself from a config dict form the persistent settings.
#         """
#         raise NotImplementedError("Not implemented. Please override")
# 
# Path: argos/widgets/constants.py
# MONO_FONT = 'Monospace'
# 
# FONT_SIZE = 10


# Path: argos/repo/detailplugins/quicklook.py
import logging
import numpy as np
from argos.qt import QtGui, QtWidgets
from argos.repo.detailpanes import DetailBasePane
from argos.widgets.constants import MONO_FONT, FONT_SIZE

#
# Argos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Argos. If not, see <http://www.gnu.org/licenses/>.

""" RTI quicklook.
"""



logger = logging.getLogger(__name__)


class QuickLookPane(DetailBasePane):
    """ Shows a string representation of the RTI contents.
    """
    _label = "Quick Look"

    def __init__(self, repoTreeView, parent=None):
        super(QuickLookPane, self).__init__(repoTreeView, parent=parent)

        self._currentRti = None

        self.editor = QtWidgets.QPlainTextEdit()
        self.editor.setReadOnly(True)
        self.editor.setWordWrapMode(QtGui.QTextOption.NoWrap)

        self.editor.setFont(QtGui.QFont(MONO_FONT, FONT_SIZE))