當前位置: 首頁>>代碼示例>>Python>>正文


Python Importer.makeImport方法代碼示例

本文整理匯總了Python中importer.Importer.makeImport方法的典型用法代碼示例。如果您正苦於以下問題:Python Importer.makeImport方法的具體用法?Python Importer.makeImport怎麽用?Python Importer.makeImport使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在importer.Importer的用法示例。


在下文中一共展示了Importer.makeImport方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: ImportChooser

# 需要導入模塊: from importer import Importer [as 別名]
# 或者: from importer.Importer import makeImport [as 別名]

#.........這裏部分代碼省略.........
        caption = QtGui.QApplication.translate(
            "ImportChooser", "Select the directory of DICOMs", None, QtGui.QApplication.UnicodeUTF8
        )
        options = QtGui.QFileDialog.ShowDirsOnly

        dialog = QtGui.QFileDialog.getExistingDirectory(self, caption, lastdir, options)
        if dialog:
            # while QtCore.QCoreApplication.hasPendingEvents():
            #    QtCore.QCoreApplication.processEvents()
            self.loadDirectory(dialog)
            settings.setValue("ImportChooser-last-dir", dialog)

    def slotActionImport(self):
        logging.debug("In ImportChooser::slotActionImport()")
        self._firstImport = True
        self._msg = QtGui.QApplication.translate(
            "ImportChooser", "Importing series...", None, QtGui.QApplication.UnicodeUTF8
        )
        series = []
        for i in range(self.itemModel.rowCount()):
            if self.itemModel.data(self.itemModel.index(i, 1), QtCore.Qt.CheckStateRole) == QtCore.Qt.Checked:
                series.append(self.itemModel.data(self.itemModel.index(i, 6)))
                self._importer.series[self.itemModel.data(self.itemModel.index(i, 6))]["error"] == False
        if len(series) == 0:
            QtGui.QMessageBox.information(
                self,
                QtGui.QApplication.translate("ImportChooser", "Warning", None, QtGui.QApplication.UnicodeUTF8),
                QtGui.QApplication.translate(
                    "ImportChooser", "There is no serie selected!", None, QtGui.QApplication.UnicodeUTF8
                ),
            )
        elif len(series) <= self._availableStudies or self._availableStudies == -1:
            self.cancelButton.setDisabled(False)
            self._importer.makeImport(series)
            self.addButton.setDisabled(True)
            self.importButton.setDisabled(True)
            self.stopButton.setEnabled(True)
            self.recursiveCheck.setDisabled(True)
            self.tableView.setEnabled(False)
            self.progressLabel.show()
            self.updateProgress()
        else:
            QtGui.QMessageBox.critical(
                self,
                QtGui.QApplication.translate("ImportChooser", "Error", None, QtGui.QApplication.UnicodeUTF8),
                QtGui.QApplication.translate(
                    "ImportChooser",
                    "You do not have sufficient series available. Please uncheck the excess!",
                    None,
                    QtGui.QApplication.UnicodeUTF8,
                ),
            )

    def updateWidgets(self):
        logging.debug("In ImportChooser::updateWidgets()")
        self.itemModel = QtGui.QStandardItemModel()
        self.itemModel.setHorizontalHeaderLabels(
            [
                " ",
                " ",
                QtGui.QApplication.translate("ImportChooser", "Progress", None, QtGui.QApplication.UnicodeUTF8),
                QtGui.QApplication.translate("ImportChooser", "Patient", None, QtGui.QApplication.UnicodeUTF8),
                QtGui.QApplication.translate("ImportChooser", "Description", None, QtGui.QApplication.UnicodeUTF8),
                QtGui.QApplication.translate("ImportChooser", "Images", None, QtGui.QApplication.UnicodeUTF8),
                QtGui.QApplication.translate("ImportChooser", "UID", None, QtGui.QApplication.UnicodeUTF8),
            ]
開發者ID:aevum,項目名稱:moonstone,代碼行數:70,代碼來源:importchooser.py


注:本文中的importer.Importer.makeImport方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。