# Path: OpenNumismat/Collection/CollectionFields.py
# class FieldTypes():
#     String = 1
#     ShortString = 2
#     Number = 3
#     Text = 4
#     Money = 5
#     Date = 6
#     BigInt = 7
#     Image = 8
#     Value = 9
#     Status = 10
#     DateTime = 11
#     PreviewImage = 13
#     Denomination = 14
# 
#     Mask = 0xFF
#     Checkable = 0x100
#     Disabled = 0x200
# 
#     ImageTypes = (Image, PreviewImage)
# 
#     @staticmethod
#     def toSql(type_):
#         if type_ == FieldTypes.String:
#             sql_type = 'TEXT'
#         elif type_ == FieldTypes.ShortString:
#             sql_type = 'TEXT'
#         elif type_ == FieldTypes.Number:
#             sql_type = 'INTEGER'
#         elif type_ == FieldTypes.Text:
#             sql_type = 'TEXT'
#         elif type_ == FieldTypes.Money:
#             sql_type = 'NUMERIC'
#         elif type_ == FieldTypes.Denomination:
#             sql_type = 'NUMERIC'
#         elif type_ == FieldTypes.Date:
#             sql_type = 'TEXT'
#         elif type_ == FieldTypes.BigInt:
#             sql_type = 'INTEGER'
#         elif type_ == FieldTypes.PreviewImage:
#             sql_type = 'INTEGER'
#         elif type_ == FieldTypes.Image:
#             sql_type = 'INTEGER'
#         elif type_ == FieldTypes.Value:
#             sql_type = 'NUMERIC'
#         elif type_ == FieldTypes.Status:
#             sql_type = 'TEXT'
#         elif type_ == FieldTypes.DateTime:
#             sql_type = 'TEXT'
#         else:
#             raise TypeError
# 
#         return sql_type
# 
# Path: OpenNumismat/Collection/CollectionFields.py
# class FieldTypes():
# class Status(dict):
# class CollectionField():
# class CollectionFieldsBase(QObject):
# class CollectionFields(CollectionFieldsBase):
#     def toSql(type_):
#     def __init__(self):
#     def keys(self):
#     def items(self):
#     def values(self):
#     def __getitem__(self, key):
#     def __init__(self, id_, name, title, type_):
#     def __init__(self, parent=None):
#     def field(self, id_):
#     def __iter__(self):
#     def __next__(self):
#     def __init__(self, db, parent=None):
#     def getCustomTitle(self, name):
#     def save(self):
#     def create(db=QSqlDatabase()):
# 
# Path: OpenNumismat/Tools/Gui.py
# def statusIcon(status):
#     return QIcon(":/%s.png" % status)
# 
# Path: OpenNumismat/Tools/Converters.py
# def numberWithFraction(string, enabled=True):
#     if enabled:
#         try:
#             if float(string) == 0.25:
#                 return '¼', True
#             elif float(string) == 0.33:
#                 return '⅓', True
#             elif float(string) == 0.5:
#                 return '½', True
#             elif float(string) == 0.75:
#                 return '¾', True
#             elif float(string) == 1.25:
#                 return '1¼', True
#             elif float(string) == 1.5:
#                 return '1½', True
#             elif float(string) == 2.5:
#                 return '2½', True
#         except (ValueError, TypeError):
#             pass
# 
#     return string, False


from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtSql import QSqlQuery
from PyQt5.QtWidgets import *
from OpenNumismat.Collection.CollectionFields import FieldTypes as Type
from OpenNumismat.Collection.CollectionFields import Statuses, StatusesOrder
from OpenNumismat.Tools.Gui import statusIcon
from OpenNumismat.Tools.Converters import numberWithFraction
            blanksFilter = DataFilter(self.columnName).toSql()

            filtersSql = self.filtersToSql(filters.values())
            sql = "SELECT 1 FROM coins WHERE " + filtersSql
            if filtersSql:
                sql += ' AND '

            # Get blank row count
            blank_sql = sql + blanksFilter + " LIMIT 1"
            query = QSqlQuery(blank_sql, self.db)
            if query.first():
                hasBlanks = True

            # Get not blank row count
            not_blank_sql = sql + dataFilter + " LIMIT 1"
            query = QSqlQuery(not_blank_sql, self.db)
            if query.first():
                if columnType in Type.ImageTypes:
                    label = self.tr("(Images)")
                elif columnType == Type.Text:
                    label = self.tr("(Text)")
                else:
                    label = self.tr("(Data)")
                item = QListWidgetItem(label,
                                       type=FilterMenuButton.DataType)
                item.setData(Qt.UserRole, label)
                item.setCheckState(Qt.Checked)
                if columnFilters and columnFilters.hasData():
                    item.setCheckState(Qt.Unchecked)
                self.listWidget.addItem(item)

# Path: OpenNumismat/Collection/CollectionFields.py
# class FieldTypes():
#     String = 1
#     ShortString = 2
#     Number = 3
#     Text = 4
#     Money = 5
#     Date = 6
#     BigInt = 7
#     Image = 8
#     Value = 9
#     Status = 10
#     DateTime = 11
#     PreviewImage = 13
#     Denomination = 14
# 
#     Mask = 0xFF
#     Checkable = 0x100
#     Disabled = 0x200
# 
#     ImageTypes = (Image, PreviewImage)
# 
#     @staticmethod
#     def toSql(type_):
#         if type_ == FieldTypes.String:
#             sql_type = 'TEXT'
#         elif type_ == FieldTypes.ShortString:
#             sql_type = 'TEXT'
#         elif type_ == FieldTypes.Number:
#             sql_type = 'INTEGER'
#         elif type_ == FieldTypes.Text:
#             sql_type = 'TEXT'
#         elif type_ == FieldTypes.Money:
#             sql_type = 'NUMERIC'
#         elif type_ == FieldTypes.Denomination:
#             sql_type = 'NUMERIC'
#         elif type_ == FieldTypes.Date:
#             sql_type = 'TEXT'
#         elif type_ == FieldTypes.BigInt:
#             sql_type = 'INTEGER'
#         elif type_ == FieldTypes.PreviewImage:
#             sql_type = 'INTEGER'
#         elif type_ == FieldTypes.Image:
#             sql_type = 'INTEGER'
#         elif type_ == FieldTypes.Value:
#             sql_type = 'NUMERIC'
#         elif type_ == FieldTypes.Status:
#             sql_type = 'TEXT'
#         elif type_ == FieldTypes.DateTime:
#             sql_type = 'TEXT'
#         else:
#             raise TypeError
# 
#         return sql_type
# 
# Path: OpenNumismat/Collection/CollectionFields.py
# class FieldTypes():
# class Status(dict):
# class CollectionField():
# class CollectionFieldsBase(QObject):
# class CollectionFields(CollectionFieldsBase):
#     def toSql(type_):
#     def __init__(self):
#     def keys(self):
#     def items(self):
#     def values(self):
#     def __getitem__(self, key):
#     def __init__(self, id_, name, title, type_):
#     def __init__(self, parent=None):
#     def field(self, id_):
#     def __iter__(self):
#     def __next__(self):
#     def __init__(self, db, parent=None):
#     def getCustomTitle(self, name):
#     def save(self):
#     def create(db=QSqlDatabase()):
# 
# Path: OpenNumismat/Tools/Gui.py
# def statusIcon(status):
#     return QIcon(":/%s.png" % status)
# 
# Path: OpenNumismat/Tools/Converters.py
# def numberWithFraction(string, enabled=True):
#     if enabled:
#         try:
#             if float(string) == 0.25:
#                 return '¼', True
#             elif float(string) == 0.33:
#                 return '⅓', True
#             elif float(string) == 0.5:
#                 return '½', True
#             elif float(string) == 0.75:
#                 return '¾', True
#             elif float(string) == 1.25:
#                 return '1¼', True
#             elif float(string) == 1.5:
#                 return '1½', True
#             elif float(string) == 2.5:
#                 return '2½', True
#         except (ValueError, TypeError):
#             pass
# 
#     return string, False


# Path: OpenNumismat/Collection/HeaderFilterMenu.py
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtSql import QSqlQuery
from PyQt5.QtWidgets import *
from OpenNumismat.Collection.CollectionFields import FieldTypes as Type
from OpenNumismat.Collection.CollectionFields import Statuses, StatusesOrder
from OpenNumismat.Tools.Gui import statusIcon
from OpenNumismat.Tools.Converters import numberWithFraction

            blanksFilter = DataFilter(self.columnName).toSql()

            filtersSql = self.filtersToSql(filters.values())
            sql = "SELECT 1 FROM coins WHERE " + filtersSql
            if filtersSql:
                sql += ' AND '

            # Get blank row count
            blank_sql = sql + blanksFilter + " LIMIT 1"
            query = QSqlQuery(blank_sql, self.db)
            if query.first():
                hasBlanks = True

            # Get not blank row count
            not_blank_sql = sql + dataFilter + " LIMIT 1"
            query = QSqlQuery(not_blank_sql, self.db)
            if query.first():
                if columnType in Type.ImageTypes:
                    label = self.tr("(Images)")
                elif columnType == Type.Text:
                    label = self.tr("(Text)")
                else:
                    label = self.tr("(Data)")
                item = QListWidgetItem(label,
                                       type=FilterMenuButton.DataType)
                item.setData(Qt.UserRole, label)
                item.setCheckState(Qt.Checked)
                if columnFilters and columnFilters.hasData():
                    item.setCheckState(Qt.Unchecked)
                self.listWidget.addItem(item)

        elif columnType == Type.Status: