Ejemplo n.º 1
0
 def import_requested(self):
     importer = ImportBrowser(data_manager=self.dbMan)
     importer.log_request.connect(self.add_to_log)
     importer.setStyleSheet(self.styleSheet())
     if importer.exec() == QDialog.Accepted:
         self.load_data_from_dataset()
         gc.collect()
Ejemplo n.º 2
0
    def transfer_requested(self):
        import_man = ImportManager(dbmanager=self.dbMan,
                                   dirs=True,
                                   stream=True,
                                   parent=self)
        # TODO: More intelligent refresh!
        import_man.participant_added.connect(self.load_data_from_dataset)

        if import_man.exec() == QDialog.Accepted:
            stream_diag = StreamWindow(stream_type=import_man.filetype_id,
                                       path=import_man.filename,
                                       parent=self)
            stream_diag.exec()

            # Do the actual import
            msg = QMessageBox(self)
            msg.setIcon(QMessageBox.Question)
            msg.setStyleSheet(
                "QPushButton{min-width: 100px; min-height: 40px;}")

            msg.setText("Procéder à l'importation des données?")
            msg.setWindowTitle("Importer?")
            msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)

            rval = msg.exec()
            if rval == QMessageBox.Yes:
                # Start import process
                import_browser = ImportBrowser(data_manager=self.dbMan,
                                               parent=self)
                import_browser.log_request.connect(self.add_to_log)

                # Build import list
                files = import_man.get_file_list()
                importer_id = StreamerTypes.value_importer_types[
                    import_man.filetype_id]
                for file_name, file_part in files.items():
                    import_browser.add_file_to_list(file_name,
                                                    import_man.filetype,
                                                    importer_id, file_part)

                import_browser.ok_clicked()
            self.load_data_from_dataset()
Ejemplo n.º 3
0
    def transfer_requested(self):
        # import_man = ImportManager(dbmanager=self.dbMan, dirs=True, stream=True, parent=self)
        # # TODO: More intelligent refresh!
        # import_man.participant_added.connect(self.load_data_from_dataset)
        #
        # if import_man.exec() == QDialog.Accepted:
        stream_diag = StreamWindow(parent=self)
        stream_diag.exec()

        # Do the actual import
        # msg = QMessageBox(self)
        # msg.setIcon(QMessageBox.Question)
        # msg.setStyleSheet("QPushButton{min-width: 100px; min-height: 40px;}")
        #
        # msg.setText("Procéder à l'importation des données?")
        # msg.setWindowTitle("Importer?")
        # msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        #
        # rval = msg.exec()
        # if rval == QMessageBox.Yes:

        if stream_diag.folders_to_import:
            # Match windows
            matcher = ImportMatchDialog(dbmanager=self.dbMan,
                                        datas=stream_diag.folders_to_import,
                                        parent=self)
            if matcher.exec() == QDialog.Accepted:
                # for file_name, file_dataname in file_list.items():
                #     part = matcher.data_match[file_dataname]
                #     file_match[file_name] = part

                # Build import list
                files = matcher.get_files_match(
                    stream_diag.get_data_save_path())

                # Start import process
                import_browser = ImportBrowser(data_manager=self.dbMan,
                                               parent=self)
                import_browser.log_request.connect(self.add_to_log)

                importer_id = StreamerTypes.value_importer_types[
                    stream_diag.get_streamer_type()]
                importer_name = ImporterTypes.value_names[importer_id]
                for file_name, file_part in files.items():
                    import_browser.add_file_to_list(file_name, importer_name,
                                                    importer_id, file_part)

                import_browser.ok_clicked()

                # Delete files after transfer?
                import shutil
                if not stream_diag.get_delete_files_after_import():
                    # Move files to "Imported" folder
                    import os
                    target_dir = stream_diag.get_base_data_save_path(
                    ) + os.sep + "Imported"
                    FileManager.merge_folders(stream_diag.get_data_save_path(),
                                              target_dir)

                # Remove transfered files
                shutil.rmtree(stream_diag.get_data_save_path())
                self.load_data_from_dataset()
Ejemplo n.º 4
0
 def importRequested(self):
     importer = ImportBrowser(dataManager=self.dbMan)
     if importer.exec() == QDialog.Accepted:
         self.load_data_from_dataset()