コード例 #1
0
    def on_start_import_pushButton_clicked(self):
        config = self.getCurrentConfig()
        if config.getboolean('hdf5', 'enable') \
            and (not os.path.lexists(config['hdf5']['dir']) or not os.path.isdir(config['hdf5']['dir'])):
            QMessageBox.about(self, "错误", '指定的目标数据存放目录不存在!')
            return

        if config.getboolean('tdx', 'enable') \
            and (not os.path.lexists(config['tdx']['dir'])
                 or not os.path.isdir(config['tdx']['dir'])):
            QMessageBox.about(self, "错误", "请确认通达信安装目录是否正确!")
            return

        self.import_running = True
        self.start_import_pushButton.setEnabled(False)
        self.reset_progress_bar()

        self.import_status_label.setText("正在启动任务....")
        QApplication.processEvents()

        if self.tdx_radioButton.isChecked():
            self.hdf5_import_thread = UseTdxImportToH5Thread(config)
        else:
            self.hdf5_import_thread = UsePytdxImportToH5Thread(config)

        self.hdf5_import_thread.message.connect(self.on_message_from_thread)
        self.hdf5_import_thread.start()

        self.escape_time = 0.0
        self.escape_time_thread = EscapetimeThread()
        self.escape_time_thread.message.connect(self.on_message_from_thread)
        self.escape_time_thread.start()
コード例 #2
0
    def start_import_data(self):
        config = self.getCurrentConfig()
        dest_dir = config.get('hdf5', 'dir')
        if not os.path.exists(dest_dir) or not os.path.isdir(dest_dir):
            print("错误:", '指定的目标数据存放目录不存在!')
            sys.exit(-1)
            #return

        if config.getboolean('tdx', 'enable') \
            and (not os.path.exists(config['tdx']['dir']
                 or os.path.isdir(config['tdx']['dir']))):
            print("错误:", "请确认通达信安装目录是否正确!")
            sys.exit(-1)
            #return

        self.import_running = True

        print("正在启动任务....")
        QCoreApplication.processEvents()

        if config.getboolean('tdx', 'enable'):
            self.hdf5_import_thread = UseTdxImportToH5Thread(config)
        else:
            self.hdf5_import_thread = UsePytdxImportToH5Thread(config)

        self.hdf5_import_thread.message.connect(self.on_message_from_thread)
        self.hdf5_import_thread.start()

        self.escape_time = 0.0
        self.escape_time_thread = EscapetimeThread()
        self.escape_time_thread.message.connect(self.on_message_from_thread)
        self.escape_time_thread.start()