# Path: reggata/helpers.py
# def show_exc_info(parent, ex, tracebk=True, details=None, title=None):
# def format_exc_info(excType, value, tb):
# def to_db_format(path):
# def from_db_format(path):
# def to_os_format(path):
# def to_commalist(seq, apply_each=repr, sep=", "):
# def index_of(seq, match=None):
# def is_none_or_empty(s):
# def stringToBool(s):
# def is_internal(url, base_path):
# def removeTrailingOsSeps(path):
# def computeFileHash(filename, chunksize=128*1024): # chunksize = 128 Kbytes
# def _computeFullFileHash(filename, chunksize, algorithm):
# def _computePartialFileHash(filename, chunksize, algorithm, maxBytesToHash):
# def computePasswordHash(strPassword):
#     def __init__(self, parent=None):
#     def sizeHint(self, option, index):
#     def paint(self, painter, option, index):
#     def __init__(self, parent=None, r=10):
#     def sizeHint(self, option, index):
#     def paint(self, painter, option, index):
#     def createEditor(self, parent, option, index):
#     def setEditorData(self, editor, index):
#     def setModelData(self, editor, model, index):
#     def updateEditorGeometry(self, editor, option, index):
#     def __init__(self, parent=None):
#     def sizeHint(self, option, index):
#     def paint(self, painter, option, index):
# class ImageThumbDelegate(QtGui.QStyledItemDelegate):
# class RatingDelegate(QtGui.QStyledItemDelegate):
# class HTMLDelegate(QtGui.QStyledItemDelegate):
# 
# Path: reggata/user_config.py
# class UserConfig(object):
#     '''
#         This class is an interface for reggata.conf configuration file.
#     It is a singleton class.
#     '''
#     _instance = None
#     _props = None
# 
#     def __new__(cls, *args, **kwargs):
#         if not cls._instance:
#             cls._instance = super(UserConfig, cls).__new__(cls, *args, **kwargs)
# 
#             cls._props = Properties()
#             if not os.path.exists(consts.USER_CONFIG_DIR):
#                 os.makedirs(consts.USER_CONFIG_DIR)
# 
#             if not os.path.exists(consts.USER_CONFIG_FILE):
#                 with codecs.open(consts.USER_CONFIG_FILE, "w", "utf-8") as f:
#                     f.write(reggata_default_conf.reggataDefaultConf)
# 
#             with codecs.open(consts.USER_CONFIG_FILE, "r", "utf-8") as f:
#                 cls._props.load(f)
# 
#         return cls._instance
# 
#     def __init__(self):
#         pass
# 
#     def __getitem__(self, key):
#         '''
#             This is an operation []. It returns a value of parameter with given key.
#         If there is no such key, an exception is raised.
#         '''
#         return self._props[key]
# 
#     def get(self, key, default=None):
#         '''
#             Returns value of parameter with given key. If there are no such key in
#         configuration, then a default value is returned.
#         '''
#         return self._props.get(key, default)
# 
#     def store(self, key, value):
#         self._props[key] = str(value)
#         with codecs.open(consts.USER_CONFIG_FILE, 'w', "utf-8") as f:
#             self._props.store(f)
# 
#     def storeAll(self, d):
#         if type(d) != dict:
#             raise TypeError("This is not a dict instance.")
#         for key in d.keys():
#             self._props[key] = str(d[key])
#         with codecs.open(consts.USER_CONFIG_FILE, 'w', "utf-8") as f:
#             self._props.store(f)
# 
#     def refresh(self):
#         with codecs.open(consts.USER_CONFIG_FILE, 'r', "utf-8") as f:
#             self._props.load(f)


from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import Qt
from reggata import helpers
from reggata.user_config import UserConfig
        self.title = title
        self._formatObjFun = formatObjFun
        self.delegate = delegate
        self._setDataFun = setDataFun

    def formatObj(self, row, obj, role):
        return self._formatObjFun(row, obj, role)

    def setData(self, obj, row, value, role):
        if self._setDataFun is None:
            return False
        return self._setDataFun(obj, row, value, role)

    def isEditable(self):
        return self._setDataFun is not None



class UnivTableModel(QtCore.QAbstractTableModel):
    '''
        UnivTableModel - is a Universal Table Model, able to display list of any
    objects and also allowing to fine tune which object's fields to display and how.
    '''
    def __init__(self, parent=None):
        super(UnivTableModel, self).__init__(parent)
        self._allColumns = [] # All registered columns
        self._visibleColumns = []
        self._objs = []

    def registerColumn(self, col, isVisible=True):

# Path: reggata/helpers.py
# def show_exc_info(parent, ex, tracebk=True, details=None, title=None):
# def format_exc_info(excType, value, tb):
# def to_db_format(path):
# def from_db_format(path):
# def to_os_format(path):
# def to_commalist(seq, apply_each=repr, sep=", "):
# def index_of(seq, match=None):
# def is_none_or_empty(s):
# def stringToBool(s):
# def is_internal(url, base_path):
# def removeTrailingOsSeps(path):
# def computeFileHash(filename, chunksize=128*1024): # chunksize = 128 Kbytes
# def _computeFullFileHash(filename, chunksize, algorithm):
# def _computePartialFileHash(filename, chunksize, algorithm, maxBytesToHash):
# def computePasswordHash(strPassword):
#     def __init__(self, parent=None):
#     def sizeHint(self, option, index):
#     def paint(self, painter, option, index):
#     def __init__(self, parent=None, r=10):
#     def sizeHint(self, option, index):
#     def paint(self, painter, option, index):
#     def createEditor(self, parent, option, index):
#     def setEditorData(self, editor, index):
#     def setModelData(self, editor, model, index):
#     def updateEditorGeometry(self, editor, option, index):
#     def __init__(self, parent=None):
#     def sizeHint(self, option, index):
#     def paint(self, painter, option, index):
# class ImageThumbDelegate(QtGui.QStyledItemDelegate):
# class RatingDelegate(QtGui.QStyledItemDelegate):
# class HTMLDelegate(QtGui.QStyledItemDelegate):
# 
# Path: reggata/user_config.py
# class UserConfig(object):
#     '''
#         This class is an interface for reggata.conf configuration file.
#     It is a singleton class.
#     '''
#     _instance = None
#     _props = None
# 
#     def __new__(cls, *args, **kwargs):
#         if not cls._instance:
#             cls._instance = super(UserConfig, cls).__new__(cls, *args, **kwargs)
# 
#             cls._props = Properties()
#             if not os.path.exists(consts.USER_CONFIG_DIR):
#                 os.makedirs(consts.USER_CONFIG_DIR)
# 
#             if not os.path.exists(consts.USER_CONFIG_FILE):
#                 with codecs.open(consts.USER_CONFIG_FILE, "w", "utf-8") as f:
#                     f.write(reggata_default_conf.reggataDefaultConf)
# 
#             with codecs.open(consts.USER_CONFIG_FILE, "r", "utf-8") as f:
#                 cls._props.load(f)
# 
#         return cls._instance
# 
#     def __init__(self):
#         pass
# 
#     def __getitem__(self, key):
#         '''
#             This is an operation []. It returns a value of parameter with given key.
#         If there is no such key, an exception is raised.
#         '''
#         return self._props[key]
# 
#     def get(self, key, default=None):
#         '''
#             Returns value of parameter with given key. If there are no such key in
#         configuration, then a default value is returned.
#         '''
#         return self._props.get(key, default)
# 
#     def store(self, key, value):
#         self._props[key] = str(value)
#         with codecs.open(consts.USER_CONFIG_FILE, 'w', "utf-8") as f:
#             self._props.store(f)
# 
#     def storeAll(self, d):
#         if type(d) != dict:
#             raise TypeError("This is not a dict instance.")
#         for key in d.keys():
#             self._props[key] = str(d[key])
#         with codecs.open(consts.USER_CONFIG_FILE, 'w', "utf-8") as f:
#             self._props.store(f)
# 
#     def refresh(self):
#         with codecs.open(consts.USER_CONFIG_FILE, 'r', "utf-8") as f:
#             self._props.load(f)


# Path: reggata/gui/univ_table_model.py
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import Qt
from reggata import helpers
from reggata.user_config import UserConfig

        self.title = title
        self._formatObjFun = formatObjFun
        self.delegate = delegate
        self._setDataFun = setDataFun

    def formatObj(self, row, obj, role):
        return self._formatObjFun(row, obj, role)

    def setData(self, obj, row, value, role):
        if self._setDataFun is None:
            return False
        return self._setDataFun(obj, row, value, role)

    def isEditable(self):
        return self._setDataFun is not None



class UnivTableModel(QtCore.QAbstractTableModel):
    '''
        UnivTableModel - is a Universal Table Model, able to display list of any
    objects and also allowing to fine tune which object's fields to display and how.
    '''
    def __init__(self, parent=None):
        super(UnivTableModel, self).__init__(parent)
        self._allColumns = [] # All registered columns
        self._visibleColumns = []
        self._objs = []

    def registerColumn(self, col, isVisible=True):

        assert not helpers.is_none_or_empty(col.id)