Krita Source Code Documentation
Loading...
Searching...
No Matches
rotatetool.py
Go to the documentation of this file.
1# SPDX-License-Identifier: CC0-1.0
2
3try:
4 from PyQt6.QtWidgets import QWidget, QSpinBox, QFormLayout
5except:
6 from PyQt5.QtWidgets import QWidget, QSpinBox, QFormLayout
7import math
8from builtins import i18n
9
10class RotateTool(QWidget):
11
12 def __init__(self, mainDialog, parent=None):
13 super(RotateTool, self).__init__(parent)
14
15 self.setObjectName(i18n("Rotate"))
16
17 self.layout = QFormLayout()
18
19 self.degreesSpinBox = QSpinBox()
20
21 self.setLayout(self.layout)
22 self.initialize()
23
24 def initialize(self):
25 self.degreesSpinBox.setRange(-180, 180)
26 self.degreesSpinBox.setToolTip(
27 i18n("Negative degrees will rotate the image to the left"))
28
29 self.layout.addRow(i18n("Degrees:"), self.degreesSpinBox)
30
31 def adjust(self, documents):
32 for document in documents:
33 document.rotateImage(math.radians(self.degreesSpinBox.value()))
float value(const T *src, size_t ch)