
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(168.0, 262, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(41, 1, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(78.85714285714286, 70, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(130, 1, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0
            self.template_parameters['Legande_size'] = QgsLayoutSize(168.0, 32, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(41, 264, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0
            self.template_parameters['Arrow_size'] = QgsLayoutSize(14.285714285714286, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(13, 254, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0
            self.template_parameters['Echelle_size'] = QgsLayoutSize(38.857142857142854, 7, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(1, 289, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0
            self.template_parameters['Logo_size'] = QgsLayoutSize(34.857142857142854, 10, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(3, 139, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0
            self.template_parameters['Titre_size'] = QgsLayoutSize(38.857142857142854, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(1, 3, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0
            self.template_parameters['Credit_size'] = QgsLayoutSize(74.85714285714286, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(43, 3, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 0
            self.template_parameters['Source_size'] = QgsLayoutSize(104.0, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(104, 256, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 0
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(38.857142857142854, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(1, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(38.857142857142854, 13, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(1, 276, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(30.0, 30, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(41, 233, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0
            self.template_parameters['Logo_2_rotate'] = 0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_frame'] = False
            self.template_parameters['Legande_frame'] = False
            self.template_parameters['Arrow_background'] = True
            self.template_parameters['Arrow_path'] = "NorthArrow_02.svg"
            self.template_parameters['Credit_alignment'] = 0x0002
            self.template_parameters['Source_alignment'] = 0x0002
        if values_page == 'A3':
            self.template_parameters['Carte_size'] = QgsLayoutSize(237, 369, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(58, 2, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(111, 99, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(183, 2, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0
            self.template_parameters['Legande_size'] = QgsLayoutSize(237, 45, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(58, 372, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0
            self.template_parameters['Arrow_size'] = QgsLayoutSize(20, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(19, 358, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0
            self.template_parameters['Echelle_size'] = QgsLayoutSize(55, 10, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(2, 408, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0
            self.template_parameters['Logo_size'] = QgsLayoutSize(49, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(4, 196, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0
            self.template_parameters['Titre_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(2, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0
            self.template_parameters['Credit_size'] = QgsLayoutSize(106, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(60, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 0
            self.template_parameters['Source_size'] = QgsLayoutSize(147, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(147, 361, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 0
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(55, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(2, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(55, 19, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(2, 389, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(42, 42, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(58, 329, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0
            self.template_parameters['Logo_2_rotate'] = 0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_frame'] = False
            self.template_parameters['Legande_frame'] = False
            self.template_parameters['Arrow_background'] = True
            self.template_parameters['Arrow_path'] = "NorthArrow_02.svg"
            self.template_parameters['Credit_alignment'] = 0x0002
            self.template_parameters['Source_alignment'] = 0x0002

    if page_rotate == 'Landscape':
        if values_page == 'A4':
            self.template_parameters['Carte_size'] = QgsLayoutSize(254.85714285714286, 175, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(41, 1, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(78.85714285714286, 70, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(217, 1, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0
            self.template_parameters['Legande_size'] = QgsLayoutSize(254.85714285714286, 32, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(41, 177, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0
            self.template_parameters['Arrow_size'] = QgsLayoutSize(14.285714285714286, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(13, 168, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0
            self.template_parameters['Echelle_size'] = QgsLayoutSize(38.857142857142854, 7, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(1, 202, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0
            self.template_parameters['Logo_size'] = QgsLayoutSize(34.857142857142854, 10, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(3, 94, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0
            self.template_parameters['Titre_size'] = QgsLayoutSize(38.857142857142854, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(1, 3, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0
            self.template_parameters['Credit_size'] = QgsLayoutSize(74.85714285714286, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(43, 3, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 0
            self.template_parameters['Source_size'] = QgsLayoutSize(104.0, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(190, 169, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 0
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(38.857142857142854, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(1, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(38.857142857142854, 13, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(1, 189, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(30.0, 30, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(41, 146, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0
            self.template_parameters['Logo_2_rotate'] = 0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_frame'] = False
            self.template_parameters['Legande_frame'] = False
            self.template_parameters['Arrow_background'] = True
            self.template_parameters['Arrow_path'] = "NorthArrow_02.svg"
            self.template_parameters['Credit_alignment'] = 0x0002
            self.template_parameters['Source_alignment'] = 0x0002
        if values_page == 'A3':
            self.template_parameters['Carte_size'] = QgsLayoutSize(359, 247, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(58, 2, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(111, 99, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(306, 2, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0
            self.template_parameters['Legande_size'] = QgsLayoutSize(359, 45, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(58, 250, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0
            self.template_parameters['Arrow_size'] = QgsLayoutSize(20, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(19, 237, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0
            self.template_parameters['Echelle_size'] = QgsLayoutSize(55, 10, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(2, 285, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0
            self.template_parameters['Logo_size'] = QgsLayoutSize(49, 14, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(4, 133, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0
            self.template_parameters['Titre_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(2, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0
            self.template_parameters['Credit_size'] = QgsLayoutSize(106, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(60, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 0
            self.template_parameters['Source_size'] = QgsLayoutSize(147, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(268, 238, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 0
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(55, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(2, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(55, 19, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(2, 267, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(42, 42, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(58, 206, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0
            self.template_parameters['Logo_2_rotate'] = 0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_frame'] = False
            self.template_parameters['Legande_frame'] = False
            self.template_parameters['Arrow_background'] = True
            self.template_parameters['Arrow_path'] = "NorthArrow_02.svg"
            self.template_parameters['Credit_alignment'] = 0x0002
            self.template_parameters['Source_alignment'] = 0x0002

    return self.template_parameters
