File indexing completed on 2025-03-09 04:10:19
0001 # SPDX-License-Identifier: CC0-1.0 0002 0003 from PyQt5.QtWidgets import QWidget, QSpinBox, QFormLayout 0004 import math 0005 0006 0007 class RotateTool(QWidget): 0008 0009 def __init__(self, mainDialog, parent=None): 0010 super(RotateTool, self).__init__(parent) 0011 0012 self.setObjectName(i18n("Rotate")) 0013 0014 self.layout = QFormLayout() 0015 0016 self.degreesSpinBox = QSpinBox() 0017 0018 self.setLayout(self.layout) 0019 self.initialize() 0020 0021 def initialize(self): 0022 self.degreesSpinBox.setRange(-180, 180) 0023 self.degreesSpinBox.setToolTip( 0024 i18n("Negative degrees will rotate the image to the left")) 0025 0026 self.layout.addRow(i18n("Degrees:"), self.degreesSpinBox) 0027 0028 def adjust(self, documents): 0029 for document in documents: 0030 document.rotateImage(math.radians(self.degreesSpinBox.value()))