本文整理汇总了Python中importer.Importer.stop方法的典型用法代码示例。如果您正苦于以下问题:Python Importer.stop方法的具体用法?Python Importer.stop怎么用?Python Importer.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类importer.Importer
的用法示例。
在下文中一共展示了Importer.stop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ImportChooser
# 需要导入模块: from importer import Importer [as 别名]
# 或者: from importer.Importer import stop [as 别名]
class ImportChooser(QtGui.QDialog, Ui_ImportChooser):
def __init__(self, parent=None, updater=None, availableStudies=0):
logging.debug("In ImportChooser::__init__()")
super(ImportChooser, self).__init__(parent)
self.setupUi(self)
self.stopButton.setDisabled(True)
self.importButton.setDisabled(True)
self.availableStudiesLabel.setText(self.availableStudiesLabel.text().format(availableStudies))
self._availableStudies = availableStudies
if availableStudies == -1:
self.availableStudiesLabel.setVisible(False)
self.createActions()
self.createSignals()
self._singleShotTime = 500
self.updateWidgets()
self._importer = Importer()
self._updater = updater
self._warning = False
self._msg = ""
self._firstImport = False
self.rename = Rename(self)
self.rename.label.setText(
QtGui.QApplication.translate("ImportChooser", "Serie's Description:", None, QtGui.QApplication.UnicodeUTF8)
)
def createSignals(self):
logging.debug("In ImportChooser::createSignals()")
def createActions(self):
logging.debug("In ImportChooser::createActions()")
self.connect(self.cancelButton, QtCore.SIGNAL("clicked()"), self.slotActionCancel)
self.connect(self.stopButton, QtCore.SIGNAL("clicked()"), self.slotActionStop)
self.connect(self.importButton, QtCore.SIGNAL("clicked()"), self.slotActionImport)
self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.slotActionAdd)
self.connect(self.tableView, QtCore.SIGNAL("clicked(QModelIndex)"), self.slotActionItemClicked)
self.connect(self.tableView, QtCore.SIGNAL("doubleClicked(QModelIndex)"), self.slotActionItemDoubleClicked)
def slotActionStop(self):
if self._importer.finished == 0:
self._msg = QtGui.QApplication.translate("ImportChooser", "Stopping", None, QtGui.QApplication.UnicodeUTF8)
self.stopButton.setDisabled(True)
self._importer.stop()
def slotActionItemClicked(self, modelIndex):
if modelIndex.column() == 1:
uid = self.itemModel.data(self.itemModel.index(modelIndex.row(), 6))
if modelIndex.data(QtCore.Qt.CheckStateRole) == QtCore.Qt.Checked:
self._importer.series[uid]["checked"] = False
self.itemModel.setData(modelIndex, QtCore.Qt.Unchecked, QtCore.Qt.CheckStateRole)
else:
self.itemModel.setData(modelIndex, QtCore.Qt.Checked, QtCore.Qt.CheckStateRole)
self._importer.series[uid]["checked"] = True
def slotActionItemDoubleClicked(self, modelIndex):
self.rename.renameSerie(
self._importer.series[self.itemModel.data(self.itemModel.index(modelIndex.row(), 6))], self.fillTable
)
def slotActionCancel(self):
self._msg = QtGui.QApplication.translate("ImportChooser", "Cancelling", None, QtGui.QApplication.UnicodeUTF8)
if self._importer.finished == 0 and self._firstImport:
self.cancelButton.setDisabled(True)
self._importer.cancel()
else:
self.close()
def slotActionAdd(self):
settings = QtCore.QSettings("Moonstone", "Medical")
lastdir = settings.value("ImportChooser-last-dir")
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
),
#.........这里部分代码省略.........