diff --git a/src/calibre/gui2/dialogs/trim_image.py b/src/calibre/gui2/dialogs/trim_image.py index ab5bbc8a37..b3c039821d 100644 --- a/src/calibre/gui2/dialogs/trim_image.py +++ b/src/calibre/gui2/dialogs/trim_image.py @@ -7,7 +7,22 @@ __copyright__ = '2013, Kovid Goyal ' import os import sys -from qt.core import QCheckBox, QDialog, QDialogButtonBox, QFormLayout, QHBoxLayout, QIcon, QKeySequence, QLabel, QSize, QSpinBox, QDoubleSpinBox, Qt, QToolBar, QVBoxLayout +from qt.core import ( + QCheckBox, + QDialog, + QDialogButtonBox, + QDoubleSpinBox, + QFormLayout, + QHBoxLayout, + QIcon, + QKeySequence, + QLabel, + QSize, + QSpinBox, + Qt, + QToolBar, + QVBoxLayout, +) from calibre.gui2 import gprefs from calibre.gui2.tweak_book.editor.canvas import Canvas @@ -37,11 +52,12 @@ class Region(QDialog): h.valueChanged.connect(self.value_changed) l.addRow(_('&Height:'), h) self.ratio_input = r = QDoubleSpinBox(self) - r.setRange(0.0, 5.00), r.setDecimals(2), r.setValue(max_width/max_height), r.setSingleStep(0.01), r.setToolTip('For example, use 0.75 for kindle devices.') + r.setRange(0.0, 5.00), r.setDecimals(2), r.setValue(max_width/max_height), r.setSingleStep(0.01) + r.setToolTip(_('For example, use 0.75 for kindle devices.')) self.m_width = max_width self.m_height = max_height r.valueChanged.connect(self.aspect_changed) - l.addRow(_('&Adjust Aspect Ratio:'), r) + l.addRow(_('&Aspect ratio:'), r) self.const_aspect = ca = QCheckBox(_('Keep the ratio of width to height fixed')) ca.toggled.connect(self.const_aspect_toggled) l.addRow(ca) @@ -57,6 +73,7 @@ class Region(QDialog): l.addRow(bb) self.resize(self.sizeHint()) self.current_aspect = width / height + self.ratio_input.setEnabled(not self.const_aspect.isChecked()) def aspect_changed(self): inp = float(self.ratio_input.value()) @@ -69,6 +86,7 @@ class Region(QDialog): self.height_input.setValue(self.m_height) def const_aspect_toggled(self): + self.ratio_input.setEnabled(not self.const_aspect.isChecked()) if self.const_aspect.isChecked(): self.current_aspect = self.width_input.value() / self.height_input.value()