Exemplo n.º 1
0
    def on_submit(self):
        self.disable_widgets_during_process(False)
        if not self.check_for_invalid_data():
            self.disable_widgets_during_process(True)
            return
        Ui_Dialog.my_settings.setValue("nse_zipped",
                                       int(self.nse_zipped.isChecked()))
        Ui_Dialog.my_settings.setValue("bse_zipped",
                                       int(self.bse_zipped.isChecked()))
        Ui_Dialog.my_settings.setValue("include_weekend",
                                       int(self.include_weekend.isChecked()))
        Ui_Dialog.my_settings.setValue("headless",
                                       int(self.headless.isChecked()))
        Ui_Dialog.my_settings.setValue(
            "dont_download_indices",
            int(self.dont_download_indices.isChecked()))
        Ui_Dialog.my_settings.setValue(
            "dont_download_bhavcopy",
            int(self.dont_download_bhavcopy.isChecked()))
        Ui_Dialog.my_settings.setValue("only_today",
                                       int(self.only_today.isChecked()))
        Ui_Dialog.my_settings.setValue("indices_source",
                                       int(self.IndicesSource.currentIndex()))
        Ui_Dialog.my_settings.sync()

        d = Download(self.nse_zipped.isChecked(), self.nse_zipped.isChecked(),
                     self.include_weekend.isChecked(),
                     self.selected_folder_path.toPlainText(),
                     self.headless.isChecked(),
                     self.dont_download_indices.isChecked(),
                     self.only_today.isChecked(),
                     self.dont_download_bhavcopy.isChecked(),
                     str(self.IndicesSource.currentText()))

        d.download_data(
            parse(self.from_date_label.text()).date(),
            parse(self.to_date_label.text()).date())

        self.disable_widgets_during_process(True)