<commit_before># -*- coding: utf-8 -*-
"""Display the driver database as a table."""
import PySide.QtGui as QtGui
import PySide.QtCore as QtCore
from . import config
from ..lib.driver import Driver


class DriverDatabaseFrame(QtGui.QWidget):
    """Display, sort, filter, etc the database of availabe drive units."""

    new_manufacturer_added = QtCore.Signal(set)

    def __init__(self):
        """Initialize database frame."""
        QtGui.QWidget.__init__(self)

        self.table_widget = QtGui.QTableWidget(self)
        labels = ["Manufacturer", "Model", "d [in]", "Fs [Hz]", u"Vas [m³]",
                  u"Sd [m²]", "Qts", "Qes", "xmax [mm]", "m [kg]", 
                  "P (AES) [W]"]
        self.table_widget.setColumnCount(len(labels))
        self.table_widget.setHorizontalHeaderLabels(labels)

        # populate table
        for driver in config.driver_db:
            self.add_driver_entry(driver)

        add_driver_button = QtGui.QPushButton(self)
        add_driver_button.setIcon(QtGui.QIcon.fromTheme('list-add'))
        add_driver_button.setText("Add new driver")
        add_driver_button.clicked.connect(self.add_driver)
        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(add_driver_button, stretch=0)
        vbox.addWidget(self.table_widget)
        self.setLayout(vbox)

    def add_driver_entry(self, driver):
        """Add a new driver entry to the QTableWidget.

        Args:
            driver : driver to add to the table
        """
        rows = self.table_widget.rowCount()
        self.table_widget.setRowCount(rows+1)
<commit_msg>Enable sorting in driver DB<commit_after># -*- coding: utf-8 -*-
"""Display the driver database as a table."""
import PySide.QtGui as QtGui
import PySide.QtCore as QtCore
from . import config
from ..lib.driver import Driver


class DriverDatabaseFrame(QtGui.QWidget):
    """Display, sort, filter, etc the database of availabe drive units."""

    new_manufacturer_added = QtCore.Signal(set)

    def __init__(self):
        """Initialize database frame."""
        QtGui.QWidget.__init__(self)

        self.table_widget = QtGui.QTableWidget(self)
        self.table_widget.setSortingEnabled(True)
        labels = ["Manufacturer", "Model", "d [in]", "Fs [Hz]", u"Vas [m³]",
                  u"Sd [m²]", "Qts", "Qes", "xmax [mm]", "m [kg]", 
                  "P (AES) [W]"]
        self.table_widget.setColumnCount(len(labels))
        self.table_widget.setHorizontalHeaderLabels(labels)

        # populate table
        for driver in config.driver_db:
            self.add_driver_entry(driver)

        add_driver_button = QtGui.QPushButton(self)
        add_driver_button.setIcon(QtGui.QIcon.fromTheme('list-add'))
        add_driver_button.setText("Add new driver")
        add_driver_button.clicked.connect(self.add_driver)
        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(add_driver_button, stretch=0)
        vbox.addWidget(self.table_widget)
        self.setLayout(vbox)

    def add_driver_entry(self, driver):
        """Add a new driver entry to the QTableWidget.

        Args:
            driver : driver to add to the table
        """
        rows = self.table_widget.rowCount()
        self.table_widget.setRowCount(rows+1)

{'fraction_non_alphanumeric': 0.11975308641975309, 'fraction_numerical': 0.001851851851851852, 'mean_word_length': 2.7686046511627906, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2106124', 'n_tokens_mistral': 1017, 'n_tokens_neox': 985, 'n_words': 227}