<commit_before># -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
## Description
"""
Construct Cache Table with PySide.GtGui.
"""
#-------------------------------------------------------------------------------

import sys, os

from PySide import QtCore, QtGui

from . import define as Define

sys.dont_write_bytecode = True

CURRENT_PATH = os.path.driname(__file__)

# Original Roles
FILE_PATH = QtCore.Qt.UserRole

class cacheTableView(QtGui.QTreeView):
    """docstring for cacheTableView"""

    mouseReleased = QtCore.Signal(QtCore.QPoint)
    keyPressed = QtCore.Signal(QtGui.QKeyEvent)

    def __init__(self, parent):
        super(cacheTableView, self).__init__(parent)
        self._parent = parent
        self.cache_nodes = self.getCacheList()
        self.initSettings()

    def initSettings(self):
        # self.verticalHeader().setVisible(False)
        # self.verticalHeader().setMovable(True)
        # self.horizontalHeader().setResizeMode(QtGui.QHeaderView.Interactive)
        # self.setSortingEnabled(True)
        # self.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
        # self.setAlternatingRowColors(True)
        self.model = CacheTableModel()
        self.setModel(self.model)


    def unexpStrPath(self, path):
        cachePath = path + "/file"
        unExpPath = hou.parm(cachePath).unexpandedString()
        return unExpPath

    def env_Analysis(self, path):
        pathParts = path[0].split('/')
        if pathParts[0] == None:
            return "-"
        else:
            return pathParts[0]

class CacheTableDelegate(QtGui.QStyledItemDelegate):
    """docstring for CacheTableModel"""

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

    def paint(self):
        selected = False

        if option.state & QtGui.QStyle.State_Selected:
            selected = True

        name = index.data(QtCore.Qt.BackgroundRole)
        description = index.data(DESCRIPTION_ROLE)

    #
    # CACHE_PATH =  QtCore.Qt.UserRole
    #
    # def __init__(self, parent = None, data = []):
    #     super(CacheTableModel, self).__init__(parent)
    #
    #     self.__items = data
    #
    # def rowCount(self, parent = QtCore.QModelIndex()):
    #     return len(self.__items)
    #
    # def columnCount(self, parent = QtCore.QModelIndex()):
    #     return len(self.__items[0]) -1
    #
    # def data(self, index, role = QtCore.Qt.DisplayRole):
    #
    #     if not index.isValid():
    #         return None
    #
    #     if not 0 <= index.row() < len(self.__items):
    #         return None
    #
    #     if role == QtCore.Qt.DisplayRole:
    #         return self.__items[index.row()].get("title")
    #
    #     else:
    #         return None
    #
    # def headerData(self, col, orientation, role):
    #     if orientation == QtCore.Qt.Horizontal and role == QtCore.Qt.DisplayRole:
    #         return self.__items[col].get("title")
    #
    #
    # def flags(self, index):
    #     return QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable
    #
    #
    # def setHeaderSetting(self):
    #
    #     for i, colInfo in enumerate(Define._HEADER_ITEMS):
    #         self.setColumnVisibe(i, colInfo.get("visible"))
    #         if colInfo.get("width") is not None:
    #             self.setColumnWidth(i, colInfo.get("width"))
    #
    #
    # def getHeaderSectionByKey(self):
    #
    #<commit_msg>Remvoe unneeded comment out.<commit_after># -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
## Description
"""
Construct Cache Table with PySide.GtGui.
"""
#-------------------------------------------------------------------------------

import sys, os

from PySide import QtCore, QtGui

from . import define as Define

sys.dont_write_bytecode = True

CURRENT_PATH = os.path.driname(__file__)

# Original Roles
FILE_PATH = QtCore.Qt.UserRole

class cacheTableView(QtGui.QTreeView):
    """docstring for cacheTableView"""

    mouseReleased = QtCore.Signal(QtCore.QPoint)
    keyPressed = QtCore.Signal(QtGui.QKeyEvent)

    def __init__(self, parent):
        super(cacheTableView, self).__init__(parent)
        self._parent = parent
        self.cache_nodes = self.getCacheList()
        self.initSettings()

    def initSettings(self):
        # self.verticalHeader().setVisible(False)
        # self.verticalHeader().setMovable(True)
        # self.horizontalHeader().setResizeMode(QtGui.QHeaderView.Interactive)
        # self.setSortingEnabled(True)
        # self.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
        # self.setAlternatingRowColors(True)
        self.model = CacheTableModel()
        self.setModel(self.model)


    def unexpStrPath(self, path):
        cachePath = path + "/file"
        unExpPath = hou.parm(cachePath).unexpandedString()
        return unExpPath

    def env_Analysis(self, path):
        pathParts = path[0].split('/')
        if pathParts[0] == None:
            return "-"
        else:
            return pathParts[0]

class CacheTableDelegate(QtGui.QStyledItemDelegate):
    """docstring for CacheTableModel"""

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

    def paint(self):
        selected = False

        if option.state & QtGui.QStyle.State_Selected:
            selected = True

        name = index.data(QtCore.Qt.BackgroundRole)
        description = index.data(DESCRIPTION_ROLE)
{'fraction_non_alphanumeric': 0.1674744211093161, 'fraction_numerical': 0.001974510859809729, 'mean_word_length': 2.176738882554162, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1676599', 'n_tokens_mistral': 1652, 'n_tokens_neox': 1625, 'n_words': 300}