Exemple #1
0
    def accept(self):
        filters = self.filterWidget.value()
        name = self.nameEdit.text()
        if name == '':
            reply = QMessageBox.critical(self,
                    "Missing information", "Please specify a name for the new corpus.")
            return None
        if len(filters) == 0:
            reply = QMessageBox.critical(self,
                    "Missing information", "Please specify at least one filter.")
            return None

        if name in get_corpora_list(self.parent().settings['storage']):
            msgBox = QMessageBox(QMessageBox.Warning, "Duplicate name",
                    "A corpus named '{}' already exists.  Overwrite?".format(name), QMessageBox.NoButton, self)
            msgBox.addButton("Overwrite", QMessageBox.AcceptRole)
            msgBox.addButton("Abort", QMessageBox.RejectRole)
            if msgBox.exec_() != QMessageBox.AcceptRole:
                return
        new_corpus = self.corpus.subset(filters)
        new_corpus.name = name
        new_corpus.set_feature_matrix(self.corpus.specifier)
        save_binary(new_corpus,
            corpus_name_to_path(self.parent().settings['storage'],new_corpus.name))
        QDialog.accept(self)
Exemple #2
0
    def accept(self):

        if self.specifier is not None:
            corpus_inventory = self.corpus.inventory
            feature_inventory = self.specifier.segments
            for seg in corpus_inventory:
                if seg not in feature_inventory:
                    missing = True
                    break
            else:
                missing = False
            if missing:
                msgBox = QMessageBox(QMessageBox.Warning, "Missing segments", (
                    "This feature matrix does not fully specify all segments in the corpus. "
                    "Are you sure you want to use this feature system?\n\nUse the 'Check corpus "
                    "inventory coverage button' to see which segments are missing."
                ), QMessageBox.NoButton, self)
                msgBox.addButton("Yes", QMessageBox.AcceptRole)
                msgBox.addButton("No", QMessageBox.RejectRole)
                if msgBox.exec_() != QMessageBox.AcceptRole:
                    return None

            path = system_name_to_path(self.settings['storage'],
                                       self.specifier.name)
            save_binary(self.specifier, path)
        QDialog.accept(self)
    def accept(self):

        if self.specifier is not None:
            corpus_inventory = self.corpus.inventory
            feature_inventory = self.specifier.segments
            for seg in corpus_inventory:
                if seg not in feature_inventory:
                    missing = True
                    break
            else:
                missing = False
            if missing:
                msgBox = QMessageBox(QMessageBox.Warning, "Missing segments",
                        ("This feature matrix does not fully specify all segments in the corpus. "
                        "Are you sure you want to use this feature system?\n\nUse the 'Check corpus "
                        "inventory coverage button' to see which segments are missing."),
                        QMessageBox.NoButton, self)
                msgBox.addButton("Yes", QMessageBox.AcceptRole)
                msgBox.addButton("No", QMessageBox.RejectRole)
                if msgBox.exec_() != QMessageBox.AcceptRole:
                    return None

            path = system_name_to_path(self.settings['storage'],self.specifier.name)
            save_binary(self.specifier, path)
        QDialog.accept(self)
Exemple #4
0
    def accept(self):
        filters = self.filterWidget.value()
        name = self.nameEdit.text()
        if name == '':
            reply = QMessageBox.critical(
                self, "Missing information",
                "Please specify a name for the new corpus.")
            return None
        if len(filters) == 0:
            reply = QMessageBox.critical(
                self, "Missing information",
                "Please specify at least one filter.")
            return None

        if name in get_corpora_list(self.parent().settings['storage']):
            msgBox = QMessageBox(
                QMessageBox.Warning, "Duplicate name",
                "A corpus named '{}' already exists.  Overwrite?".format(name),
                QMessageBox.NoButton, self)
            msgBox.addButton("Overwrite", QMessageBox.AcceptRole)
            msgBox.addButton("Abort", QMessageBox.RejectRole)
            if msgBox.exec_() != QMessageBox.AcceptRole:
                return
        new_corpus = self.corpus.subset(filters)
        new_corpus.name = name
        new_corpus.set_feature_matrix(self.corpus.specifier)
        save_binary(
            new_corpus,
            corpus_name_to_path(self.parent().settings['storage'],
                                new_corpus.name))
        QDialog.accept(self)
Exemple #5
0
    def accept(self, b):
        kwargs = self.generateKwargs()
        if kwargs is None:
            return
        self.thread.setParams(kwargs)

        self.thread.start()

        result = self.progressDialog.exec_()

        self.progressDialog.reset()
        if result:
            if self.corpus is not None:
                save_binary(self.corpus,
                    corpus_name_to_path(self.settings['storage'],self.corpus.name))
            QDialog.accept(self)
Exemple #6
0
    def accept(self):
        kwargs = self.generateKwargs()
        if kwargs is None:
            return
        self.thread.setParams(kwargs)

        self.thread.start()

        result = self.progressDialog.exec_()

        self.progressDialog.reset()
        if result:
            if self.specifier is not None:
                save_binary(
                    self.specifier,
                    system_name_to_path(self.settings['storage'],
                                        self.specifier.name))
            QDialog.accept(self)