Beispiel #1
0
    def m_button_save_as_pdfOnButtonClick(self, event):
        from coreapps.controllers.definisi import rerata2
        print("tes over here 'em'")
        if self.no_database == 1:
            self.hasil_subdimensi = self.x
            self.hasil_dimensi = self.y
            print(self.rincian_data_peserta)
            self.bio_data = []
            for bio in self.rincian_data_peserta[0]:
                if self.rincian_data_peserta[0].index(bio) <= 1:
                    pass
                else:
                    self.bio_data.append(bio)
            print(self.bio_data)
            if self.rincian_data_peserta[0][5] == "Laki - Laki":
                print("laki - laki ini")
                self.m_choice1.SetSelection(0)
            else:
                print("perempuan ini")
                self.m_choice1.SetSelection(1)
        elif self.no_database == 0:
            self.bio_data = ControlEntry(self)
            print(self.bio_data.get_input_biodata())
            print("tess ajaj")
            self.bio_data = self.bio_data.get_input_biodata()

            self.hitung = HitungData(self)
            self.hasil_subdimensi, self.hasil_dimensi = self.hitung.hitung()
        # print (self.hasil_dimensi)
        # print (self.hasil_subdimensi)

        select = self.m_choice1.GetSelection()
        self.jenis_kelamin = self.m_choice1.GetString(select)

        for k, v in self.hasil_dimensi.items():
            self.hasil_subdimensi[k] = round(v, 2)
#         print ("Nilai Total dimensi + sub dimensi {} {}".format(nilai_dimensi,nilai_sub_dimensi))
#         print (self.jenis_kelamin)
        self.definisi = rerata2(self.jenis_kelamin, self.hasil_subdimensi)
        # print ([*self.hasil_subdimensi])
        # print (self.definisi)
        dimensi = [*self.hasil_subdimensi]
        self.definisi.insert(20, self.definisi[30])
        self.definisi.insert(16, self.definisi[30])
        self.definisi.insert(12, self.definisi[30])
        self.definisi.insert(8, self.definisi[30])
        self.definisi.insert(4, self.definisi[30])
        self.definisi.insert(0, self.definisi[30])

        for i in range(0, 6):
            del self.definisi[-1]
        self.data = []
        for k in self.definisi:
            for dim in dimensi:
                if k[0] == dim:
                    self.data.append(
                        [k[0], self.hasil_subdimensi[dim], k[1], k[2], k[3]])
#         print ("data ini {}".format(self.data))

# print (self.data)
        for i in self.data:
            # print (i)
            pass
        print("stop disini")

        from coreapps.controllers.reporting.report import pdf_data

        self.pdf = pdf_data(self.bio_data, self.data)

        from coreapps.controllers.turunan_dialog_save_pdf import TurunanDialogSavePDF
        self.buka_dialog_savePDF = TurunanDialogSavePDF(self)
        self.buka_dialog_savePDF.Show()
    def __init__(self, parent):
        super(GrafikA, self).__init__(parent)
        #         buat konstruktor
        self.parent = parent
        self.matplotlib = matplotlib
        self.np = np
        self.plt = plt

        self.figure = Figure(figsize=(2, 2))
        self.figure.subplots_adjust(bottom=None,
                                    left=None,
                                    top=None,
                                    right=0.975,
                                    wspace=0.3,
                                    hspace=None)
        #         self.figure.tight_layout()

        self.axes_grafik_o = self.figure.add_subplot(111)

        #         Menambah jumlah grafik di sisi sebelah kanan
        #         self.axes_Interestial_Scale = self.figure.add_subplot(7, 2, 14)

        self.canvas = FigureCanvas(self.m_Grafik_Terpisah, -1, self.figure)

        self.sizer32 = wx.BoxSizer(wx.VERTICAL)
        self.sizer32.Add(self.canvas, 1, wx.ALL | wx.EXPAND)
        self.m_Grafik_Terpisah.SetSizer(self.sizer32)

        # Example data
        nilai_dimensi = self.parent.hasil_dimensi
        nilai_sub_dimensi = self.parent.hasil_subdimensi
        #
        self.value = ["Forgiveness", "Gentleness", "Flexibility", "Patience"]
        self.y_pos = self.np.arange(len(self.value))
        #         self.performance = 3 + 10 * self.np.random.rand(len(self.value))
        self.performance = [
            nilai_sub_dimensi["Forgiveness"], nilai_sub_dimensi["Gentleness"],
            nilai_sub_dimensi["Flexibility"], nilai_sub_dimensi["Patience"]
        ]

        self.color = Colour()
        self.color.colors_agreeableness
        self.ax = self.axes_grafik_o.bar(self.y_pos,
                                         self.performance,
                                         width=0.4,
                                         align='center',
                                         color=self.color.colors_agreeableness)

        #           Fungsi untuk menampilkan label di dalam Bar
        def autolabel(rects):
            """
            Attach a text label above each bar displaying its height
            """

            for rect in rects:
                height = rect.get_height()
                frac_height = height / 5
                if frac_height > 0.95:
                    label_position = height - (0.1 * height)
                else:
                    label_position = height + (0.1 * height)
                self.axes_grafik_o.text(rect.get_x() + rect.get_width() / 2.,
                                        label_position,
                                        '{}'.format(round(height, 2)),
                                        ha='center',
                                        va='bottom')

        autolabel(self.ax)

        self.axes_grafik_o.set_xticks(self.y_pos)
        self.axes_grafik_o.set_xticklabels(self.value)
        #         self.axes_grafik_o.set_xlabel('Sub Dimensi')
        self.axes_grafik_o.set_ylim(bottom=0, top=5)
        self.axes_grafik_o.set_title('Dimensi Agreeableness Domain',
                                     fontname="Tw Cen MT",
                                     fontsize=12)
        self.Update()
        self.Refresh()
        self.Layout()

        #         Penyajian definisi ke dalam grafik

        select = self.parent.m_choice1.GetSelection()
        self.jenis_kelamin = self.parent.m_choice1.GetString(select)
        print(self.jenis_kelamin)
        nilai_dimensi
        nilai_sub_dimensi

        for k, v in nilai_dimensi.items():
            nilai_sub_dimensi[k] = round(v, 2)

        print(nilai_sub_dimensi)

        print(type(self.jenis_kelamin))

        self.definisi = rerata2(self.jenis_kelamin, nilai_sub_dimensi)

        dimensi = [
            "Agreeableness", "Forgiveness", "Gentleness", "Flexibility",
            "Patience"
        ]

        self.data = []
        # print (self.definisi)
        for k in self.definisi:
            for dim in dimensi:

                if k[0] == dim:
                    # print ("lolos")
                    # print (k)
                    # print(k[0])
                    # print(dimensi[0])
                    self.data.append([k[0], k[3], k[1], k[2]])
        print(self.data)
        self.insert_value_list(self)
    def __init__(self, parent):
        super(GrafikIA, self).__init__(parent)
        'buat konstruktor parent'
        self.parent = parent

        'buat konstruktor grafik terpisah'
        self.matplotlib = matplotlib
        self.np = np
        self.plt = plt
        self.figure = Figure(figsize=(2, 2))
        self.figure.subplots_adjust(bottom=None,
                                    left=None,
                                    top=None,
                                    right=0.975,
                                    wspace=0.3,
                                    hspace=None)
        #         self.figure.tight_layout()
        self.axes_grafik_o = self.figure.add_subplot(111)
        self.canvas = FigureCanvas(self.m_Grafik_Terpisah, -1, self.figure)
        self.sizer32 = wx.BoxSizer(wx.VERTICAL)
        self.sizer32.Add(self.canvas, 1, wx.ALL | wx.EXPAND)
        self.m_Grafik_Terpisah.SetSizer(self.sizer32)

        'Data diambil dari parent'
        nilai_dimensi = self.parent.hasil_dimensi
        nilai_sub_dimensi = self.parent.hasil_subdimensi
        self.value = ["Interstitial"]
        self.y_pos = self.np.arange(len(self.value))
        self.performance = (nilai_sub_dimensi["Interstitial"])

        self.color = Colour()
        self.ax = self.axes_grafik_o.bar(self.y_pos,
                                         self.performance,
                                         width=0.4,
                                         align='center',
                                         color=self.color.colors_interstitial)

        'Fungsi untuk menampilkan label di dalam Bar'

        def autolabel(rects):
            """
            Attach a text label above each bar displaying its height
            """

            for rect in rects:
                height = rect.get_height()
                frac_height = height / 5
                if frac_height > 0.95:
                    label_position = height - (0.1 * height)
                else:
                    label_position = height + (0.1 * height)
                self.axes_grafik_o.text(rect.get_x() + rect.get_width() / 2.,
                                        label_position,
                                        '{}'.format(round(height, 2)),
                                        ha='center',
                                        va='bottom')

        autolabel(self.ax)
        self.axes_grafik_o.set_xticks(self.y_pos)
        self.axes_grafik_o.set_xticklabels(self.value)
        #         self.axes_grafik_o.set_ylabel('Performance')
        self.axes_grafik_o.set_ylim(bottom=0, top=5)
        self.axes_grafik_o.set_title('Dimensi Interstitial Domain')
        self.Update()
        self.Refresh()
        self.Layout()

        'Penyajian definisi ke dalam grafik'
        select = self.parent.m_choice1.GetSelection()
        self.jenis_kelamin = self.parent.m_choice1.GetString(select)
        for k, v in nilai_dimensi.items():
            nilai_sub_dimensi[k] = round(v, 2)


#         print (nilai_sub_dimensi)
#         print (type(self.jenis_kelamin))
        self.definisi = rerata2(self.jenis_kelamin, nilai_sub_dimensi)
        dimensi = ["Interstitial"]
        self.data = []
        #         print (self.definisi)
        for k in self.definisi:
            for dim in dimensi:
                if k[0] == dim:
                    #                     print ("lolos")
                    #                     print (k)
                    #                     print(k[0])
                    #                     print(dimensi[0])
                    self.data.append([k[0], k[3], k[1], k[2]])
        self.insert_value_list(self)
    def __init__(self, parent):
        super().__init__(parent)
        ''' buat konstruktor parent '''
        self.parent = parent
        ''' konstruktor grafik dan membuat grafik '''
        self.matplotlib = matplotlib
        self.np = np
        self.plt = plt
        self.figure = Figure(figsize=(2, 2))
        self.axes_grafik_o = self.figure.add_subplot(111)
        self.canvas = FigureCanvas(self.m_Grafik_Terpisah, -1, self.figure)
        self.sizer32 = wx.BoxSizer(wx.VERTICAL)
        self.sizer32.Add(self.canvas, 1, wx.ALL | wx.EXPAND)
        self.m_Grafik_Terpisah.SetSizer(self.sizer32)

        ' Data diambil dari parent '
        nilai_dimensi = self.parent.hasil_dimensi
        nilai_sub_dimensi = self.parent.hasil_subdimensi
        #         print (self.nilai_sub_dimensi)
        self.value = ('Aesthetic Appreciation', 'Inquisitiveness',
                      'Creativity', 'Unconventionality')
        self.performance = (nilai_sub_dimensi["Aesthetic Appreciation"],
                            nilai_sub_dimensi["Inquisitiveness"],
                            nilai_sub_dimensi["Creativity"],
                            nilai_sub_dimensi["Unconventionality"])
        self.y_pos = self.np.arange(len(self.value))
        self.color = Colour()
        self.color.colors_openness_to_experience
        self.ax = self.axes_grafik_o.bar(
            self.y_pos,
            self.performance,
            width=0.3,
            align='center',
            color=self.color.colors_openness_to_experience)

        #           Fungsi untuk menampilkan label di dalam Bar
        def autolabel(rects):
            """
            Attach a text label above each bar displaying its height
            """

            for rect in rects:
                height = rect.get_height()
                frac_height = height / 5
                if frac_height > 0.95:
                    label_position = height - (0.1 * height)
                else:
                    label_position = height + (0.1 * height)
                self.axes_grafik_o.text(rect.get_x() + rect.get_width() / 2.,
                                        label_position,
                                        '{}'.format(round(height, 2)),
                                        ha='center',
                                        va='bottom')

        autolabel(self.ax)
        self.axes_grafik_o.set_xticks(self.y_pos)
        self.axes_grafik_o.set_xticklabels(self.value)
        #         self.axes_grafik_o.set_xlabel('Sub Dimensi')
        self.axes_grafik_o.set_ylim(bottom=0, top=5)
        self.axes_grafik_o.set_title('Dimensi Openess To Experience Domain',
                                     fontname="Tw Cen MT",
                                     fontsize=12)
        self.figure.subplots_adjust(bottom=None,
                                    left=None,
                                    top=None,
                                    right=None,
                                    wspace=None,
                                    hspace=None)
        self.Update()
        self.Refresh()
        self.Layout()

        'Penyajian definisi ke dalam grafik'
        select = self.parent.m_choice1.GetSelection()
        self.jenis_kelamin = self.parent.m_choice1.GetString(select)
        for k, v in nilai_dimensi.items():
            nilai_sub_dimensi[k] = round(v, 2)
#         print ("Nilai Total dimensi + sub dimensi {} {}".format(nilai_dimensi,nilai_sub_dimensi))
#         print (self.jenis_kelamin)
        self.definisi = rerata2(self.jenis_kelamin, nilai_sub_dimensi)
        print("ini mulai dari sini")
        print(self.definisi)
        dimensi = [
            "Aesthetic Appreciation", "Inquisitiveness", "Creativity",
            "Unconventionality", "Openness to Experience"
        ]
        self.data = []
        for k in self.definisi:
            for dim in dimensi:
                if k[0] == dim:
                    self.data.append([k[0], k[3], k[1], k[2]])


#         print ("data ini {}".format(self.data))
        self.insert_value_list(self)