From 9860cd989b0f6dff280a0bb9e31cc3cf992d5918 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 20 May 2010 23:09:45 -0600 Subject: [PATCH] Fix #5551 (CSS properties are affected by the selected UI translation) --- src/calibre/gui2/convert/look_and_feel.py | 23 ++++++++++++++++++++++- src/calibre/gui2/convert/look_and_feel.ui | 21 +-------------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/calibre/gui2/convert/look_and_feel.py b/src/calibre/gui2/convert/look_and_feel.py index e18657cf69..793d170a13 100644 --- a/src/calibre/gui2/convert/look_and_feel.py +++ b/src/calibre/gui2/convert/look_and_feel.py @@ -6,7 +6,7 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -from PyQt4.Qt import SIGNAL +from PyQt4.Qt import SIGNAL, QVariant from calibre.gui2.convert.look_and_feel_ui import Ui_Form from calibre.gui2.convert import Widget @@ -26,6 +26,12 @@ class LookAndFeelWidget(Widget, Ui_Form): 'remove_paragraph_spacing', 'remove_paragraph_spacing_indent_size','input_encoding', 'asciiize', 'keep_ligatures'] ) + for val, text in [ + ('original', _('Original')), + ('left', _('Left align')), + ('justify', _('Justify text')) + ]: + self.opt_change_justification.addItem(text, QVariant(val)) self.db, self.book_id = db, book_id self.initialize_options(get_option, get_help, db, book_id) self.opt_disable_font_rescaling.toggle() @@ -35,6 +41,21 @@ class LookAndFeelWidget(Widget, Ui_Form): self.opt_remove_paragraph_spacing.toggle() self.opt_remove_paragraph_spacing.toggle() + def get_value_handler(self, g): + if g is self.opt_change_justification: + ans = unicode(g.itemData(g.currentIndex()).toString()) + return ans + return Widget.get_value_handler(self, g) + + def set_value_handler(self, g, val): + if g is self.opt_change_justification: + for i in range(g.count()): + c = unicode(g.itemData(i).toString()) + if val == c: + g.setCurrentIndex(i) + break + return True + def font_key_wizard(self): from calibre.gui2.convert.font_key import FontKeyChooser d = FontKeyChooser(self, self.opt_base_font_size.value(), diff --git a/src/calibre/gui2/convert/look_and_feel.ui b/src/calibre/gui2/convert/look_and_feel.ui index 764226012b..ad8f0a42a9 100644 --- a/src/calibre/gui2/convert/look_and_feel.ui +++ b/src/calibre/gui2/convert/look_and_feel.ui @@ -191,26 +191,7 @@ - - - 2 - - - - justify - - - - - left - - - - - original - - - +