<commit_before># CheckableComboBox
# <NAME>
# 6/30/22
#
# This is a costume ComboBox where you can select multiple items on a list.
# Used in the Settings Tool.
# The code is found on: https://gis.stackexchange.com/questions/350148/qcombobox-multiple-selection-pyqt5
# with some modifications made by Lærke.

from PyQt5.QtWidgets import QComboBox, QStyledItemDelegate, QApplication
from PyQt5.QtGui import QPalette, QStandardItem, QFontMetrics
from PyQt5.QtCore import QEvent, Qt

class CheckableComboBox(QComboBox):

    # Subclass Delegate to increase item height
    class Delegate(QStyledItemDelegate):
        def sizeHint(self, option, index):
            size = super().sizeHint(option, index)
            size.setHeight(29)
            size.setWidth(436)
            return size

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # Make the combo editable to set a custom text, but readonly
        self.setEditable(True)
        self.lineEdit().setReadOnly(True)
        # Make the lineedit the same color as QPushButton
        palette = QApplication.palette()
        palette.setBrush(QPalette.Base, palette.button())
        self.lineEdit().setPalette(palette)

        # Use custom delegate
        self.setItemDelegate(CheckableComboBox.Delegate())


        # Update the text when an item is toggled<commit_msg> Undo color change to lineEdit part<commit_after>#
#   CheckableComboBox
#
#   <NAME>
#   6/30/22
#
#   Version 3.5.1 - 7/1/22 - <NAME>
#    Undo color change to lineEdit part
#
#   This is a custom ComboBox where you can select multiple items on a list.
#   Used in the Settings Tool.
#   The code is found on: https://gis.stackexchange.com/questions/350148/qcombobox-multiple-selection-pyqt5
#   with some modifications made by Lærke.

from PyQt5.QtWidgets import QComboBox, QStyledItemDelegate, QApplication
from PyQt5.QtGui import QPalette, QStandardItem, QFontMetrics
from PyQt5.QtCore import QEvent, Qt

class CheckableComboBox(QComboBox):

    # Subclass Delegate to increase item height
    class Delegate(QStyledItemDelegate):
        def sizeHint(self, option, index):
            size = super().sizeHint(option, index)
            size.setHeight(29)
            size.setWidth(436)
            return size

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # Make the combo editable to set a custom text, but readonly
        self.setEditable(True)
        self.lineEdit().setReadOnly(True)

        # Use custom delegate
        self.setItemDelegate(CheckableComboBox.Delegate())


        # Update the text when an item is toggled
{'fraction_non_alphanumeric': 0.08672699849170437, 'fraction_numerical': 0.017722473604826545, 'mean_word_length': 3.0815384615384613, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 2, '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': '4754544', 'n_tokens_mistral': 834, 'n_tokens_neox': 787, 'n_words': 236}