UI/SymbolsWidget.py

branch
Py2 comp.
changeset 2526
a91cba8291b9
parent 2525
8b507a9a2d40
child 2538
b2642e7a4c18
equal deleted inserted replaced
2525:8b507a9a2d40 2526:a91cba8291b9
8 """ 8 """
9 9
10 from __future__ import unicode_literals # __IGNORE_WARNING__ 10 from __future__ import unicode_literals # __IGNORE_WARNING__
11 11
12 import unicodedata 12 import unicodedata
13 import html.entities 13 try: # Py3
14 import html.entities as html_entities
15 except (ImportError):
16 chr = unichr
17 import htmlentitydefs as html_entities # __IGNORE_WARNING__
14 18
15 from PyQt4.QtCore import pyqtSlot, pyqtSignal, QAbstractTableModel, QModelIndex, Qt, \ 19 from PyQt4.QtCore import pyqtSlot, pyqtSignal, QAbstractTableModel, QModelIndex, Qt, \
16 qVersion 20 qVersion
17 from PyQt4.QtGui import QWidget, QHeaderView, QAbstractItemView, QColor, \ 21 from PyQt4.QtGui import QWidget, QHeaderView, QAbstractItemView, QColor, \
18 QItemSelectionModel 22 QItemSelectionModel
230 elif col == 1: 234 elif col == 1:
231 return chr(id) 235 return chr(id)
232 elif col == 2: 236 elif col == 2:
233 return "0x{0:04x}".format(id) 237 return "0x{0:04x}".format(id)
234 elif col == 3: 238 elif col == 3:
235 if id in html.entities.codepoint2name: 239 if id in html_entities.codepoint2name:
236 return "&{0};".format(html.entities.codepoint2name[id]) 240 return "&{0};".format(html_entities.codepoint2name[id])
237 elif col == 4: 241 elif col == 4:
238 return unicodedata.name(chr(id), '').title() 242 return unicodedata.name(chr(id), '').title()
239 243
240 if role == Qt.BackgroundColorRole: 244 if role == Qt.BackgroundColorRole:
241 if index.column() == 0: 245 if index.column() == 0:

eric ide

mercurial