# Path: pcloudpy/gui/components/toolboxTreeWidgetItem.py
# class ToolBoxTreeWidgetItem(QTreeWidgetItem):
#     def __init__(self, parent=None,  type=QTreeWidgetItem.UserType + 2):
#         super(ToolBoxTreeWidgetItem, self).__init__(parent, type)
# 
#         self.setIcon(0,QIcon(":/Toolbox-50.png"))
#         self._objectName = None
#         self._metadata = None
# 
#     def setText(self, column, text):
#         super(ToolBoxTreeWidgetItem, self).setText(column, text)
#         self.setObjectName(text.replace(" ","-"))
# 
#     def setMetadata(self, metadata):
#         self._metadata = metadata
# 
#     def metadata(self):
#         return self._metadata
# 
# 
#     def setObjectName(self, name):
#         self._objectName = name
# 
#     def objectName(self):
#         return self._objectName
# 
# Path: pcloudpy/gui/components/toolboxStandardItem.py
# class ToolboxStandardItem(QStandardItem):
#     def __init__(self, *args, **kwargs):
#         super(ToolboxStandardItem, self).__init__(*args, **kwargs)
# 
#         self._metadata = None
#         self.setFlags(self.flags() & ~Qt.ItemIsEditable)
#         self.setIcon(QIcon(":/Toolbox-50.png"))
#         self._objectName = None
#         self._metadata = None
# 
#     def setText(self, text):
#         super(ToolboxStandardItem, self).setText(text)
#         self.setObjectName(text.replace(" ","-"))
# 
#     def setMetadata(self, metadata):
#         self._metadata = metadata
# 
#     def metadata(self):
#         return self._metadata
# 
#     def setObjectName(self, name):
#         self._objectName = name
# 
#     def objectName(self):
#         return self._objectName


from PyQt5.QtCore import  *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import pyqtSignal as Signal
from ..resources_rc import *
from .toolboxTreeWidgetItem import ToolBoxTreeWidgetItem
from .toolboxStandardItem import ToolboxStandardItem
        model = QStandardItemModel()
        root = model.invisibleRootItem()

        for key in data.keys():
            item = QStandardItem(key)
            item.setIcon(QIcon(":/toolbox-icon.png"))
            item.setFlags(item.flags() & ~Qt.ItemIsEditable)
            root.appendRow(item)

            for child in data[key]:
                item_child = ToolboxStandardItem()
                item_child.setText(child)
                print(child)
                d = data[key][child]
                item_child.setEnabled(int(d['enabled']))
                item_child.setMetadata(d)
                item.appendRow(item_child)

        self.tree.setModel(model)

        ##self.connect(self.tree.selectionModel(), SIGNAL("selectionChanged(QItemSelection, QItemSelection)"), self.select_item)
        self.tree.selectionModel().selectionChanged.connect(self.select_item)


    def get_current_item(self):
        if self._current_item:
            return self._current_item

    def click_item(self, index):
        self._current_item = index.model().itemFromIndex(index)

# Path: pcloudpy/gui/components/toolboxTreeWidgetItem.py
# class ToolBoxTreeWidgetItem(QTreeWidgetItem):
#     def __init__(self, parent=None,  type=QTreeWidgetItem.UserType + 2):
#         super(ToolBoxTreeWidgetItem, self).__init__(parent, type)
# 
#         self.setIcon(0,QIcon(":/Toolbox-50.png"))
#         self._objectName = None
#         self._metadata = None
# 
#     def setText(self, column, text):
#         super(ToolBoxTreeWidgetItem, self).setText(column, text)
#         self.setObjectName(text.replace(" ","-"))
# 
#     def setMetadata(self, metadata):
#         self._metadata = metadata
# 
#     def metadata(self):
#         return self._metadata
# 
# 
#     def setObjectName(self, name):
#         self._objectName = name
# 
#     def objectName(self):
#         return self._objectName
# 
# Path: pcloudpy/gui/components/toolboxStandardItem.py
# class ToolboxStandardItem(QStandardItem):
#     def __init__(self, *args, **kwargs):
#         super(ToolboxStandardItem, self).__init__(*args, **kwargs)
# 
#         self._metadata = None
#         self.setFlags(self.flags() & ~Qt.ItemIsEditable)
#         self.setIcon(QIcon(":/Toolbox-50.png"))
#         self._objectName = None
#         self._metadata = None
# 
#     def setText(self, text):
#         super(ToolboxStandardItem, self).setText(text)
#         self.setObjectName(text.replace(" ","-"))
# 
#     def setMetadata(self, metadata):
#         self._metadata = metadata
# 
#     def metadata(self):
#         return self._metadata
# 
#     def setObjectName(self, name):
#         self._objectName = name
# 
#     def objectName(self):
#         return self._objectName


# Path: pcloudpy/gui/components/ToolboxesWidget.py
from PyQt5.QtCore import  *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import pyqtSignal as Signal
from ..resources_rc import *
from .toolboxTreeWidgetItem import ToolBoxTreeWidgetItem
from .toolboxStandardItem import ToolboxStandardItem

        model = QStandardItemModel()
        root = model.invisibleRootItem()

        for key in data.keys():
            item = QStandardItem(key)
            item.setIcon(QIcon(":/toolbox-icon.png"))
            item.setFlags(item.flags() & ~Qt.ItemIsEditable)
            root.appendRow(item)

            for child in data[key]:
                item_child = ToolboxStandardItem()
                item_child.setText(child)
                print(child)
                d = data[key][child]
                item_child.setEnabled(int(d['enabled']))
                item_child.setMetadata(d)
                item.appendRow(item_child)

        self.tree.setModel(model)

        ##self.connect(self.tree.selectionModel(), SIGNAL("selectionChanged(QItemSelection, QItemSelection)"), self.select_item)
        self.tree.selectionModel().selectionChanged.connect(self.select_item)


    def get_current_item(self):
        if self._current_item:
            return self._current_item

    def click_item(self, index):
        self._current_item = index.model().itemFromIndex(index)

        if isinstance(self._current_item, ToolboxStandardItem):