from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QSizePolicy
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import Qt
import sys, os

class InfoWidget(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setup_ui()

    def setup_ui(self):
        layout = QVBoxLayout()
        self.setLayout(layout)

        image_label = QLabel()
        image_path = self.resource_path("images/realrabbit2.png")
        pixmap = QPixmap(image_path) 
        scaled_pixmap = pixmap.scaled(400,500, Qt.KeepAspectRatio, Qt.SmoothTransformation)
        image_label.setPixmap(scaled_pixmap)
        image_label.setAlignment(Qt.AlignCenter)
        layout.addWidget(image_label)

        self.info_label = QLabel('''
                                 This is \'Bunny Sync\' Application !\n
                                 Thank you for using the app 🤗\n
                                 App Version 1.0\n
                                 Made by PINB\n
                                 ''')
        self.info_label.setAlignment(Qt.AlignCenter)
        layout.addWidget(self.info_label)

    def resource_path(self, relative_path):
        if hasattr(sys, '_MEIPASS'):
            return os.path.join(sys._MEIPASS, relative_path)
        return os.path.join(os.path.abspath("."), relative_path)