# 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/qt/togglecolumn.py
# class ToggleColumnTreeView(QtWidgets.QTreeView, ToggleColumnMixIn):
#     """ A QTreeView where right clicking on the header allows the user to show/hide columns
#     """
#     def horizontalHeader(self):
#         """ Returns the horizontal header (of type QHeaderView).
# 
#             Override this if the horizontalHeader() function does not exist.
#         """
#         return self.header()
# 
# Path: argos/widgets/constants.py
# COLLECTOR_TREE_ICON_SIZE = QtCore.QSize(20, 20)
# 
# Path: argos/utils/cls.py
# def check_class(obj, target_class, allow_none = False):
#     """ Checks that the  obj is a (sub)type of target_class.
#         Raises a TypeError if this is not the case.
# 
#         :param obj: object whos type is to be checked
#         :type obj: any type
#         :param target_class: target type/class
#         :type target_class: any class or type
#         :param allow_none: if true obj may be None
#         :type allow_none: boolean
#     """
#     if not isinstance(obj, target_class):
#         if not (allow_none and obj is None):
#             raise TypeError("obj must be a of type {}, got: {}"
#                             .format(target_class, type(obj)))


import logging
import numpy as np
from argos.qt import Qt, QtCore, QtGui, QtWidgets, QtSlot
from argos.qt.togglecolumn import ToggleColumnTreeView
from argos.widgets.constants import COLLECTOR_TREE_ICON_SIZE
from argos.utils.cls import check_class

        # This was h = d.edit.sizeHint().height(), but that didn't work. In the end we set the
        # height to the height calculated from the parent.
        h = orgSizeHint.height()
        w = 0

        # QLatin1Char seems not to be implemented.
        # Using regular string literals and hope for the best
        s = self.prefix() + self.textFromValue(self.minimum()) + self.suffix() #+ ' '

        # We disabled truncating the string here!!
        #s = s[:18]
        w = max(w, fm.width(s))

        s = self.prefix() + self.textFromValue(self.maximum()) + self.suffix() #+ ' '

        # We disabled truncating the string here!!
        #s = s[:18]
        w = max(w, fm.width(s))
        if len(self.specialValueText()):
            s = self.specialValueText()
            w = max(w, fm.width(s))

        w += 2 # cursor blinking space

        w -= 15 # The spinboxes seemed to wide. Made a bit smaller by Pepijn.

        opt = QtWidgets.QStyleOptionSpinBox()
        self.initStyleOption(opt)
        hint = QtCore.QSize(w, h)

# 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/qt/togglecolumn.py
# class ToggleColumnTreeView(QtWidgets.QTreeView, ToggleColumnMixIn):
#     """ A QTreeView where right clicking on the header allows the user to show/hide columns
#     """
#     def horizontalHeader(self):
#         """ Returns the horizontal header (of type QHeaderView).
# 
#             Override this if the horizontalHeader() function does not exist.
#         """
#         return self.header()
# 
# Path: argos/widgets/constants.py
# COLLECTOR_TREE_ICON_SIZE = QtCore.QSize(20, 20)
# 
# Path: argos/utils/cls.py
# def check_class(obj, target_class, allow_none = False):
#     """ Checks that the  obj is a (sub)type of target_class.
#         Raises a TypeError if this is not the case.
# 
#         :param obj: object whos type is to be checked
#         :type obj: any type
#         :param target_class: target type/class
#         :type target_class: any class or type
#         :param allow_none: if true obj may be None
#         :type allow_none: boolean
#     """
#     if not isinstance(obj, target_class):
#         if not (allow_none and obj is None):
#             raise TypeError("obj must be a of type {}, got: {}"
#                             .format(target_class, type(obj)))


# Path: argos/collect/collectortree.py
import logging
import numpy as np
from argos.qt import Qt, QtCore, QtGui, QtWidgets, QtSlot
from argos.qt.togglecolumn import ToggleColumnTreeView
from argos.widgets.constants import COLLECTOR_TREE_ICON_SIZE
from argos.utils.cls import check_class


        # This was h = d.edit.sizeHint().height(), but that didn't work. In the end we set the
        # height to the height calculated from the parent.
        h = orgSizeHint.height()
        w = 0

        # QLatin1Char seems not to be implemented.
        # Using regular string literals and hope for the best
        s = self.prefix() + self.textFromValue(self.minimum()) + self.suffix() #+ ' '

        # We disabled truncating the string here!!
        #s = s[:18]
        w = max(w, fm.width(s))

        s = self.prefix() + self.textFromValue(self.maximum()) + self.suffix() #+ ' '

        # We disabled truncating the string here!!
        #s = s[:18]
        w = max(w, fm.width(s))
        if len(self.specialValueText()):
            s = self.specialValueText()
            w = max(w, fm.width(s))

        w += 2 # cursor blinking space

        w -= 15 # The spinboxes seemed to wide. Made a bit smaller by Pepijn.

        opt = QtWidgets.QStyleOptionSpinBox()
        self.initStyleOption(opt)
        hint = QtCore.QSize(w, h)

        extra = QtCore.QSize(35, 6)