
from qgis.core import (
    QgsLayoutSize,
    QgsUnitTypes,
    QgsLayoutPoint,
)


def fletch_canvas(self):
    if self.radioButton_6.isChecked():
        values_page = 'A4'
    else:
        values_page = 'A3'
    if self.radioButton_7.isChecked():
        page_rotate = 'Portrait'
    else:
        page_rotate = 'Landscape'

    if page_rotate == 'Portrait':
        if values_page == 'A4':
            self.template_parameters['Carte_size'] = QgsLayoutSize(145.0, 135, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(4, 18, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(50, 40, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(146, 21, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0
            self.template_parameters['Carte_2_frame'] = True
            self.template_parameters['Legande_size'] = QgsLayoutSize(198.85714285714286, 36, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(153, 64, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0
            self.template_parameters['Legande_frame'] = True
            self.template_parameters['Arrow_size'] = QgsLayoutSize(14.0, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(6, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0
            self.template_parameters['Arrow_background'] = False
            self.template_parameters['Arrow_path'] = "NorthArrow_03.svg"
            self.template_parameters['Echelle_size'] = QgsLayoutSize(50.0, 10, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(154, 220, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0
            self.template_parameters['Logo_size'] = QgsLayoutSize(40.0, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(148, 267, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0
            self.template_parameters['Titre_size'] = QgsLayoutSize(205.0, 10, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(2, 1, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0
            self.template_parameters['Credit_size'] = QgsLayoutSize(145.0, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(4, 147.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 0
            self.template_parameters['Credit_alignment'] = 0x0001
            self.template_parameters['Source_size'] = QgsLayoutSize(145.0, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(4, 141.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 0
            self.template_parameters['Source_alignment'] = 0x0001
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(205, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(2, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(50.0, 13, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(162, 208, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(80.0, 35, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(128, 234, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0
        if values_page == 'A3':
            self.template_parameters['Carte_size'] = QgsLayoutSize(233.0, 192, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(4, 18, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(50, 40, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(234, 21, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0
            self.template_parameters['Carte_2_frame'] = True
            self.template_parameters['Legande_size'] = QgsLayoutSize(190, 36, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(242, 64, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0
            self.template_parameters['Legande_frame'] = True
            self.template_parameters['Arrow_size'] = QgsLayoutSize(14.0, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(6, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0
            self.template_parameters['Arrow_background'] = False
            self.template_parameters['Arrow_path'] = "NorthArrow_03.svg"
            self.template_parameters['Echelle_size'] = QgsLayoutSize(50.0, 10, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(154, 220, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0
            self.template_parameters['Logo_size'] = QgsLayoutSize(40.0, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(248, 386, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0
            self.template_parameters['Titre_size'] = QgsLayoutSize(293.0, 10, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(2, 1, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0
            self.template_parameters['Credit_size'] = QgsLayoutSize(233.0, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(4, 204.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 0
            self.template_parameters['Credit_alignment'] = 0x0001
            self.template_parameters['Source_size'] = QgsLayoutSize(233.0, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(4, 198.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 0
            self.template_parameters['Source_alignment'] = 0x0001
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(293, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(2, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(50.0, 13, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(252, 330, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(40.0, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(160, 234, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0
    if page_rotate == 'Landscape':
        if values_page == 'A4':
            self.template_parameters['Carte_size'] = QgsLayoutSize(145.0, 140, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(150, 27.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(40.0, 30, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(253, 144.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0
            self.template_parameters['Carte_2_frame'] = True
            self.template_parameters['Legande_size'] = QgsLayoutSize(110.0, 30, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(183, 175.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0
            self.template_parameters['Legande_frame'] = True
            self.template_parameters['Arrow_size'] = QgsLayoutSize(14.0, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(278, 29.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0
            self.template_parameters['Arrow_background'] = False
            self.template_parameters['Arrow_path'] = "NorthArrow_03.svg"
            self.template_parameters['Echelle_size'] = QgsLayoutSize(50, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(138, 191, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0
            self.template_parameters['Logo_size'] = QgsLayoutSize(40.0, 30, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(7, 175.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0
            self.template_parameters['Titre_size'] = QgsLayoutSize(288.0, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(3, 1.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0
            self.template_parameters['Credit_size'] = QgsLayoutSize(140, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(150, 167, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 270
            self.template_parameters['Credit_alignment'] = 0x0001
            self.template_parameters['Source_size'] = QgsLayoutSize(140, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(156, 167, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 270
            self.template_parameters['Source_alignment'] = 0x0001
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(288.0, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(3, 11.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(50, 13, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(138, 180, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(80.0, 35, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(52, 172, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0
        if values_page == 'A3':
            self.template_parameters['Carte_size'] = QgsLayoutSize(200.0, 230, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(216, 27.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(40.0, 30, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(373, 234.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0
            self.template_parameters['Carte_2_frame'] = True
            self.template_parameters['Legande_size'] = QgsLayoutSize(110.0, 30, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(253, 264.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0
            self.template_parameters['Legande_frame'] = True
            self.template_parameters['Arrow_size'] = QgsLayoutSize(14.0, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(401, 29.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0
            self.template_parameters['Arrow_background'] = False
            self.template_parameters['Arrow_path'] = "NorthArrow_03.svg"
            self.template_parameters['Echelle_size'] = QgsLayoutSize(50, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(150, 281, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0
            self.template_parameters['Logo_size'] = QgsLayoutSize(40.0, 30, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(7, 265.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0
            self.template_parameters['Titre_size'] = QgsLayoutSize(413.0, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(3, 1.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0
            self.template_parameters['Credit_size'] = QgsLayoutSize(230, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(216, 257, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 270
            self.template_parameters['Credit_alignment'] = 0x0001
            self.template_parameters['Source_size'] = QgsLayoutSize(230, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(222, 257, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 270
            self.template_parameters['Source_alignment'] = 0x0001
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(413.0, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(3, 11.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(50, 13, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(150, 270, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(40.0, 30, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(72, 265, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0
    return self.template_parameters
