371 return "&{0};".format( |
371 return "&{0};".format( |
372 html.entities.codepoint2name[symbolId]) |
372 html.entities.codepoint2name[symbolId]) |
373 elif col == 4: |
373 elif col == 4: |
374 return unicodedata.name(chr(symbolId), '').title() |
374 return unicodedata.name(chr(symbolId), '').title() |
375 |
375 |
376 if role == Qt.ItemDataRole.BackgroundColorRole: |
376 if ( |
377 if index.column() == 0: |
377 role == Qt.ItemDataRole.BackgroundColorRole and |
378 return QColor(Qt.GlobalColor.lightGray) |
378 index.column() == 0 |
|
379 ): |
|
380 return QColor(Qt.GlobalColor.lightGray) |
379 |
381 |
380 if role == Qt.ItemDataRole.TextColorRole: |
382 if role == Qt.ItemDataRole.TextColorRole: |
381 char = chr(symbolId) |
383 char = chr(symbolId) |
382 if self.__isDigit(char): |
384 if self.__isDigit(char): |
383 return QColor(Qt.GlobalColor.darkBlue) |
385 return QColor(Qt.GlobalColor.darkBlue) |
390 elif self.__isPunct(char): |
392 elif self.__isPunct(char): |
391 return QColor(Qt.GlobalColor.darkMagenta) |
393 return QColor(Qt.GlobalColor.darkMagenta) |
392 else: |
394 else: |
393 return QColor(Qt.GlobalColor.darkGray) |
395 return QColor(Qt.GlobalColor.darkGray) |
394 |
396 |
395 if role == Qt.ItemDataRole.TextAlignmentRole: |
397 if ( |
396 if index.column() in [0, 1, 3]: |
398 role == Qt.ItemDataRole.TextAlignmentRole and |
397 return Qt.AlignmentFlag.AlignHCenter |
399 index.column() in [0, 1, 3] |
|
400 ): |
|
401 return Qt.AlignmentFlag.AlignHCenter |
398 |
402 |
399 return None |
403 return None |
400 |
404 |
401 def columnCount(self, parent): |
405 def columnCount(self, parent): |
402 """ |
406 """ |