Source code for VIew_Rotate

"""
This module defines the Rotate class which handles the rotation of images
in the MoilApp application.

Dependencies:
- ShowResult: Import ShowImageResult class for displaying rotated images.

Classes:
- Rotate: Handles the image rotation functionality for the main application window.
"""

from ShowResult import ShowImageResult


[docs] class Rotate: """ The Rotate class manages the rotation of images in the main application window. Attributes: parent (MainWindow): The main application window instance. show (ShowImageResult): Instance of ShowImageResult for displaying images. """ def __init__(self, MainWindow): self.parent = MainWindow self.show = ShowImageResult(self.parent) self.connectToButton()
[docs] def connectToButton(self): """ Connects the UI buttons to their respective rotation functions. """ self.parent.ui.pushButton_21.clicked.connect(self.rotate_left) self.parent.ui.pushButton_22.clicked.connect(self.rotate_right)
[docs] def rotate_left(self): """ Rotates the image to the left by increasing the angle by 10 degrees, unless the angle is already 180 degrees. """ if self.parent.angle == 180: pass else: self.parent.angle += 10 self.show.showPanoAnyImage(self.parent.angle)
[docs] def rotate_right(self): """ Rotates the image to the right by decreasing the angle by 10 degrees, unless the angle is already -180 degrees. """ if self.parent.angle == 180: pass else: self.parent.angle -= 10 self.show.showPanoAnyImage(self.parent.angle)