mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
...
This commit is contained in:
parent
e3b0de4829
commit
1815ea092a
@ -476,6 +476,7 @@ class CharDelegate(QStyledItemDelegate):
|
|||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QStyledItemDelegate.__init__(self, parent)
|
QStyledItemDelegate.__init__(self, parent)
|
||||||
self.item_size = QSize(32, 32)
|
self.item_size = QSize(32, 32)
|
||||||
|
self.np_pat = re.compile(r'(sp|j|nj|ss|fs|ds)$')
|
||||||
|
|
||||||
def sizeHint(self, option, index):
|
def sizeHint(self, option, index):
|
||||||
return self.item_size
|
return self.item_size
|
||||||
@ -501,10 +502,10 @@ class CharDelegate(QStyledItemDelegate):
|
|||||||
painter.drawText(option.rect, Qt.AlignHCenter | Qt.AlignBottom | Qt.TextSingleLine, chr(charcode))
|
painter.drawText(option.rect, Qt.AlignHCenter | Qt.AlignBottom | Qt.TextSingleLine, chr(charcode))
|
||||||
|
|
||||||
def paint_non_printing(self, painter, option, charcode):
|
def paint_non_printing(self, painter, option, charcode):
|
||||||
text = re.sub(r'(sp|j|nj|ss|fs|ds)$', r'\n\1', non_printing[charcode])
|
text = self.np_pat.sub(r'\n\1', non_printing[charcode])
|
||||||
painter.drawText(option.rect, Qt.AlignCenter | Qt.TextWordWrap | Qt.TextWrapAnywhere, text)
|
painter.drawText(option.rect, Qt.AlignCenter | Qt.TextWordWrap | Qt.TextWrapAnywhere, text)
|
||||||
painter.setPen(QPen(Qt.DashLine))
|
painter.setPen(QPen(Qt.DashLine))
|
||||||
painter.drawRect(option.rect)
|
painter.drawRect(option.rect.adjusted(1, 1, -1, -1))
|
||||||
|
|
||||||
class CharView(QListView):
|
class CharView(QListView):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user