# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'form.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QGridLayout, QPushButton


class Ui_Qt_Cell_Grid(object):

    def generate_grid(self, parent, position_store_dict: dict[tuple[int, int], str]) -> None:

        parent.resize(372, 430)

        centralwidget = QtWidgets.QWidget(parent)
        centralwidget.setObjectName("centralwidget")
        parent.setCentralWidget(centralwidget)

        map_layout = QGridLayout(centralwidget)

        for pos, store in position_store_dict.items():
            widget = self.getCell(store)
            button = QPushButton(store)
            map_layout.addWidget(widget, pos[0], pos[1])

        # self.retranslateUi(parent)
        QtCore.QMetaObject.connectSlotsByName(parent)

    def getCell(self, store_name):

        # gridLayoutWidget = QtWidgets.QWidget()
        # gridLayoutWidget.setGeometry(QtCore.QRect(210, 130, 81, 101))
        # gridLayoutWidget.setObjectName("gridLayoutWidget")
        # gridLayout = QtWidgets.QGridLayout(gridLayoutWidget)
        # gridLayout.setContentsMargins(0, 0, 0, 0)
        # gridLayout.setObjectName("gridLayout")
        # label = QtWidgets.QLabel(gridLayoutWidget)
        # label.setObjectName("label")
        # gridLayout.addWidget(label, 0, 0, 1, 1)

        gridLayoutWidget = QtWidgets.QWidget()
        gridLayoutWidget.setGeometry(QtCore.QRect(210, 130, 81, 51))
        gridLayoutWidget.setObjectName("gridLayoutWidget")
        gridLayout = QtWidgets.QGridLayout(gridLayoutWidget)
        gridLayout.setContentsMargins(0, 0, 0, 0)
        gridLayout.setObjectName("gridLayout")
        frame = QtWidgets.QFrame(gridLayoutWidget)
        frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        frame.setFrameShadow(QtWidgets.QFrame.Raised)
        frame.setObjectName("frame")
        label = QtWidgets.QLabel(frame)
        label.setGeometry(QtCore.QRect(0, 10, 60, 16))
        label.setObjectName("label")
        gridLayout.addWidget(frame, 0, 0, 1, 1)

        # _translate = QtCore.QCoreApplication.translate
        label.setText(store_name)


        return gridLayoutWidget

    def retranslateUi(self, Qt_Grid):
        _translate = QtCore.QCoreApplication.translate
        Qt_Grid.setWindowTitle(_translate("Qt_Grid", "Qt_Grid"))
        # label.setText(_translate("Qt_Grid", "TextLabel"))

#
# if __name__ == "__main__":
#     import sys
#     app = QtWidgets.QApplication(sys.argv)
#     Qt_Grid = QtWidgets.QWidget()
#     ui = Ui_Qt_Cell_Grid()
#     ui.setupUi(Qt_Grid)
#     Qt_Grid.show()
#     sys.exit(app.exec_())
