from PySide6.QtWidgets import (
    QGraphicsView
)
from PySide6.QtGui import QPainter
from PySide6.QtCore import Qt

from .scene import KeyboardScene
from app.core.config import settings

class KeyboardView(QGraphicsView):
    def __init__(self):
        super().__init__()
        self.scene = KeyboardScene()
        self.setScene(self.scene)
        self.setRenderHint(QPainter.Antialiasing)
        self.setWindowTitle(settings.APP_NAME)
        self.setAlignment(Qt.AlignLeft | Qt.AlignTop)
        self.setMinimumSize(600, 300)

    def resizeEvent(self, event):
        super().resizeEvent(event)
        self.scene.layout_keys(self.viewport().size())
