from collections import namedtuple

from PySide2 import QtCore, QtGui, QtWidgets

from guis.g_quotation import GQuotation
from guis.g_panel import GPanel
from guis.g_price_bar_chart import GPriceBarChart
from my_qt.buttons import CheckableMenuButton
from my_qt.charts import PriceBarChart
from my_qt.date_edits import NoWheelDateEdit
from my_qt.combo_boxes import SearchCombo
from my_qt.spin_boxes import NoWheelSpinBox, NoWheelDoubleSpinBox
from resources import url_back, url_save, url_plus, url_minus
from utilities.various import color_gray, color_red


class GPanelQuotation(GPriceBarChart, GPanel, GQuotation):
    def __init__(self, window):
        super(GPriceBarChart, self).__init__()
        super(GPanel, self).__init__(window)

        self.setup_gui()

    # Edited: SearchCombo, NoWheelSpinBox, NoWheelDoubleSpinBox, NoWheelDateEdit, PriceBarChartView(+delete below)
    def setup_gui(self):
        self.w.centralWidget = QtWidgets.QWidget(self.w)
        self.w.centralWidget.setObjectName('centralWidget')
        self.w.verticalLayout = QtWidgets.QVBoxLayout(self.w.centralWidget)
        self.w.verticalLayout.setSpacing(16)
        self.w.verticalLayout.setObjectName('verticalLayout')
        self.w.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.w.horizontalLayout_3.setObjectName('horizontalLayout_3')
        self.w.buttonBack = QtWidgets.QPushButton(self.w.centralWidget)
        self.w.buttonBack.setMinimumSize(QtCore.QSize(50, 40))
        self.w.buttonBack.setMaximumSize(QtCore.QSize(50, 40))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.w.buttonBack.setFont(font)
        self.w.buttonBack.setText('')
        self.w.buttonBack.setObjectName('buttonBack')
        self.w.horizontalLayout_3.addWidget(self.w.buttonBack)
        self.w.labelTitle = QtWidgets.QLabel(self.w.centralWidget)
        font = QtGui.QFont()
        font.setPointSize(25)
        self.w.labelTitle.setFont(font)
        self.w.labelTitle.setAlignment(QtCore.Qt.AlignCenter)
        self.w.labelTitle.setObjectName('labelTitle')
        self.w.horizontalLayout_3.addWidget(self.w.labelTitle)
        spacerItem = QtWidgets.QSpacerItem(50, 40, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
        self.w.horizontalLayout_3.addItem(spacerItem)
        self.w.verticalLayout.addLayout(self.w.horizontalLayout_3)
        self.w.scrollArea = QtWidgets.QScrollArea(self.w.centralWidget)
        self.w.scrollArea.setWidgetResizable(True)
        self.w.scrollArea.setObjectName('scrollArea')
        self.w.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.w.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 1178, 751))
        self.w.scrollAreaWidgetContents.setObjectName('scrollAreaWidgetContents')
        self.w.horizontalLayout_7 = QtWidgets.QHBoxLayout(self.w.scrollAreaWidgetContents)
        self.w.horizontalLayout_7.setSpacing(50)
        self.w.horizontalLayout_7.setObjectName('horizontalLayout_7')
        spacerItem1 = QtWidgets.QSpacerItem(29, 50, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.w.horizontalLayout_7.addItem(spacerItem1)
        self.w.verticalLayout_2 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_2.setObjectName('verticalLayout_2')
        self.w.groupGeneral = QtWidgets.QGroupBox(self.w.scrollAreaWidgetContents)
        self.w.groupGeneral.setMinimumSize(QtCore.QSize(250, 0))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(75)
        font.setBold(True)
        self.w.groupGeneral.setFont(font)
        self.w.groupGeneral.setAlignment(QtCore.Qt.AlignCenter)
        self.w.groupGeneral.setObjectName('groupGeneral')
        self.w.verticalLayout_3 = QtWidgets.QVBoxLayout(self.w.groupGeneral)
        self.w.verticalLayout_3.setSpacing(20)
        self.w.verticalLayout_3.setObjectName('verticalLayout_3')
        self.w.verticalLayout_12 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_12.setSpacing(2)
        self.w.verticalLayout_12.setObjectName('verticalLayout_12')
        self.w.labelCompany = QtWidgets.QLabel(self.w.groupGeneral)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelCompany.setFont(font)
        self.w.labelCompany.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelCompany.setObjectName('labelCompany')
        self.w.verticalLayout_12.addWidget(self.w.labelCompany)
        self.w.horizontalLayout_6 = QtWidgets.QHBoxLayout()
        self.w.horizontalLayout_6.setObjectName('horizontalLayout_6')
        self.w.comboCompany = SearchCombo(self.w.groupGeneral)
        self.w.comboCompany.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setWeight(50)
        font.setBold(False)
        self.w.comboCompany.setFont(font)
        self.w.comboCompany.setObjectName('comboCompany')
        self.w.horizontalLayout_6.addWidget(self.w.comboCompany)
        self.w.buttonAddCompany = QtWidgets.QPushButton(self.w.groupGeneral)
        self.w.buttonAddCompany.setMinimumSize(QtCore.QSize(30, 30))
        self.w.buttonAddCompany.setMaximumSize(QtCore.QSize(30, 30))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.buttonAddCompany.setFont(font)
        self.w.buttonAddCompany.setText('')
        self.w.buttonAddCompany.setObjectName('buttonAddCompany')
        self.w.horizontalLayout_6.addWidget(self.w.buttonAddCompany)
        self.w.verticalLayout_12.addLayout(self.w.horizontalLayout_6)
        self.w.verticalLayout_3.addLayout(self.w.verticalLayout_12)
        self.w.verticalLayout_28 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_28.setSpacing(2)
        self.w.verticalLayout_28.setObjectName('verticalLayout_28')
        self.w.labelMark = QtWidgets.QLabel(self.w.groupGeneral)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelMark.setFont(font)
        self.w.labelMark.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelMark.setObjectName('labelMark')
        self.w.verticalLayout_28.addWidget(self.w.labelMark)
        self.w.comboMark = SearchCombo(self.w.groupGeneral)
        self.w.comboMark.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setWeight(50)
        font.setBold(False)
        self.w.comboMark.setFont(font)
        self.w.comboMark.setObjectName('comboMark')
        self.w.verticalLayout_28.addWidget(self.w.comboMark)
        self.w.verticalLayout_3.addLayout(self.w.verticalLayout_28)
        self.w.verticalLayout_13 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_13.setSpacing(2)
        self.w.verticalLayout_13.setObjectName('verticalLayout_13')
        self.w.labelTotalPower = QtWidgets.QLabel(self.w.groupGeneral)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelTotalPower.setFont(font)
        self.w.labelTotalPower.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelTotalPower.setObjectName('labelTotalPower')
        self.w.verticalLayout_13.addWidget(self.w.labelTotalPower)
        self.w.spinTotalPower = NoWheelDoubleSpinBox(self.w.groupGeneral)
        self.w.spinTotalPower.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.spinTotalPower.setFont(font)
        self.w.spinTotalPower.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.w.spinTotalPower.setDecimals(3)
        self.w.spinTotalPower.setMaximum(9999999999.0)
        self.w.spinTotalPower.setObjectName('spinTotalPower')
        self.w.verticalLayout_13.addWidget(self.w.spinTotalPower)
        self.w.verticalLayout_3.addLayout(self.w.verticalLayout_13)
        self.w.verticalLayout_14 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_14.setSpacing(2)
        self.w.verticalLayout_14.setObjectName('verticalLayout_14')
        self.w.labelPrice = QtWidgets.QLabel(self.w.groupGeneral)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelPrice.setFont(font)
        self.w.labelPrice.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelPrice.setObjectName('labelPrice')
        self.w.verticalLayout_14.addWidget(self.w.labelPrice)
        self.w.spinPrice = NoWheelDoubleSpinBox(self.w.groupGeneral)
        self.w.spinPrice.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.spinPrice.setFont(font)
        self.w.spinPrice.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.w.spinPrice.setDecimals(4)
        self.w.spinPrice.setMaximum(9999999999.0)
        self.w.spinPrice.setObjectName('spinPrice')
        self.w.verticalLayout_14.addWidget(self.w.spinPrice)
        self.w.verticalLayout_3.addLayout(self.w.verticalLayout_14)
        self.w.verticalLayout_15 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_15.setSpacing(2)
        self.w.verticalLayout_15.setObjectName('verticalLayout_15')
        self.w.labelDateQuotation = QtWidgets.QLabel(self.w.groupGeneral)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelDateQuotation.setFont(font)
        self.w.labelDateQuotation.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelDateQuotation.setObjectName('labelDateQuotation')
        self.w.verticalLayout_15.addWidget(self.w.labelDateQuotation)
        self.w.dateQuotation = NoWheelDateEdit(self.w.groupGeneral)
        self.w.dateQuotation.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.dateQuotation.setFont(font)
        self.w.dateQuotation.setCalendarPopup(True)
        self.w.dateQuotation.setObjectName('dateQuotation')
        self.w.verticalLayout_15.addWidget(self.w.dateQuotation)
        self.w.verticalLayout_3.addLayout(self.w.verticalLayout_15)
        self.w.verticalLayout_16 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_16.setSpacing(2)
        self.w.verticalLayout_16.setObjectName('verticalLayout_16')
        self.w.labelDateValidity = QtWidgets.QLabel(self.w.groupGeneral)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelDateValidity.setFont(font)
        self.w.labelDateValidity.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelDateValidity.setObjectName('labelDateValidity')
        self.w.verticalLayout_16.addWidget(self.w.labelDateValidity)
        self.w.dateValidity = NoWheelDateEdit(self.w.groupGeneral)
        self.w.dateValidity.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.dateValidity.setFont(font)
        self.w.dateValidity.setCalendarPopup(True)
        self.w.dateValidity.setObjectName('dateValidity')
        self.w.verticalLayout_16.addWidget(self.w.dateValidity)
        self.w.verticalLayout_3.addLayout(self.w.verticalLayout_16)
        self.w.verticalLayout_27 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_27.setSpacing(2)
        self.w.verticalLayout_27.setObjectName('verticalLayout_27')
        self.w.labelNContacts = QtWidgets.QLabel(self.w.groupGeneral)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelNContacts.setFont(font)
        self.w.labelNContacts.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelNContacts.setObjectName('labelNContacts')
        self.w.verticalLayout_27.addWidget(self.w.labelNContacts)
        self.w.spinNContacts = NoWheelSpinBox(self.w.groupGeneral)
        self.w.spinNContacts.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.spinNContacts.setFont(font)
        self.w.spinNContacts.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.w.spinNContacts.setMaximum(9999)
        self.w.spinNContacts.setProperty('value', 1)
        self.w.spinNContacts.setObjectName('spinNContacts')
        self.w.verticalLayout_27.addWidget(self.w.spinNContacts)
        self.w.verticalLayout_3.addLayout(self.w.verticalLayout_27)
        self.w.verticalLayout_17 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_17.setSpacing(2)
        self.w.verticalLayout_17.setObjectName('verticalLayout_17')
        self.w.labelUser = QtWidgets.QLabel(self.w.groupGeneral)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelUser.setFont(font)
        self.w.labelUser.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelUser.setObjectName('labelUser')
        self.w.verticalLayout_17.addWidget(self.w.labelUser)
        self.w.comboUser = SearchCombo(self.w.groupGeneral)
        self.w.comboUser.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setWeight(50)
        font.setBold(False)
        self.w.comboUser.setFont(font)
        self.w.comboUser.setObjectName('comboUser')
        self.w.verticalLayout_17.addWidget(self.w.comboUser)
        self.w.verticalLayout_3.addLayout(self.w.verticalLayout_17)
        self.w.verticalLayout_18 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_18.setSpacing(2)
        self.w.verticalLayout_18.setObjectName('verticalLayout_18')
        self.w.labelObservations = QtWidgets.QLabel(self.w.groupGeneral)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelObservations.setFont(font)
        self.w.labelObservations.setObjectName('labelObservations')
        self.w.verticalLayout_18.addWidget(self.w.labelObservations)
        self.w.textObservations = QtWidgets.QTextEdit(self.w.groupGeneral)
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.textObservations.setFont(font)
        self.w.textObservations.setObjectName('textObservations')
        self.w.verticalLayout_18.addWidget(self.w.textObservations)
        self.w.verticalLayout_3.addLayout(self.w.verticalLayout_18)
        self.w.verticalLayout_2.addWidget(self.w.groupGeneral)
        self.w.horizontalLayout_7.addLayout(self.w.verticalLayout_2)
        spacerItem2 = QtWidgets.QSpacerItem(50, 50, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.w.horizontalLayout_7.addItem(spacerItem2)
        self.w.verticalLayout_4 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_4.setObjectName('verticalLayout_4')
        self.w.groupPanel = QtWidgets.QGroupBox(self.w.scrollAreaWidgetContents)
        self.w.groupPanel.setMinimumSize(QtCore.QSize(250, 0))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(75)
        font.setBold(True)
        self.w.groupPanel.setFont(font)
        self.w.groupPanel.setAlignment(QtCore.Qt.AlignCenter)
        self.w.groupPanel.setObjectName('groupPanel')
        self.w.verticalLayout_6 = QtWidgets.QVBoxLayout(self.w.groupPanel)
        self.w.verticalLayout_6.setSpacing(20)
        self.w.verticalLayout_6.setObjectName('verticalLayout_6')
        self.w.verticalLayout_19 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_19.setSpacing(2)
        self.w.verticalLayout_19.setObjectName('verticalLayout_19')
        self.w.labelPanelType = QtWidgets.QLabel(self.w.groupPanel)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelPanelType.setFont(font)
        self.w.labelPanelType.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelPanelType.setObjectName('labelPanelType')
        self.w.verticalLayout_19.addWidget(self.w.labelPanelType)
        self.w.comboPanelType = SearchCombo(self.w.groupPanel)
        self.w.comboPanelType.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setWeight(50)
        font.setBold(False)
        self.w.comboPanelType.setFont(font)
        self.w.comboPanelType.setObjectName('comboPanelType')
        self.w.verticalLayout_19.addWidget(self.w.comboPanelType)
        self.w.verticalLayout_6.addLayout(self.w.verticalLayout_19)
        self.w.verticalLayout_20 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_20.setSpacing(2)
        self.w.verticalLayout_20.setObjectName('verticalLayout_20')
        self.w.labelCells = QtWidgets.QLabel(self.w.groupPanel)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelCells.setFont(font)
        self.w.labelCells.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelCells.setObjectName('labelCells')
        self.w.verticalLayout_20.addWidget(self.w.labelCells)
        self.w.comboCells = SearchCombo(self.w.groupPanel)
        self.w.comboCells.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setWeight(50)
        font.setBold(False)
        self.w.comboCells.setFont(font)
        self.w.comboCells.setObjectName('comboCells')
        self.w.verticalLayout_20.addWidget(self.w.comboCells)
        self.w.verticalLayout_6.addLayout(self.w.verticalLayout_20)
        self.w.verticalLayout_21 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_21.setSpacing(2)
        self.w.verticalLayout_21.setObjectName('verticalLayout_21')
        self.w.labelPanelPower = QtWidgets.QLabel(self.w.groupPanel)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelPanelPower.setFont(font)
        self.w.labelPanelPower.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelPanelPower.setObjectName('labelPanelPower')
        self.w.verticalLayout_21.addWidget(self.w.labelPanelPower)
        self.w.spinPanelPower = NoWheelSpinBox(self.w.groupPanel)
        self.w.spinPanelPower.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.spinPanelPower.setFont(font)
        self.w.spinPanelPower.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.w.spinPanelPower.setMaximum(999999999)
        self.w.spinPanelPower.setObjectName('spinPanelPower')
        self.w.verticalLayout_21.addWidget(self.w.spinPanelPower)
        self.w.verticalLayout_6.addLayout(self.w.verticalLayout_21)
        self.w.verticalLayout_29 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_29.setSpacing(2)
        self.w.verticalLayout_29.setObjectName('verticalLayout_29')
        self.w.labelEfficiency = QtWidgets.QLabel(self.w.groupPanel)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelEfficiency.setFont(font)
        self.w.labelEfficiency.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelEfficiency.setObjectName('labelEfficiency')
        self.w.verticalLayout_29.addWidget(self.w.labelEfficiency)
        self.w.spinEfficiency = NoWheelDoubleSpinBox(self.w.groupPanel)
        self.w.spinEfficiency.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.spinEfficiency.setFont(font)
        self.w.spinEfficiency.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.w.spinEfficiency.setDecimals(2)
        self.w.spinEfficiency.setMaximum(100.0)
        self.w.spinEfficiency.setObjectName('spinEfficiency')
        self.w.verticalLayout_29.addWidget(self.w.spinEfficiency)
        self.w.verticalLayout_6.addLayout(self.w.verticalLayout_29)
        self.w.verticalLayout_30 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_30.setSpacing(2)
        self.w.verticalLayout_30.setObjectName('verticalLayout_30')
        self.w.groupTolerance = QtWidgets.QGroupBox(self.w.groupPanel)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.groupTolerance.setFont(font)
        self.w.groupTolerance.setObjectName('groupTolerance')
        self.w.verticalLayout_8 = QtWidgets.QVBoxLayout(self.w.groupTolerance)
        self.w.verticalLayout_8.setObjectName('verticalLayout_8')
        self.w.horizontalLayout_8 = QtWidgets.QHBoxLayout()
        self.w.horizontalLayout_8.setObjectName('horizontalLayout_8')
        self.w.radioPositiveTolerance = QtWidgets.QRadioButton(self.w.groupTolerance)
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.radioPositiveTolerance.setFont(font)
        self.w.radioPositiveTolerance.setChecked(True)
        self.w.radioPositiveTolerance.setObjectName('radioPositiveTolerance')
        self.w.buttonGroup = QtWidgets.QButtonGroup(self.w.centralWidget)
        self.w.buttonGroup.setObjectName('buttonGroup')
        self.w.buttonGroup.addButton(self.w.radioPositiveTolerance)
        self.w.horizontalLayout_8.addWidget(self.w.radioPositiveTolerance)
        self.w.radioNegativeTolerance = QtWidgets.QRadioButton(self.w.groupTolerance)
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.radioNegativeTolerance.setFont(font)
        self.w.radioNegativeTolerance.setObjectName('radioNegativeTolerance')
        self.w.buttonGroup.addButton(self.w.radioNegativeTolerance)
        self.w.horizontalLayout_8.addWidget(self.w.radioNegativeTolerance)
        self.w.verticalLayout_8.addLayout(self.w.horizontalLayout_8)
        self.w.verticalLayout_30.addWidget(self.w.groupTolerance)
        self.w.verticalLayout_6.addLayout(self.w.verticalLayout_30)
        self.w.verticalLayout_32 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_32.setSpacing(2)
        self.w.verticalLayout_32.setObjectName('verticalLayout_32')
        self.w.labelWarrantyProduct = QtWidgets.QLabel(self.w.groupPanel)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelWarrantyProduct.setFont(font)
        self.w.labelWarrantyProduct.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelWarrantyProduct.setObjectName('labelWarrantyProduct')
        self.w.verticalLayout_32.addWidget(self.w.labelWarrantyProduct)
        self.w.spinWarrantyProduct = NoWheelSpinBox(self.w.groupPanel)
        self.w.spinWarrantyProduct.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.spinWarrantyProduct.setFont(font)
        self.w.spinWarrantyProduct.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.w.spinWarrantyProduct.setMaximum(9999)
        self.w.spinWarrantyProduct.setObjectName('spinWarrantyProduct')
        self.w.verticalLayout_32.addWidget(self.w.spinWarrantyProduct)
        self.w.verticalLayout_6.addLayout(self.w.verticalLayout_32)
        self.w.verticalLayout_33 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_33.setSpacing(2)
        self.w.verticalLayout_33.setObjectName('verticalLayout_33')
        self.w.labelWarrantyPerformance = QtWidgets.QLabel(self.w.groupPanel)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelWarrantyPerformance.setFont(font)
        self.w.labelWarrantyPerformance.setAlignment(
            QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelWarrantyPerformance.setObjectName('labelWarrantyPerformance')
        self.w.verticalLayout_33.addWidget(self.w.labelWarrantyPerformance)
        self.w.spinWarrantyPerformance = NoWheelSpinBox(self.w.groupPanel)
        self.w.spinWarrantyPerformance.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(50)
        font.setBold(False)
        self.w.spinWarrantyPerformance.setFont(font)
        self.w.spinWarrantyPerformance.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.w.spinWarrantyPerformance.setMaximum(9999)
        self.w.spinWarrantyPerformance.setObjectName('spinWarrantyPerformance')
        self.w.verticalLayout_33.addWidget(self.w.spinWarrantyPerformance)
        self.w.verticalLayout_6.addLayout(self.w.verticalLayout_33)
        self.w.verticalLayout_22 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_22.setSpacing(2)
        self.w.verticalLayout_22.setObjectName('verticalLayout_22')
        self.w.labelCertificates = QtWidgets.QLabel(self.w.groupPanel)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelCertificates.setFont(font)
        self.w.labelCertificates.setObjectName('labelCertificates')
        self.w.verticalLayout_22.addWidget(self.w.labelCertificates)
        self.w.buttonCertificates = CheckableMenuButton(self.w.groupPanel)
        self.w.buttonCertificates.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setWeight(50)
        font.setBold(False)
        self.w.buttonCertificates.setFont(font)
        self.w.buttonCertificates.setText('')
        self.w.buttonCertificates.setObjectName('buttonCertificates')
        self.w.verticalLayout_22.addWidget(self.w.buttonCertificates)
        self.w.verticalLayout_6.addLayout(self.w.verticalLayout_22)
        self.w.verticalLayout_4.addWidget(self.w.groupPanel)
        spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.w.verticalLayout_4.addItem(spacerItem3)
        self.w.horizontalLayout_7.addLayout(self.w.verticalLayout_4)
        spacerItem4 = QtWidgets.QSpacerItem(50, 50, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.w.horizontalLayout_7.addItem(spacerItem4)
        self.w.verticalLayout_11 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_11.setObjectName('verticalLayout_11')
        self.w.horizontalLayout = QtWidgets.QHBoxLayout()
        self.w.horizontalLayout.setObjectName('horizontalLayout')
        spacerItem5 = QtWidgets.QSpacerItem(50, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.w.horizontalLayout.addItem(spacerItem5)
        self.w.verticalLayout_5 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_5.setObjectName('verticalLayout_5')
        self.w.groupGeographical = QtWidgets.QGroupBox(self.w.scrollAreaWidgetContents)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.w.groupGeographical.sizePolicy().hasHeightForWidth())
        self.w.groupGeographical.setSizePolicy(sizePolicy)
        self.w.groupGeographical.setMinimumSize(QtCore.QSize(250, 0))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(75)
        font.setBold(True)
        self.w.groupGeographical.setFont(font)
        self.w.groupGeographical.setAlignment(QtCore.Qt.AlignCenter)
        self.w.groupGeographical.setObjectName('groupGeographical')
        self.w.verticalLayout_7 = QtWidgets.QVBoxLayout(self.w.groupGeographical)
        self.w.verticalLayout_7.setSpacing(20)
        self.w.verticalLayout_7.setObjectName('verticalLayout_7')
        self.w.verticalLayout_23 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_23.setSpacing(2)
        self.w.verticalLayout_23.setObjectName('verticalLayout_23')
        self.w.labelIncoterm = QtWidgets.QLabel(self.w.groupGeographical)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelIncoterm.setFont(font)
        self.w.labelIncoterm.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelIncoterm.setObjectName('labelIncoterm')
        self.w.verticalLayout_23.addWidget(self.w.labelIncoterm)
        self.w.comboIncoterm = SearchCombo(self.w.groupGeographical)
        self.w.comboIncoterm.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setWeight(50)
        font.setBold(False)
        self.w.comboIncoterm.setFont(font)
        self.w.comboIncoterm.setObjectName('comboIncoterm')
        self.w.verticalLayout_23.addWidget(self.w.comboIncoterm)
        self.w.verticalLayout_7.addLayout(self.w.verticalLayout_23)
        self.w.verticalLayout_24 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_24.setSpacing(2)
        self.w.verticalLayout_24.setObjectName('verticalLayout_24')
        self.w.labelMadeIn = QtWidgets.QLabel(self.w.groupGeographical)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelMadeIn.setFont(font)
        self.w.labelMadeIn.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelMadeIn.setObjectName('labelMadeIn')
        self.w.verticalLayout_24.addWidget(self.w.labelMadeIn)
        self.w.comboMadeIn = SearchCombo(self.w.groupGeographical)
        self.w.comboMadeIn.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setWeight(50)
        font.setBold(False)
        self.w.comboMadeIn.setFont(font)
        self.w.comboMadeIn.setObjectName('comboMadeIn')
        self.w.verticalLayout_24.addWidget(self.w.comboMadeIn)
        self.w.verticalLayout_7.addLayout(self.w.verticalLayout_24)
        self.w.verticalLayout_25 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_25.setSpacing(2)
        self.w.verticalLayout_25.setObjectName('verticalLayout_25')
        self.w.labelOrigin = QtWidgets.QLabel(self.w.groupGeographical)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelOrigin.setFont(font)
        self.w.labelOrigin.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelOrigin.setObjectName('labelOrigin')
        self.w.verticalLayout_25.addWidget(self.w.labelOrigin)
        self.w.comboOrigin = SearchCombo(self.w.groupGeographical)
        self.w.comboOrigin.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setWeight(50)
        font.setBold(False)
        self.w.comboOrigin.setFont(font)
        self.w.comboOrigin.setObjectName('comboOrigin')
        self.w.verticalLayout_25.addWidget(self.w.comboOrigin)
        self.w.verticalLayout_7.addLayout(self.w.verticalLayout_25)
        self.w.verticalLayout_26 = QtWidgets.QVBoxLayout()
        self.w.verticalLayout_26.setSpacing(2)
        self.w.verticalLayout_26.setObjectName('verticalLayout_26')
        self.w.labelDestination = QtWidgets.QLabel(self.w.groupGeographical)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(50)
        font.setBold(False)
        self.w.labelDestination.setFont(font)
        self.w.labelDestination.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.w.labelDestination.setObjectName('labelDestination')
        self.w.verticalLayout_26.addWidget(self.w.labelDestination)
        self.w.comboDestination = SearchCombo(self.w.groupGeographical)
        self.w.comboDestination.setMinimumSize(QtCore.QSize(0, 30))
        font = QtGui.QFont()
        font.setWeight(50)
        font.setBold(False)
        self.w.comboDestination.setFont(font)
        self.w.comboDestination.setObjectName('comboDestination')
        self.w.verticalLayout_26.addWidget(self.w.comboDestination)
        self.w.verticalLayout_7.addLayout(self.w.verticalLayout_26)
        self.w.verticalLayout_5.addWidget(self.w.groupGeographical)
        self.w.horizontalLayout.addLayout(self.w.verticalLayout_5)
        spacerItem6 = QtWidgets.QSpacerItem(35, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.w.horizontalLayout.addItem(spacerItem6)
        self.w.verticalLayout_11.addLayout(self.w.horizontalLayout)
        spacerItem7 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.w.verticalLayout_11.addItem(spacerItem7)
        self.w.priceBarChart = PriceBarChart(self.my_strings)
        self.w.verticalLayout_11.addWidget(self.w.priceBarChart)
        spacerItem8 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.w.verticalLayout_11.addItem(spacerItem8)
        self.w.verticalLayout_11.setStretch(2, 1)
        self.w.horizontalLayout_7.addLayout(self.w.verticalLayout_11)
        spacerItem9 = QtWidgets.QSpacerItem(50, 50, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.w.horizontalLayout_7.addItem(spacerItem9)
        self.w.horizontalLayout_7.setStretch(0, 2)
        self.w.horizontalLayout_7.setStretch(1, 4)
        self.w.horizontalLayout_7.setStretch(2, 2)
        self.w.horizontalLayout_7.setStretch(3, 4)
        self.w.horizontalLayout_7.setStretch(5, 5)
        self.w.horizontalLayout_7.setStretch(6, 2)
        self.w.scrollArea.setWidget(self.w.scrollAreaWidgetContents)
        self.w.verticalLayout.addWidget(self.w.scrollArea)
        self.w.horizontalLayout_13 = QtWidgets.QHBoxLayout()
        self.w.horizontalLayout_13.setSpacing(30)
        self.w.horizontalLayout_13.setObjectName('horizontalLayout_13')
        spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.w.horizontalLayout_13.addItem(spacerItem10)
        self.w.buttonNew = QtWidgets.QToolButton(self.w.centralWidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.w.buttonNew.sizePolicy().hasHeightForWidth())
        self.w.buttonNew.setSizePolicy(sizePolicy)
        self.w.buttonNew.setMaximumSize(QtCore.QSize(200, 16777215))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.w.buttonNew.setFont(font)
        self.w.buttonNew.setIconSize(QtCore.QSize(40, 40))
        self.w.buttonNew.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        self.w.buttonNew.setObjectName('buttonNew')
        self.w.horizontalLayout_13.addWidget(self.w.buttonNew)
        self.w.buttonOverwrite = QtWidgets.QToolButton(self.w.centralWidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.w.buttonOverwrite.sizePolicy().hasHeightForWidth())
        self.w.buttonOverwrite.setSizePolicy(sizePolicy)
        self.w.buttonOverwrite.setMaximumSize(QtCore.QSize(200, 16777215))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.w.buttonOverwrite.setFont(font)
        self.w.buttonOverwrite.setIconSize(QtCore.QSize(40, 40))
        self.w.buttonOverwrite.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        self.w.buttonOverwrite.setObjectName('buttonOverwrite')
        self.w.horizontalLayout_13.addWidget(self.w.buttonOverwrite)
        spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.w.horizontalLayout_13.addItem(spacerItem11)
        self.w.verticalLayout.addLayout(self.w.horizontalLayout_13)
        spacerItem12 = QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
        self.w.verticalLayout.addItem(spacerItem12)
        self.w.setCentralWidget(self.w.centralWidget)

        self.w.labelTitle.setText(self.my_strings.title_panel_quotation)
        self.w.labelCompany.setText(f"{color_gray(self.my_strings.label_company)} {color_red('*')}")
        self.w.labelMark.setText(color_gray(self.my_strings.label_mark))
        self.w.labelTotalPower.setText(f"{color_gray(self.my_strings.label_total_power)} {color_red('*')}")
        self.w.labelPrice.setText(f"{color_gray(self.my_strings.label_price)} {color_red('*')}")
        self.w.labelDateQuotation.setText(color_gray(self.my_strings.label_date_quotation))
        self.w.labelDateValidity.setText(color_gray(self.my_strings.label_date_validity))
        self.w.labelNContacts.setText(color_gray(self.my_strings.label_n_contacts))
        self.w.labelUser.setText(f"{color_gray(self.my_strings.label_user)} {color_red('*')}")
        self.w.labelObservations.setText(color_gray(self.my_strings.label_observations))
        self.w.labelPanelType.setText(color_gray(self.my_strings.label_type))
        self.w.labelCells.setText(color_gray(self.my_strings.label_cells))
        self.w.labelPanelPower.setText(f"{color_gray(self.my_strings.label_panel_power)} {color_red('*')}")
        self.w.labelEfficiency.setText(color_gray(self.my_strings.label_efficiency))
        self.w.labelWarrantyProduct.setText(color_gray(self.my_strings.label_warranty_product))
        self.w.labelWarrantyPerformance.setText(color_gray(self.my_strings.label_warranty_performance))
        self.w.labelCertificates.setText(color_gray(self.my_strings.label_certificates))
        self.w.labelIncoterm.setText(color_gray(self.my_strings.label_incoterm))
        self.w.labelMadeIn.setText(color_gray(self.my_strings.label_made_in))
        self.w.labelOrigin.setText(color_gray(self.my_strings.label_origin))
        self.w.labelDestination.setText(color_gray(self.my_strings.label_destination))

        self.w.buttonBack.setIcon(QtGui.QIcon(url_back))
        self.w.buttonBack.setIconSize(QtCore.QSize(32, 32))
        self.w.buttonNew.setIcon(QtGui.QIcon(url_save))
        self.w.buttonNew.setIconSize(QtCore.QSize(40, 40))
        self.w.buttonNew.setText(self.my_strings.button_new)
        self.w.buttonOverwrite.setIcon(QtGui.QIcon(url_save))
        self.w.buttonOverwrite.setIconSize(QtCore.QSize(40, 40))
        self.w.buttonOverwrite.setText(self.my_strings.button_overwrite)
        self.w.buttonOverwrite.setVisible(False)
        self.w.buttonAddCompany.setIcon(QtGui.QIcon(url_plus))
        self.w.buttonAddCompany.setIconSize(QtCore.QSize(12, 12))

        self.w.radioPositiveTolerance.setText(self.my_strings.radio_positive)
        self.w.radioNegativeTolerance.setText(self.my_strings.radio_negative)

        self.w.spinTotalPower.setSuffix(' kW')
        self.w.spinPrice.setSuffix(' €/W')
        self.w.spinPanelPower.setSuffix(' W')
        self.w.spinEfficiency.setSuffix(' %')
        self._update_suffix_year()

        today = QtCore.QDate.currentDate()
        self.w.dateQuotation.setDate(today)
        self.w.dateValidity.setDate(today.addDays(30))

        self.w.groupGeneral.setTitle(self.my_strings.group_general)
        self.w.groupPanel.setTitle(self.my_strings.group_panel)
        self.w.groupGeographical.setTitle(self.my_strings.group_geographical)
        self.w.groupTolerance.setTitle(self.my_strings.group_tolerance)
        self.w.groupTolerance.setStyleSheet('QGroupBox:title {color: #555555}')

        # Coloring
        self.w.centralWidget.setStyleSheet('.QWidget{background-color: rgb(238, 240, 245)}')

    def connect_signals(self, controller):
        super(GPanelQuotation, self).connect_signals(controller)
        super(GPriceBarChart, self).connect_signals(controller)
        super(GPanel, self).connect_signals(controller)

        self.w.comboCompany.currentTextChanged.connect(lambda: self.w.comboCompany.validate_hard())
        self.w.comboPanelType.currentTextChanged.connect(lambda: self.w.comboPanelType.validate_soft())
        self.w.comboPanelType.currentTextChanged.connect(lambda: controller.update_current_type_average())
        self.w.comboCells.currentTextChanged.connect(lambda: self.w.comboCells.validate_soft())

        self.w.dateQuotation.dateChanged.connect(controller.changed_date)
        self.w.dateValidity.dateChanged.connect(controller.changed_date)

    @property
    def cells(self):
        return self.w.comboCells.currentText()

    @cells.setter
    def cells(self, text):
        self.w.comboCells.setCurrentText(text)

    @property
    def data(self):
        Data = namedtuple('Data',
                          ('company', 'mark', 'total_power', 'price', 'date_quotation', 'date_validity', 'n_contacts',
                           'user', 'observations', 'panel_type', 'cells', 'panel_power', 'efficiency', 'tolerance',
                           'warranty_product', 'warranty_performance', 'certificates', 'incoterm', 'made_in', 'origin',
                           'destination')
                          )
        return Data(
            self.company,
            self.mark,
            self.total_power,
            self.price,
            self.date_quotation,
            self.date_validity,
            self.n_contacts,
            self.user,
            self.observations,

            self.panel_type,
            self.cells,
            self.panel_power,
            self.efficiency,
            self.tolerance,
            self.warranty_product,
            self.warranty_performance,
            self.checked_certificates,

            self.incoterm,
            self.made_in,
            self.origin,
            self.destination
        )

    @property
    def panel_type(self):
        return self.w.comboPanelType.currentText()

    @panel_type.setter
    def panel_type(self, text):
        self.w.comboPanelType.setCurrentText(text)

    def load_initial_data(self,
                          company_names,
                          mark_names,
                          date_quotation,
                          date_validity,
                          user_names,
                          last_user,
                          panel_type_names,
                          cells_numbers,
                          certificate_names,
                          incoterm_names,
                          place_names,
                          default):
        self.w.comboCompany.items = company_names
        self.w.comboMark.items = mark_names
        self.w.comboUser.items = user_names
        self.w.comboPanelType.items = panel_type_names
        self.w.comboCells.items = cells_numbers
        self.w.buttonCertificates.items = certificate_names
        self.w.comboIncoterm.items = incoterm_names
        self.w.comboMadeIn.items = place_names
        self.w.comboOrigin.items = place_names
        self.w.comboDestination.items = place_names

        if default:
            self.date_quotation = date_quotation
            self.date_validity = date_validity
            if last_user:
                self.user = last_user.name

            self.w.spinTotalPower.validate_hard()
            self.w.spinPrice.validate_hard()
            self.w.comboUser.validate_hard()
            self.w.spinPanelPower.validate_hard()
        else:
            self.w.comboMark.validate_soft()
            self.w.comboUser.validate_soft()
            self.w.comboPanelType.validate_soft()
            self.w.comboCells.validate_soft()
            self.w.comboIncoterm.validate_soft()
            self.w.comboMadeIn.validate_soft()
            self.w.comboOrigin.validate_soft()
            self.w.comboDestination.validate_soft()

    def load_item_data(self, panel_quotation):
        self.company = panel_quotation.company
        self.mark = panel_quotation.mark
        self.total_power = panel_quotation.total_power
        self.price = panel_quotation.price
        self.date_quotation = panel_quotation.date_quotation
        self.date_validity = panel_quotation.date_validity
        self.n_contacts = panel_quotation.n_contacts
        self.user = panel_quotation.user
        self.observations = panel_quotation.observations

        self.panel_type = panel_quotation.panel_type
        self.cells = panel_quotation.cells
        self.checked_certificates = panel_quotation.certificates
        self.panel_power = panel_quotation.panel_power
        self.efficiency = panel_quotation.efficiency
        self.tolerance = panel_quotation.tolerance
        self.warranty_product = panel_quotation.warranty_product
        self.warranty_performance = panel_quotation.warranty_performance
        self.checked_certificates = panel_quotation.certificates

        self.incoterm = panel_quotation.incoterm
        self.made_in = panel_quotation.made_in
        self.origin = panel_quotation.origin
        self.destination = panel_quotation.destination
