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(198.85714285714286, 175, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(5, 25, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0.0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(50.0, 50, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(5, 25, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0.0
            self.template_parameters['Carte_2_frame'] = False
            self.template_parameters['Legande_size'] = QgsLayoutSize(198.85714285714286, 90, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(5, 205, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0.0
            self.template_parameters['Legande_frame'] = False
            self.template_parameters['Arrow_size'] = QgsLayoutSize(12.0, 12, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(191, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0.0
            self.template_parameters['Arrow_background'] = True
            self.template_parameters['Arrow_path'] = "NorthArrow_02.svg"
            self.template_parameters['Echelle_size'] = QgsLayoutSize(54.857142857142854, 5, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(145, 229, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0.0
            self.template_parameters['Logo_size'] = QgsLayoutSize(46.0, 16, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0.0
            self.template_parameters['Titre_size'] = QgsLayoutSize(198.85714285714286, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0.0
            self.template_parameters['Credit_size'] = QgsLayoutSize(100.0, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(205, 158.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 270.0
            self.template_parameters['Credit_alignment'] = 0x0002
            self.template_parameters['Source_size'] = QgsLayoutSize(100.0, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(104, 200, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 0.0
            self.template_parameters['Source_alignment'] = 0x0002
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(198.85714285714286, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(5, 12, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0.0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(54.857142857142854, 15, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(145, 215, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0.0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(50.0, 20, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(5, 275, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0.0
        if values_page == 'A3':
            self.template_parameters['Carte_size'] = QgsLayoutSize(280, 247, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(7, 35, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0.0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(70, 70, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(7, 35, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0.0
            self.template_parameters['Carte_2_frame'] = False
            self.template_parameters['Legande_size'] = QgsLayoutSize(280, 127, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(7, 289, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0.0
            self.template_parameters['Legande_frame'] = False
            self.template_parameters['Arrow_size'] = QgsLayoutSize(17, 17, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(269, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0.0
            self.template_parameters['Arrow_background'] = True
            self.template_parameters['Arrow_path'] = "NorthArrow_02.svg"
            self.template_parameters['Echelle_size'] = QgsLayoutSize(77, 7, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(205, 323, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0.0
            self.template_parameters['Logo_size'] = QgsLayoutSize(65, 23, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(7, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0.0
            self.template_parameters['Titre_size'] = QgsLayoutSize(280, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(7, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0.0
            self.template_parameters['Credit_size'] = QgsLayoutSize(141, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(289, 223, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 270.0
            self.template_parameters['Credit_alignment'] = 0x0002
            self.template_parameters['Source_size'] = QgsLayoutSize(141, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(147, 282, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 0.0
            self.template_parameters['Source_alignment'] = 0x0002
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(280, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(7, 17, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0.0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(77, 21, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(205, 303, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0.0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(70, 28, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(7, 388, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0.0

    if page_rotate == 'Landscape':
        if values_page == 'A4':
            self.template_parameters['Carte_size'] = QgsLayoutSize(285.14285714285717, 145, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0.0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(100.0, 100, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0.0
            self.template_parameters['Carte_2_frame'] = False
            self.template_parameters['Legande_size'] = QgsLayoutSize(285.14285714285717, 41, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(6, 168, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0.0
            self.template_parameters['Legande_frame'] = False
            self.template_parameters['Arrow_size'] = QgsLayoutSize(13.142857142857142, 12, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(277, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0.0
            self.template_parameters['Arrow_background'] = True
            self.template_parameters['Arrow_path'] = "NorthArrow_02.svg"
            self.template_parameters['Echelle_size'] = QgsLayoutSize(54.857142857142854, 15, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(232, 193, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0.0
            self.template_parameters['Logo_size'] = QgsLayoutSize(46.0, 16, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0.0
            self.template_parameters['Titre_size'] = QgsLayoutSize(286.0, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0.0
            self.template_parameters['Credit_size'] = QgsLayoutSize(100.0, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(291, 127.0, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 270.0
            self.template_parameters['Credit_alignment'] = 0x0002
            self.template_parameters['Source_size'] = QgsLayoutSize(100.0, 4, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(189, 169, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 0.0
            self.template_parameters['Source_alignment'] = 0x0002
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(286.0, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(5, 12, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0.0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(54.857142857142854, 15, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(232, 179, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0.0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(50.0, 50, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(6, 118, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0.0
        if values_page == 'A3':
            self.template_parameters['Carte_size'] = QgsLayoutSize(402, 205, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_locals'] = QgsLayoutPoint(8, 32, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_rotate'] = 0.0
            self.template_parameters['Carte_frame'] = True
            self.template_parameters['Carte_2_size'] = QgsLayoutSize(141, 141, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(8, 32, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Carte_2_rotate'] = 0.0
            self.template_parameters['Carte_2_frame'] = False
            self.template_parameters['Legande_size'] = QgsLayoutSize(402, 58, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_locals'] = QgsLayoutPoint(8, 237, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Legande_rotate'] = 0.0
            self.template_parameters['Legande_frame'] = False
            self.template_parameters['Arrow_size'] = QgsLayoutSize(19, 17, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_locals'] = QgsLayoutPoint(391, 8, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Arrow_rotate'] = 0.0
            self.template_parameters['Arrow_background'] = True
            self.template_parameters['Arrow_path'] = "NorthArrow_02.svg"
            self.template_parameters['Echelle_size'] = QgsLayoutSize(77, 21, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_locals'] = QgsLayoutPoint(327, 272, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_rotate'] = 0.0
            self.template_parameters['Logo_size'] = QgsLayoutSize(65, 23, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_locals'] = QgsLayoutPoint(7, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_rotate'] = 0.0
            self.template_parameters['Titre_size'] = QgsLayoutSize(403, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_locals'] = QgsLayoutPoint(7, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Titre_rotate'] = 0.0
            self.template_parameters['Credit_size'] = QgsLayoutSize(141, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_locals'] = QgsLayoutPoint(410, 179, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Credit_rotate'] = 270.0
            self.template_parameters['Credit_alignment'] = 0x0002
            self.template_parameters['Source_size'] = QgsLayoutSize(141, 6, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_locals'] = QgsLayoutPoint(267, 238, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Source_rotate'] = 0.0
            self.template_parameters['Source_alignment'] = 0x0002
            self.template_parameters['Sous_titre_size'] = QgsLayoutSize(403, 11, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(7, 17, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Sous_titre_rotate'] = 0.0
            self.template_parameters['Echelle_2_size'] = QgsLayoutSize(77, 21, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(327, 252, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Echelle_2_rotate'] = 0.0
            self.template_parameters['Logo_2_size'] = QgsLayoutSize(70, 70, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(8, 166, QgsUnitTypes.LayoutMillimeters)
            self.template_parameters['Logo_2_rotate'] = 0.0

    return self.template_parameters
