# 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/misc.py
# def getWidgetState(qWindow):
#     """ Gets the QWindow or QWidget state as a QByteArray.
# 
#         Since Qt does not provide this directly we hack this by saving it to the QSettings
#         in a temporary location and then reading it from the QSettings.
# 
#         :param widget: A QWidget that has a saveState() methods
#     """
#     settings = QtCore.QSettings()
#     settings.beginGroup('temp_conversion')
#     try:
#         settings.setValue("winState", qWindow.saveState())
#         return bytes(settings.value("winState"))
#     finally:
#         settings.endGroup()


import base64
import logging
from argos.qt import QtCore, QtWidgets, Qt
from argos.qt.misc import getWidgetState
    """ Adds actions to a QTableView that can show/hide columns
        by right clicking on the header.

        Has functionality for reading/writing from persitent settings.
    """
    def addHeaderContextMenu(self, checked = None, checkable = None, enabled = None):
        """ Adds the context menu from using header information

            checked can be a header_name -> boolean dictionary. If given, headers
            with the key name will get the checked value from the dictionary.
            The corresponding column will be hidden if checked is False.

            checkable can be a header_name -> boolean dictionary. If given, header actions
            with the key name will get the checkable value from the dictionary. (Default True)

            enabled can be a header_name -> boolean dictionary. If given, header actions
            with the key name will get the enabled value from the dictionary. (Default True)
        """
        checked = checked if checked is not None else {}
        checkable = checkable if checkable is not None else {}
        enabled = enabled if enabled is not None else {}

        horizontal_header = self.horizontalHeader()
        horizontal_header.setContextMenuPolicy(Qt.ActionsContextMenu)

        self.toggle_column_actions_group = QtWidgets.QActionGroup(self)
        self.toggle_column_actions_group.setExclusive(False)
        self.__toggle_functions = []  # for keeping references

        for col in range(horizontal_header.count()):

# 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/misc.py
# def getWidgetState(qWindow):
#     """ Gets the QWindow or QWidget state as a QByteArray.
# 
#         Since Qt does not provide this directly we hack this by saving it to the QSettings
#         in a temporary location and then reading it from the QSettings.
# 
#         :param widget: A QWidget that has a saveState() methods
#     """
#     settings = QtCore.QSettings()
#     settings.beginGroup('temp_conversion')
#     try:
#         settings.setValue("winState", qWindow.saveState())
#         return bytes(settings.value("winState"))
#     finally:
#         settings.endGroup()


# Path: argos/qt/togglecolumn.py
import base64
import logging
from argos.qt import QtCore, QtWidgets, Qt
from argos.qt.misc import getWidgetState

    """ Adds actions to a QTableView that can show/hide columns
        by right clicking on the header.

        Has functionality for reading/writing from persitent settings.
    """
    def addHeaderContextMenu(self, checked = None, checkable = None, enabled = None):
        """ Adds the context menu from using header information

            checked can be a header_name -> boolean dictionary. If given, headers
            with the key name will get the checked value from the dictionary.
            The corresponding column will be hidden if checked is False.

            checkable can be a header_name -> boolean dictionary. If given, header actions
            with the key name will get the checkable value from the dictionary. (Default True)

            enabled can be a header_name -> boolean dictionary. If given, header actions
            with the key name will get the enabled value from the dictionary. (Default True)
        """
        checked = checked if checked is not None else {}
        checkable = checkable if checkable is not None else {}
        enabled = enabled if enabled is not None else {}

        horizontal_header = self.horizontalHeader()
        horizontal_header.setContextMenuPolicy(Qt.ActionsContextMenu)

        self.toggle_column_actions_group = QtWidgets.QActionGroup(self)
        self.toggle_column_actions_group.setExclusive(False)
        self.__toggle_functions = []  # for keeping references

        for col in range(horizontal_header.count()):

            column_label = self.model().headerData(col, Qt.Horizontal, Qt.DisplayRole)