本文整理汇总了Python中PySide.QtGui.QComboBox.addItem方法的典型用法代码示例。如果您正苦于以下问题:Python QComboBox.addItem方法的具体用法?Python QComboBox.addItem怎么用?Python QComboBox.addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QComboBox
的用法示例。
在下文中一共展示了QComboBox.addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AddScenarioDlg
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
class AddScenarioDlg(QDialog):
def __init__(self, root_node, parent=None):
super(AddScenarioDlg, self).__init__(parent)
self.setWindowTitle("Add Scenario")
type_label = QLabel("&Scenario Type:")
self.type_combobox = QComboBox()
type_label.setBuddy(self.type_combobox)
self.type_combobox.addItems(["External Fire", "Liquid Overfill", "Regulator Failure"])
device_label = QLabel("&Associated Relief Device:")
self.device_combobox = QComboBox()
device_label.setBuddy(self.device_combobox)
for area in root_node.children:
for device in area.children:
self.device_combobox.addItem(device.name, device)
button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
layout = QGridLayout()
layout.addWidget(type_label, 0, 0)
layout.addWidget(self.type_combobox, 0, 1)
layout.addWidget(device_label, 1, 0)
layout.addWidget(self.device_combobox, 1, 1)
layout.addWidget(button_box, 2, 1)
self.setLayout(layout)
button_box.accepted.connect(self.accept)
button_box.rejected.connect(self.reject)
def returnVals(self):
return (self.type_combobox.currentText(), self.device_combobox.itemData(self.device_combobox.currentIndex()))
示例2: CopyScenarioDlg
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
class CopyScenarioDlg(QDialog):
def __init__(self, root_node, parent=None):
super(CopyScenarioDlg, self).__init__(parent)
self.setWindowTitle("Duplicate Scenario")
device_label = QLabel("&Copy Scenario To:")
self.device_combobox = QComboBox()
device_label.setBuddy(self.device_combobox)
for area in root_node.children:
for device in area.children:
self.device_combobox.addItem(device.name, device)
button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
layout = QGridLayout()
layout.addWidget(device_label, 0, 0)
layout.addWidget(self.device_combobox, 0, 1)
layout.addWidget(button_box, 1, 1)
self.setLayout(layout)
button_box.accepted.connect(self.accept)
button_box.rejected.connect(self.reject)
def returnVals(self):
return self.device_combobox.itemData(self.device_combobox.currentIndex())
示例3: createEditor
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
def createEditor(self, row, column, item, view):
"""
Creates the ComboBox for setting the Status
"""
cb = QComboBox()
for key in gStatusTags.keys():
cb.addItem(QIcon(gStatusTags[key]), key)
return cb
示例4: DelegateKeepsReferenceToEditor
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
class DelegateKeepsReferenceToEditor(QAbstractItemDelegate):
def __init__(self, parent=None):
QAbstractItemDelegate.__init__(self, parent)
self.comboBox = QComboBox()
self.comboBox.addItem(id_text)
def createEditor(self, parent, option, index):
self.comboBox.setParent(parent)
return self.comboBox
示例5: AddDeviceDlg
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
class AddDeviceDlg(QDialog):
def __init__(self, root_node, parent=None):
super(AddDeviceDlg, self).__init__(parent)
self.setWindowTitle("Add Relief Device")
id_label = QLabel("&Relief Device ID:")
self.id_lineedit = QLineEdit()
self.id_lineedit.setMaxLength(200)
id_label.setBuddy(self.id_lineedit)
area_label = QLabel("Associated Relief Device &Area:")
self.area_combobox = QComboBox()
for area in root_node.children:
self.area_combobox.addItem(area.name, area)
area_label.setBuddy(self.area_combobox)
color_label = QLabel("&Text Color:")
self.color_combobox = QComboBox()
for key in sorted(COLORS.keys()):
pixmap = QPixmap(26, 26)
pixmap.fill(COLORS[key])
self.color_combobox.addItem(QIcon(pixmap), key)
color_label.setBuddy(self.color_combobox)
button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
layout = QGridLayout()
layout.addWidget(id_label, 0, 0)
layout.addWidget(self.id_lineedit, 0, 1)
layout.addWidget(area_label, 1, 0)
layout.addWidget(self.area_combobox, 1, 1)
layout.addWidget(color_label, 2, 0)
layout.addWidget(self.color_combobox, 2, 1)
layout.addWidget(button_box, 3, 1)
self.setLayout(layout)
button_box.accepted.connect(self.accept)
button_box.rejected.connect(self.reject)
def accept(self):
if len(self.id_lineedit.text().strip()) == 0:
QMessageBox.warning(self, "Error: Relief Device ID Blank", "The relief device must be given an ID.", QMessageBox.Ok)
self.id_lineedit.setFocus()
return
selected_area = self.area_combobox.itemData(self.area_combobox.currentIndex())
for device in selected_area.children:
if device.name == self.id_lineedit.text():
QMessageBox.warning(self, "Error: Relief Device ID Already Exists",
"Cannot add relief device because that relief device ID already exists. Please create a new relief device ID.", QMessageBox.Ok)
self.id_lineedit.setFocus()
self.id_lineedit.setSelection(0, self.id_lineedit.maxLength())
return
QDialog.accept(self)
def returnVals(self):
return (self.id_lineedit.text(), self.area_combobox.itemData(self.area_combobox.currentIndex()),
COLORS[self.color_combobox.currentText()])
示例6: _addComboBox
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
def _addComboBox(self, row, col, items, currentItem=None):
comb = QComboBox()
for it in items:
comb.addItem(it)
self.table.setCellWidget(row, col, comb)
if currentItem is not None:
if currentItem in items:
comb.setCurrentIndex(items.index(currentItem))
else:
print('invalid item: {}'.format(currentItem))
return comb
示例7: ExportPdfOptionDialog
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
class ExportPdfOptionDialog(QDialog):
"""
Displays options UI for the PDF
"""
def __init__(self, parent=None):
if not parent:
parent = hiero.ui.mainWindow()
super(ExportPdfOptionDialog, self).__init__(parent)
layout = QFormLayout()
self._fileNameField = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter="*.pdf")
self._fileNameField.setFilename(os.path.join(os.getenv("HOME"), "Desktop", "Sequence.pdf"))
self._optionDropdown = QComboBox()
self._buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
self._buttonbox.accepted.connect(self.accept)
self._buttonbox.rejected.connect(self.reject)
self._pdfActionSettings = {"1 Shot per page": [1, 1], "4 Shots per page)": [2, 2], "9 Shots per page)": [3, 3]}
for pdfMode in sorted(self._pdfActionSettings, reverse=True):
self._optionDropdown.addItem(pdfMode)
layout.addRow("Save to:", self._fileNameField)
layout.addRow("PDF Layout:", self._optionDropdown)
layout.addRow("", self._buttonbox)
self.setLayout(layout)
self.setWindowTitle("Export PDF Options")
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
def numRows(self):
"""Returns the number of rows for the pdf"""
optionText = self._optionDropdown.currentText()
return self._pdfActionSettings[optionText][0]
def numColumns(self):
"""Returns the number of columns for the pdf"""
optionText = self._optionDropdown.currentText()
return self._pdfActionSettings[optionText][1]
def filePath(self):
"""Returns the filepath for the pdf"""
filename = self._fileNameField.filename()
if not filename.endswith(".pdf"):
filename = filename + ".pdf"
return filename
示例8: createOptionsGroupBox
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
def createOptionsGroupBox(self):
self.optionsGroupBox = QGroupBox("Options")
buttonsOrientationLabel = QLabel("Orientation of buttons:")
buttonsOrientationComboBox = QComboBox()
buttonsOrientationComboBox.addItem("Horizontal", Qt.Horizontal)
buttonsOrientationComboBox.addItem("Vertical", Qt.Vertical)
buttonsOrientationComboBox.currentIndexChanged[int].connect(self.buttonsOrientationChanged)
self.buttonsOrientationComboBox = buttonsOrientationComboBox
optionsLayout = QGridLayout()
optionsLayout.addWidget(buttonsOrientationLabel, 0, 0)
optionsLayout.addWidget(self.buttonsOrientationComboBox, 0, 1)
optionsLayout.setColumnStretch(2, 1)
self.optionsGroupBox.setLayout(optionsLayout)
示例9: create_combobox
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
def create_combobox(self, text, choices, option, default=NoDefault,
tip=None):
"""choices: couples (name, key)"""
label = QLabel(text)
combobox = QComboBox()
if tip is not None:
combobox.setToolTip(tip)
# combobox.setEditable(True)
for name, key in choices:
combobox.addItem(name, key) # to_qvariant(key))
self.comboboxes[option] = combobox
layout = QHBoxLayout()
for subwidget in (label, combobox):
layout.addWidget(subwidget)
layout.addStretch(1)
layout.setContentsMargins(0, 0, 0, 0)
widget = QWidget(self)
widget.setLayout(layout)
return widget
示例10: IntroPage
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
class IntroPage(QWizardPage):
'''
Introduction Wizard Page
Contains the introduction text and a combo box to select either a pre-
defined computer model or a custom computer type.
'''
def __init__(self, parent=None):
super(IntroPage, self).__init__(parent)
self._createLayout()
self.registerField('type', self._cbxType)
self.setTitle(self.tr('Add a Dive Computer'))
self.setSubTitle(self.tr('Select the type of Dive Computer to add. Make sure the computer is connected and ready to download before proceeding.'))
def nextId(self):
'Return the next Page Id'
if self._cbxType.currentIndex() == len(ComputerTypes):
return Pages.Custom
else:
return Pages.Browse
def _createLayout(self):
'Create the Wizard Page Layout'
self._cbxType = QComboBox()
self._lblType = QLabel(self.tr('Dive Computer &Type'))
self._lblType.setBuddy(self._cbxType)
for t in ComputerTypes:
self._cbxType.addItem(t['name'])
self._cbxType.addItem('Custom...')
gbox = QGridLayout()
gbox.addWidget(self._lblType, 0, 0)
gbox.addWidget(self._cbxType, 0, 1)
vbox = QVBoxLayout()
vbox.addLayout(gbox)
vbox.addStretch()
self.setLayout(vbox)
示例11: LandmarkWidget
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
class LandmarkWidget(QWidget):
landmarkTypeChanged = Signal(object)
def __init__(self):
super(LandmarkWidget, self).__init__()
self.typeLabel = QLabel("Picker type:")
self.typeCombo = QComboBox()
self.typeCombo.addItem("Surface")
self.typeCombo.addItem("Two step")
self.typeCombo.currentIndexChanged.connect(self.comboboxChanged)
self.surfaceWidget = SurfaceLandmarkWidget()
self.twoStepWidget = TwoStepLandmarkWidget()
self.surfaceWidget.setHidden(True)
self.twoStepWidget.setHidden(True)
layout = QGridLayout()
layout.setAlignment(Qt.AlignTop)
layout.addWidget(self.typeLabel, 0, 0)
layout.addWidget(self.typeCombo, 0, 1)
layout.addWidget(self.surfaceWidget, 1, 0, 1, 2)
layout.addWidget(self.twoStepWidget, 2, 0, 1, 2)
self.setLayout(layout)
self.update()
def update(self):
idx = self.typeCombo.currentIndex()
if idx == 0:
self.surfaceWidget.setHidden(False)
self.twoStepWidget.setHidden(True)
self.landmarkType = SurfaceType
elif idx == 1:
self.surfaceWidget.setHidden(True)
self.twoStepWidget.setHidden(False)
self.landmarkType = TwoStepType
@Slot(int)
def comboboxChanged(self, index):
self.update()
self.landmarkTypeChanged.emit(self)
示例12: AnyIMU_window
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
class AnyIMU_window(QMainWindow):
def __init__(self, parent=None):
super(AnyIMU_window, self).__init__(parent)
self.setWindowTitle('AnyIMU')
self.resize(450, 700)
os.system('cls')
self.dcm = DCM()
self.accDataCurr = None
self.gyrDataCurr = None
self.magDataCurr = None
self.barDataCurr = None
self.serialThread = None
self.skipDataCount = 5
# The plot widget
self.accPlotWidget = SensorDisplay(name='Accelerometer')
self.gyrPlotWidget = SensorDisplay(name='Gyroscope')
self.magPlotWidget = SensorDisplay(name='Magnetometer')
self.barPlotWidget = SensorDisplay(name='Barometer')
self.accPlotWidget.addPlot(fillLevelIn=0, brushIn=(200,0,0,100), penIn=(255,0,0), dataType='int', dataName='X')
self.accPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,200,0,100), penIn=(0,255,0), dataType='int', dataName='Y')
self.accPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,0,200,100), penIn=(0,0,255), dataType='int', dataName='Z')
self.gyrPlotWidget.addPlot(fillLevelIn=0, brushIn=(200,0,0,100), penIn=(255,0,0), dataType='int', dataName='X')
self.gyrPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,200,0,100), penIn=(0,255,0), dataType='int', dataName='Y')
self.gyrPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,0,200,100), penIn=(0,0,255), dataType='int', dataName='Z')
self.magPlotWidget.addPlot(fillLevelIn=0, brushIn=(200,0,0,100), penIn=(255,0,0), dataType='int', dataName='X')
self.magPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,200,0,100), penIn=(0,255,0), dataType='int', dataName='Y')
self.magPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,0,200,100), penIn=(0,0,255), dataType='int', dataName='Z')
self.barPlotWidget.addPlot(fillLevelIn=0, brushIn=(200,0,0,100), penIn=(255,0,0), dataType='float', dataName='TEMP')
self.barPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,200,0,100), penIn=(0,255,0), dataType='float', dataName='PRS')
self.barPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,0,200,100), penIn=(0,0,255), dataType='float', dataName='ALT')
# the main layout and widgets
self.mainWidget = QWidget()
self.setCentralWidget(self.mainWidget)
self.mainLayout = QGridLayout()
self.mainWidget.setLayout(self.mainLayout)
connectionLayout = QHBoxLayout()
# widgets
serialLab = QLabel('Serial Port:')
self.serialLine = QLineEdit('COM3')
self.serialLine.setFixedWidth(100)
baudRateLab = QLabel('Baud Rate:')
self.baudRateCombo = QComboBox()
for baud in [300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200]: self.baudRateCombo.addItem(str(baud))
default = self.baudRateCombo.findText('9600')
self.baudRateCombo.setCurrentIndex(default)
self.viewport = Viewport()
# Debugging stuff----------------------------------
debugLayout = QHBoxLayout()
# these are used to offset the the rotation
self.xAdd = QSpinBox()
self.yAdd = QSpinBox()
self.zAdd = QSpinBox()
for each in [self.xAdd, self.yAdd, self.zAdd]:
each.setMinimum(-180) # min
each.setMaximum(180) # max
each.setSingleStep(90) # change this to a small value if need be
# these are used for inverting the rotations
self.xMult = QCheckBox()
self.yMult = QCheckBox()
self.zMult = QCheckBox()
self.xAdd.setValue(0)
self.yAdd.setValue(90) # in my case I need to offset by 90 in the Y axis
self.zAdd.setValue(0)
self.xMult.setChecked(False)
self.yMult.setChecked(True) # in my case I need to invert the Y axis on the acc
self.zMult.setChecked(False)
for each in [self.xAdd, self.yAdd, self.zAdd, self.xMult, self.yMult, self.zMult]:
debugLayout.addWidget(each)
# Debugging stuff----------------------------------
self.serialBtn = QPushButton('Connect')
# add widgets to layout
connectionLayout.addWidget(serialLab)
connectionLayout.addWidget(self.serialLine)
connectionLayout.addWidget(baudRateLab)
connectionLayout.addWidget(self.baudRateCombo)
connectionLayout.addWidget(self.serialBtn)
connectionLayout.addStretch()
self.mainLayout.addLayout(connectionLayout, 0,0,1,2)
self.mainLayout.addWidget(self.viewport, 1,0,1,2)
self.mainLayout.addWidget(self.accPlotWidget, 2,0,1,1)
self.mainLayout.addWidget(self.gyrPlotWidget, 2,1,1,1)
self.mainLayout.addWidget(self.magPlotWidget, 3,0,1,1)
#.........这里部分代码省略.........
示例13: createEditor
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
def createEditor(self, parent, option, index):
comboBox = QComboBox(parent)
comboBox.addItem(id_text)
return comboBox
示例14: OptionSection
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
class OptionSection(QWidget):
"""
Collects options and returns proper representation when requested
"""
def __init__(self, parent=None):
super(OptionSection, self).__init__(parent)
#create widgets
label_buffer_size = QLabel("Buffer Size")
self.spinbox_buffer_size = ValidatedSpinBox()
self.spinbox_buffer_size.setSingleStep(10)
self.spinbox_buffer_size.setMaximum(9999999)
self.spinbox_buffer_size.setSuffix(" bytes")
self.spinbox_buffer_size.setValue(55)
label_timeout = QLabel("Timeout")
self.spinbox_timeout = ValidatedSpinBox()
self.spinbox_timeout.setMaximum(9999999)
self.spinbox_timeout.setSuffix(" ms")
self.spinbox_timeout.setSingleStep(100)
self.spinbox_timeout.setValue(1000)
label_delay = QLabel("Delay Between Packets")
self.spinbox_delay = ValidatedSpinBox()
self.spinbox_delay.setMaximum(9999999)
self.spinbox_delay.setSuffix(" ms")
self.spinbox_delay.setSingleStep(100)
self.spinbox_delay.setValue(1000)
label_delay_distribution = QLabel("Delay Distribution")
self.combobox_delay_distribution = QComboBox()
self.combobox_delay_distribution.addItem("Constant")
self.combobox_delay_distribution.insertSeparator(10)
self.combobox_delay_distribution.addItems(["Uniform", "Gaussian", "Poisson", "Exponential"])
label_packet_count = QLabel("Packets to Send")
self.spinbox_packet_count = ValidatedSpinBox()
self.spinbox_packet_count.setMaximum(9999999)
self.spinbox_packet_count.setValue(3)
#setup layout
layout = QFormLayout()
layout.addRow(label_buffer_size, self.spinbox_buffer_size)
layout.addRow(label_timeout, self.spinbox_timeout)
layout.addRow(label_delay, self.spinbox_delay)
layout.addRow(label_delay_distribution, self.combobox_delay_distribution)
layout.addRow(label_packet_count, self.spinbox_packet_count)
self.setLayout(layout)
def getOptions(self):
"""
Return a RequestData object representing selected options
"""
buf_size = self.spinbox_buffer_size.value()
timeout = self.spinbox_timeout.value()
delay = self.spinbox_delay.value() / 1000
packet_count = self.spinbox_packet_count.value()
selected_distribution = self.combobox_delay_distribution.currentIndex()
if selected_distribution == 0:
distribution = RequestData.DISTRIBUTION_CONSTANT
elif selected_distribution == 1:
distribution = RequestData.DISTRIBUTION_UNIFORM
elif selected_distribution == 2:
distribution = RequestData.DISTRIBUTION_GAUSSIAN
elif selected_distribution == 3:
distribution = RequestData.DISTRIBUTION_POISSON
elif selected_distribution == 4:
distribution = RequestData.DISTRIBUTION_EXPONENTIAL
return RequestData(buf_size, timeout, delay, packet_count, distribution)
def disableWidgets(self):
for widget in [self.spinbox_buffer_size, self.spinbox_delay,
self.spinbox_packet_count, self.spinbox_timeout,
self.combobox_delay_distribution]:
widget.setEnabled(False)
def enableWidgets(self):
for widget in [self.spinbox_buffer_size, self.spinbox_delay,
self.spinbox_packet_count, self.spinbox_timeout,
self.combobox_delay_distribution]:
widget.setEnabled(True)
示例15: LandmarkTransformationTool
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import addItem [as 别名]
class LandmarkTransformationTool(TransformationTool):
"""
LandmarkTransformationTool
"""
updatedLandmarks = Signal(list)
def __init__(self):
super(LandmarkTransformationTool, self).__init__()
self.fixedPickerType = SurfaceType
self.movingPickerType = SurfaceType
self.fixedPicker = self._pickerForType(self.fixedPickerType)
self.movingPicker = self._pickerForType(self.movingPickerType)
self.landmarkPointSets = [] # Sets of points
self.landmarkIndicators = [] # All the landmark indicator objects
self.originalTransform = None
self.originalScalingTransform = None
self.activeIndex = 0
self.landmarkTransformType = 0 # Rigid, Similarity or Affine
@overrides(TransformationTool)
def getParameterWidget(self):
self.pointsWidget = PointsWidget()
self.landmarkComboBox = QComboBox()
self.landmarkComboBox.addItem("Rigid body")
self.landmarkComboBox.addItem("Similarity")
self.landmarkComboBox.addItem("Affine")
layout = QGridLayout()
layout.setAlignment(Qt.AlignTop)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(QLabel("Transform type:"), 0, 0)
layout.addWidget(self.landmarkComboBox, 0, 1)
layout.addWidget(self.pointsWidget, 1, 0, 1, 2)
self.updatedLandmarks.connect(self.pointsWidget.setPoints)
self.landmarkComboBox.currentIndexChanged.connect(self.landmarkTransformTypeChanged)
self.pointsWidget.activeLandmarkChanged.connect(self.setActiveLandmark)
self.pointsWidget.landmarkDeleted.connect(self.deleteLandmark)
widget = QWidget()
widget.setLayout(layout)
return widget
@overrides(TransformationTool)
def setRenderWidgets(self, fixed=None, moving=None, multi=None):
self.fixedWidget = fixed
self.movingWidget = moving
self.multiWidget = multi
self.fixedPicker.setWidget(self.fixedWidget)
self.movingPicker.setWidget(self.movingWidget)
self.fixedPicker.pickedLocation.connect(self.pickedFixedLocation)
self.movingPicker.pickedLocation.connect(self.pickedMovingLocation)
# Save the original complete transform
self.originalTransform = self.multiWidget.transformations.completeTransform()
self.originalScalingTransform = self.multiWidget.transformations.scalingTransform()
# Add a new transform on top of the others
currentProject = ProjectController.Instance().currentProject
transform = Transformation(vtkTransform(), Transformation.TypeLandmark, currentProject.movingData)
self.multiWidget.transformations.append(transform)
statusWidget = StatusWidget.Instance()
statusWidget.setText("Place landmarks in both volumes to create a landmark transform. "
"Available methods for placing landmarks are the surface type and the two-step type.")
def setLandmarkWidgets(self, fixed, moving):
self.fixedLandmarkWidget = fixed
self.movingLandmarkWidget = moving
self.fixedLandmarkWidget.landmarkTypeChanged.connect(self.landmarkToolTypeChanged)
self.movingLandmarkWidget.landmarkTypeChanged.connect(self.landmarkToolTypeChanged)
self.fixedPicker.setPropertiesWidget(self.fixedLandmarkWidget)
self.movingPicker.setPropertiesWidget(self.movingLandmarkWidget)
@overrides(TransformationTool)
def cancelTransform(self):
del self.multiWidget.transformations[-1]
@overrides(TransformationTool)
def applyTransform(self):
# Add the landmark point sets to the transformation
transformation = self.multiWidget.transformations[-1]
transformation.landmarks = self.landmarkPointSets
@overrides(TransformationTool)
def cleanUp(self):
self.fixedPicker.cleanUp()
self.movingPicker.cleanUp()
for landmarkIndicator in self.landmarkIndicators:
#.........这里部分代码省略.........