<commit_before># http://doc.qt.io/qt-4.8/modelview.html
# http://doc.qt.io/qt-4.8/modelview.html#2-3-a-clock-inside-a-table-cell

from PySide import QtGui
from PySide import QtCore

Qt = QtCore.Qt


class MyModel(QtCore.QAbstractTableModel):
    def __init__(self, parent):
        super(MyModel, self).__init__(parent)
        self.topLeftCellIndex = self.createIndex(0, 0)
        self.timer = QtCore.QTimer(self)
        self.timer.setInterval(1000)
        self.timer.timeout.connect(self.timerHit)
        self.timer.start()
    
    def timerHit(self):
        # emit a signal to make the view reread identified data
        # When the model is attached to the view, the dataChanged signal
        # is connected to a slot in the view!!
        self.dataChanged.emit(self.topLeftCellIndex, self.topLeftCellIndex)
    
    def rowCount(self, modelIndex):
        return 2
    
    def columnCount(self, modelIndex):
        return 3
    
    def data(self, modelIndex, role=Qt.ItemDataRole.DisplayRole):
        row = modelIndex.row()
        column = modelIndex.column()
        
        if role == Qt.ItemDataRole.DisplayRole:
            return QtCore.QTime.currentTime().toString()
        elif role == Qt.ItemDataRole.FontRole:
            if modelIndex == self.timerIndex:
                boldFont = QtGui.QFont()
                boldFont.setBold(True)
                return boldFont
        elif role == Qt.ItemDataRole.TextAlignmentRole:
            return Qt.AlignVCenter
        return ""


tableView = QtGui.QTableView()

tableView.show()

myModel = MyModel(None)

tableView.setModel(myModel)

# Implicit signal/slot connections
# The model's dataChanged signal is connected to a slot in the view!<commit_msg>model/view: Timer update : Fixed copy/paste error and added debug print statements<commit_after># http://doc.qt.io/qt-4.8/modelview.html
# http://doc.qt.io/qt-4.8/modelview.html#2-3-a-clock-inside-a-table-cell

from PySide import QtGui
from PySide import QtCore

Qt = QtCore.Qt


class MyModel(QtCore.QAbstractTableModel):
    def __init__(self, parent):
        super(MyModel, self).__init__(parent)
        self.topLeftCellIndex = self.createIndex(0, 0)
        self.timer = QtCore.QTimer(self)
        self.timer.setInterval(5000)
        self.timer.timeout.connect(self.timerHit)
        self.timer.start()
    
    def timerHit(self):
        # emit a signal to make the view reread identified data
        # When the model is attached to the view, the dataChanged signal
        # is connected to a slot in the view!!
        print "Timer timed out"
        self.dataChanged.emit(self.topLeftCellIndex, self.topLeftCellIndex)
        print "Inform the view that it needs to update the specified modelIndex"
    
    def rowCount(self, modelIndex):
        return 2
    
    def columnCount(self, modelIndex):
        return 3
    
    def data(self, modelIndex, role=Qt.ItemDataRole.DisplayRole):
        row = modelIndex.row()
        column = modelIndex.column()
        
        if role == Qt.ItemDataRole.DisplayRole:
            if modelIndex == self.topLeftCellIndex:
                print "Time changed"
            return QtCore.QTime.currentTime().toString()
        elif role == Qt.ItemDataRole.FontRole:
            if modelIndex == self.topLeftCellIndex:
                boldFont = QtGui.QFont()
                boldFont.setBold(True)
                return boldFont
        elif role == Qt.ItemDataRole.TextAlignmentRole:
            return Qt.AlignVCenter
        return ""


tableView = QtGui.QTableView()

tableView.show()


myModel = MyModel(None)
tableView.setModel(myModel)
# Implicit signal/slot connections
# The model's dataChanged signal is connected to a slot in the view!

"""
Time changed
Timer timed out
Inform the view that it needs to update the specified modelIndex
Time changed
Timer timed out
Inform the view that it needs to update the specified modelIndex
Time changed
Timer timed out
Inform the view that it needs to update the specified modelIndex
Time changed
Timer timed out
Inform the view that it needs to update the specified modelIndex
Time changed
"""

{'fraction_non_alphanumeric': 0.08626120668766658, 'fraction_numerical': 0.006784589290041192, 'mean_word_length': 2.6370044052863437, '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': '2480271', 'n_tokens_mistral': 1224, 'n_tokens_neox': 1185, 'n_words': 341}