예제 #1
0
    def add_clicked(self):
        importman = ImportManager(dbManager=self.dbMan)

        if importman.exec() == QDialog.Accepted:
            # Add file to list
            table = self.UI.tableFiles

            row = table.rowCount()
            table.setRowCount(row + 1)
            cell = QTableWidgetItem()
            cell.setText(importman.filename)
            table.setItem(row, 0, cell)
            cell = QTableWidgetItem()
            cell.setText(importman.filetype)
            cell.setData(Qt.UserRole, importman.filetype_id)
            table.setItem(row, 1, cell)
            cell = QTableWidgetItem()
            group = ""
            if importman.participant.group is not None:
                group = importman.participant.group.name
            cell.setText(group)
            table.setItem(row, 2, cell)
            cell = QTableWidgetItem()
            cell.setText(importman.participant.name)
            cell.setData(Qt.UserRole,importman.participant)
            table.setItem(row, 3, cell)

            table.resizeColumnsToContents()
예제 #2
0
    def add_dir_clicked(self):
        importman = ImportManager(dbmanager=self.dbMan, dirs=True)
        importman.setStyleSheet(self.styleSheet())

        if self.UI.tableFiles.rowCount() > 0:
            # Copy informations into the dialog
            last_row = self.UI.tableFiles.rowCount() - 1
            importman.set_participant(self.UI.tableFiles.item(last_row, 1).text())
            importman.set_filetype(self.UI.tableFiles.item(last_row, 2).text())

        self.showMinimized()
        if importman.exec() == QDialog.Accepted:
            files = importman.get_file_list()
            for file_name, file_part in files.items():
                self.add_file_to_list(file_name, importman.filetype, importman.filetype_id, file_part)

        self.showNormal()
예제 #3
0
    def add_clicked(self):
        importman = ImportManager(dbManager=self.dbMan)
        importman.setStyleSheet(self.styleSheet())

        if self.UI.tableFiles.rowCount() > 0:
            # Copy informations into the dialog
            last_row = self.UI.tableFiles.rowCount()-1
            importman.set_participant(self.UI.tableFiles.item(last_row,1).text())
            importman.set_filetype(self.UI.tableFiles.item(last_row,2).text())

        if importman.exec() == QDialog.Accepted:
            files = importman.filename.split(";")
            # Add file to list
            for file in files:
                self.addFileToList(file, importman.filetype, importman.filetype_id, importman.participant)
예제 #4
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()
예제 #5
0
    def add_dir_clicked(self):
        importman = ImportManager(dbManager=self.dbMan)
        importman.setStyleSheet(self.styleSheet())
        importman.import_dirs = True

        if self.UI.tableFiles.rowCount() > 0:
            # Copy informations into the dialog
            last_row = self.UI.tableFiles.rowCount()-1
            importman.set_participant(self.UI.tableFiles.item(last_row,1).text())
            importman.set_filetype(self.UI.tableFiles.item(last_row,2).text())

        if importman.exec() == QDialog.Accepted:
            # Add file to list
            files = glob.glob(importman.filename + "/*.*") # Files in base folder
            for file in files:
                self.addFileToList(file, importman.filetype, importman.filetype_id, importman.participant)

            files = glob.glob(importman.filename + "/**/*.*") # Files in sub folders
            for file in files:
                self.addFileToList(file, importman.filetype, importman.filetype_id, importman.participant)
예제 #6
0
    def add_clicked(self):
        importman = ImportManager(dbmanager=self.dbMan, dirs=False, parent=self)
        importman.participant_added.connect(self.participant_added)

        if self.UI.tableFiles.rowCount() > 0:
            # Copy informations into the dialog
            last_row = self.UI.tableFiles.rowCount() - 1
            importman.set_participant(self.UI.tableFiles.item(last_row, 1).text())
            importman.set_filetype(self.UI.tableFiles.item(last_row, 2).text())

        # self.showMinimized()
        if importman.exec() == QDialog.Accepted:
            files = importman.filename.split(";")
            # Add file to list
            for file in files:
                self.add_file_to_list(file, importman.filetype, importman.filetype_id, importman.participant)