Source code for View_Window

"""
This module defines the ViewWindow class which handles the view-related operations
such as maximizing, minimizing, hiding image box, and hiding toolbar in the MoilApp application.

Dependencies:
- ShowResult: Import ShowImageResult class for displaying images.
- PyQt5: Import QtCore for handling size-related operations in the PyQt framework.

Classes:
- ViewWindow: Handles view-related operations for the main application window.
"""

from ShowResult import ShowImageResult
from PyQt5 import QtCore


[docs] class ViewWindow: """ The ViewWindow class manages view-related operations such as maximizing, minimizing, hiding image boxes, and hiding toolbars within 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 functions. """ self.parent.ui.actionMaximized.triggered.connect(self.show_Maximized) self.parent.ui.actionMinimized.triggered.connect(self.show_Minimized) self.parent.ui.actionsave_Image_box.triggered.connect(self.hideImageBox) self.parent.ui.actionToolbar.triggered.connect(self.hideToolbar)
[docs] def show_Maximized(self): """ Maximizes the image display area by hiding certain UI elements and increasing the image display size. """ if self.parent.image is None: pass else: self.parent.ui.scrollArea_2.hide() self.parent.ui.frameSaveImage.hide() self.parent.width_img = 2000 self.parent.ui.scrollArea_3.setMaximumSize(QtCore.QSize(self.parent.width_img, 16777215)) self.parent.application.applicationMoildevs() self.maxi = True
[docs] def show_Minimized(self): """ Minimizes the image display area by showing certain UI elements and decreasing the image display size. """ if self.parent.image is None: pass else: self.parent.ui.scrollArea_2.show() self.parent.ui.frameSaveImage.show() self.parent.width_img = 1400 self.parent.ui.scrollArea_3.setMaximumSize(QtCore.QSize(self.parent.width_img, 16777215)) self.parent.application.applicationMoildevs() self.maxi = False
[docs] def hideImageBox(self): """ Toggles the visibility of the image save frame based on the state of the save image box action. """ if self.parent.ui.actionsave_Image_box.isChecked(): self.parent.ui.frameSaveImage.show() else: self.parent.ui.frameSaveImage.hide()
[docs] def hideToolbar(self): """ Toggles the visibility of the toolbar based on the state of the toolbar action. """ if self.parent.ui.actionToolbar.isChecked(): self.parent.ui.toolBar.hide() else: self.parent.ui.toolBar.show()