From d095bd4f83e0c8fcf9dc0b8306357d7cd5044d03 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 31 Jul 2017 09:34:58 +0530 Subject: [PATCH] Dont elide text when displaying tag mapper rules, instead show a horizontal scrollbar --- src/calibre/gui2/tag_mapper.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/tag_mapper.py b/src/calibre/gui2/tag_mapper.py index e65268a00c..83969d90d9 100644 --- a/src/calibre/gui2/tag_mapper.py +++ b/src/calibre/gui2/tag_mapper.py @@ -16,7 +16,7 @@ from PyQt5.Qt import ( ) from calibre.ebooks.metadata.tag_mapper import map_tags, compile_pat -from calibre.gui2 import error_dialog, elided_text, Application, question_dialog +from calibre.gui2 import error_dialog, Application, question_dialog from calibre.gui2.ui import get_gui from calibre.gui2.widgets2 import Dialog from calibre.utils.config import JSONConfig @@ -224,7 +224,7 @@ class RuleItem(QListWidgetItem): @staticmethod def text_from_rule(rule, parent): - query = elided_text(rule['query'], font=parent.font(), width=200, pos='right') + query = rule['query'] text = _( '{action} the tag, if it {match_type}: {query}').format( action=RuleEdit.ACTION_MAP[rule['action']], match_type=RuleEdit.MATCH_TYPE_MAP[rule['match_type']], query=query) @@ -232,7 +232,7 @@ class RuleItem(QListWidgetItem): text += '
' + _('with the tag:') + ' %s' % rule['replace'] if rule['action'] == 'split': text += '
' + _('on the character:') + ' %s' % rule['replace'] - return text + return '
' + text + '
' def __init__(self, rule, parent): QListWidgetItem.__init__(self, '', parent) @@ -252,7 +252,7 @@ class Delegate(QStyledItemDelegate): if width and width != st.textWidth(): st.setTextWidth(width) br = st.size() - return QSize(br.width(), br.height() + self.MARGIN) + return QSize(br.width() + self.MARGIN, br.height() + self.MARGIN) def paint(self, painter, option, index): QStyledItemDelegate.paint(self, painter, option, index) @@ -515,7 +515,7 @@ if __name__ == '__main__': d = RulesDialog() d.rules = [ {'action':'remove', 'query':'moose', 'match_type':'one_of', 'replace':''}, - {'action':'replace', 'query':'moose', 'match_type':'one_of', 'replace':'xxxx'}, + {'action':'replace', 'query':'moose,sfdg,sfdg,dfsg,dfgsh,sd,er,erg,egrer,ger,s,fgfsgfsga', 'match_type':'one_of', 'replace':'xxxx'}, {'action':'split', 'query':'/', 'match_type':'has', 'replace':'/'}, ] d.exec_()