Source code for wizard.CalibrationConclusionsPage
from PySide import QtCore, QtGui
[docs]class CalibrationConclusionPage(QtGui.QWizardPage):
"""This is the final page of the wizard. The collected data is saved as a conf file in this page"""
def __init__(self, calibrationWizard, parent = None):
super(CalibrationConclusionPage, self).__init__(parent)
self.calibrationWizard = calibrationWizard
self.setTitle("Congratulations!")
self.setSubTitle("Calibration Completed")
self.label = QtGui.QLabel()
self.errorLabel = QtGui.QLabel()
self.errorLabel.setText("Could Not save the following parameters:\n")
[docs] def initializePage(self, *args, **kwargs):
if self.calibrationWizard.depthCamera:
self.calibrationWizard.depthCamera.stop()
self.layout = QtGui.QVBoxLayout()
for calib, value in self.calibrationWizard.calibParams.iteritems():
self.setParam("calib", calib, value)
if not self.calibrationWizard.depthCamera:
self.calibrationWizard.profileName+= '.conf'
self.calibrationWizard.currentConfiguration.write(self.calibrationWizard.profileName)
else:
self.calibrationWizard.currentConfiguration.write()
text = "Successfully written files to %s"%(self.calibrationWizard.profileName)
self.label.setText(text)
self.layout.addWidget(self.label)
self.layout.addWidget(self.errorLabel)
self.errorLabel.hide()
[docs] def setParam(self, section, name, value):
if isinstance(value, int):
ret = self.calibrationWizard.currentConfiguration.setInteger(section, name, value)
if not ret:
text = self.errorLabel.text() + str(name) + str(value) + "\n"
self.errorLabel.setText(text)
self.errorLabel.show()
if isinstance(value,float):
ret = self.calibrationWizard.currentConfiguration.setFloat(section, name, value)
if not ret:
text = self.errorLabel.text() + str(name) + str(value) + "\n"
self.errorLabel.setText(text)
self.errorLabel.show()
if isinstance(value, str):
ret = self.calibrationWizard.currentConfiguration.set(section, name, value)
if not ret:
text = self.errorLabel.text() + str(name) + str(value) + "\n"
self.errorLabel.setText(text)
self.errorLabel.show()