def templateChanged(self, i): t = chartTemplates[i] self.templateInfo.setPlainText(t.description) n = uniqueName(t.chartName, self.sensorgroup.charts.keys(), numFormat="%d") self.nameInput.setText(n) if t.previewImage: xpm = QPixmap() path = os.path.join("previewImages", t.previewImage) data = self.ownPlugIn.getFile(path).read() xpm.loadFromData(data) self.templatePreview.setPixmap(xpm)
def __init__(self, parent, project): QWizardPage.__init__(self, parent) self.setTitle(QCoreApplication.translate('DataStorageBrowser', 'Select name, title and data type')) self.project = project self.mainLayout = QGridLayout() self.setLayout(self.mainLayout) nameLabel = QLabel(self) nameLabel.setText(QCoreApplication.translate('DataStorageBrowser', 'Name')) self.mainLayout.addWidget(nameLabel, 0, 0) self.nameInput = QLineEdit(self) self.nameInput.setText(uniqueName('unnamed', project.keys())) self.registerField('name', self.nameInput, 'text') self.mainLayout.addWidget(self.nameInput, 0, 1) titleLabel = QLabel(self) titleLabel.setText(QCoreApplication.translate('DataStorageBrowser', 'Title')) self.mainLayout.addWidget(titleLabel, 1, 0) self.titleInput = QLineEdit(self) self.titleInput.setText('...') self.registerField('title', self.titleInput, 'text') self.mainLayout.addWidget(self.titleInput, 1, 1) typeLabel = QLabel(self) typeLabel.setText(QCoreApplication.translate('DataStorageBrowser', 'Data type')) self.mainLayout.addWidget(typeLabel, 2, 0) self.typeSelect = QComboBox(self) self.typeSelect.addItem('CSV') self.typeSelect.addItem('Remus') self.registerField('type', self.typeSelect, 'currentText') self.mainLayout.addWidget(self.typeSelect, 2, 1) self.importFilesButton = QCheckBox(self) self.importFilesButton.setChecked(True) self.importFilesButton.setText(QCoreApplication.translate('DataStorageBrowser', 'Import files after creation')) self.registerField('importFiles', self.importFilesButton, 'checked') self.mainLayout.addWidget(self.importFilesButton, 3, 0, 3, 2)