9 |
9 |
10 import sys |
10 import sys |
11 import unicodedata |
11 import unicodedata |
12 import html.entities |
12 import html.entities |
13 |
13 |
14 from PyQt5.QtCore import ( |
14 from PyQt6.QtCore import ( |
15 pyqtSlot, pyqtSignal, QAbstractTableModel, QModelIndex, Qt, |
15 pyqtSlot, pyqtSignal, QAbstractTableModel, QModelIndex, Qt, |
16 QItemSelectionModel, QLocale |
16 QItemSelectionModel, QLocale |
17 ) |
17 ) |
18 from PyQt5.QtGui import QColor |
18 from PyQt6.QtGui import QColor |
19 from PyQt5.QtWidgets import QWidget, QHeaderView, QAbstractItemView |
19 from PyQt6.QtWidgets import QWidget, QHeaderView, QAbstractItemView |
20 |
20 |
21 from .Ui_SymbolsWidget import Ui_SymbolsWidget |
21 from .Ui_SymbolsWidget import Ui_SymbolsWidget |
22 |
22 |
23 import UI.PixmapCache |
23 import UI.PixmapCache |
24 import Preferences |
24 import Preferences |
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 ( |
376 if ( |
377 role == Qt.ItemDataRole.BackgroundColorRole and |
377 role == Qt.ItemDataRole.BackgroundRole and |
378 index.column() == 0 |
378 index.column() == 0 |
379 ): |
379 ): |
380 return QColor(Qt.GlobalColor.lightGray) |
380 return QColor(Qt.GlobalColor.lightGray) |
381 |
381 |
382 if role == Qt.ItemDataRole.TextColorRole: |
382 if role == Qt.ItemDataRole.ForegroundRole: |
383 char = chr(symbolId) |
383 char = chr(symbolId) |
384 if self.__isDigit(char): |
384 if self.__isDigit(char): |
385 return QColor(Qt.GlobalColor.darkBlue) |
385 return QColor(Qt.GlobalColor.darkBlue) |
386 elif self.__isLetter(char): |
386 elif self.__isLetter(char): |
387 return QColor(Qt.GlobalColor.darkGreen) |
387 return QColor(Qt.GlobalColor.darkGreen) |