Beispiel #1
0
 def onRemove(self, guiName):
     """Remove is clicked. Remove selection from the table widget and remove from the tab widget.
     Args:
         guiName: 'hardware' or 'software'
     """
     tabWidget, comboBox, tableWidget, nameEdit = self.guiDict[guiName]
     selectedItems = tableWidget.selectedItems()
     selectedRows = {tableWidget.row(item) for item in selectedItems}
     uniqueSelectedItems = [
         tableWidget.item(row, 0) for row in selectedRows
     ]
     with BlockSignals(tableWidget):
         with BlockSignals(tabWidget):
             for item in uniqueSelectedItems:
                 row = tableWidget.row(item)
                 objName = str(tableWidget.item(row, 0).text())
                 name = str(tableWidget.item(row, 1).text())
                 tableWidget.removeRow(row)
                 widget = self.widgetDict[(guiName, objName,
                                           name)]['widget']
                 index = tabWidget.indexOf(widget)
                 tabWidget.removeTab(index)
                 templateDict = self.guiTemplate[guiName][objName]
                 roles = templateDict.get('roles') if templateDict else None
                 if roles:
                     fullName = self.project.fullName(objName, name)
                     for role in roles:
                         self.roleDict[role].remove(fullName)
                     self.updateRoles.emit()
Beispiel #2
0
 def openFile(self, filename):
     """Open the file 'filename'"""
     if os.path.exists(filename):
         self.lastDir, basename = os.path.split(filename)
         self.recentFiles[basename] = filename
         self.settings.filename = filename
         with BlockSignals(self.filenameComboBox) as w:
             self.filenameModel.setStringList(list(self.recentFiles.keys()))
             w.setCurrentIndex(w.findText(basename))
         with open(filename, 'r') as f:
             yamldata = yaml.load(f)
         variables = yamldata.get('variables')
         channelData = yamldata.get('channelData')
         self.tableModel.beginResetModel()
         [
             channelUi.segmentModel.beginResetModel()
             for channelUi in self.awgChannelUiList
         ]
         if channelData:
             for channelUi in self.awgChannelUiList:
                 if channelUi.channel < len(channelData):
                     self.settings.channelSettingsList[channelUi.channel][
                         'segmentDataRoot'] = self.convertListToNodes(
                             channelData[channelUi.channel], isRoot=True)
                     channelUi.segmentModel.root = self.settings.channelSettingsList[
                         channelUi.channel]['segmentDataRoot']
         if variables:
             for varname, vardata in list(variables.items()):
                 self.settings.varDict.setdefault(varname, dict())
                 self.settings.varDict[varname]['value'] = Q(
                     vardata['value'], vardata['unit'])
                 self.settings.varDict[varname]['text'] = vardata['text']
         for channelUi in self.awgChannelUiList:
             channelUi.waveform.updateDependencies()
             channelUi.replot()
         self.onDependenciesChanged()
         self.tableModel.endResetModel()
         [
             channelUi.segmentModel.endResetModel()
             for channelUi in self.awgChannelUiList
         ]
         [
             channelUi.segmentView.expandAll()
             for channelUi in self.awgChannelUiList
         ]
     else:
         logging.getLogger(__name__).warning(
             "file '{0}' does not exist".format(filename))
         if filename in self.recentFiles:
             del self.recentFiles[filename]
             with BlockSignals(self.filenameComboBox) as w:
                 self.filenameModel.setStringList(
                     list(self.recentFiles.keys()))
                 w.setCurrentIndex(-1)
Beispiel #3
0
 def onSaveContext(self):
     name = str(self.contextComboBox.currentText())
     isNewContext = not name in self.contextDict
     self.contextDict[name] = copy.deepcopy(self.currentContext)
     if self.contextComboBox.findText(name) < 0:
         with BlockSignals(self.contextComboBox) as w:
             w.addItem(name)
         with BlockSignals(self.parentComboBox) as w:
             w.addItem(name)
     if isNewContext:
         self.contextDictChanged.emit(list(self.contextDict.keys()))
     self.updateSaveStatus(isSaved=True)
     self.currentContextName = name
Beispiel #4
0
 def loadRamFile(self, path):
     if path and os.path.exists(path):
         self.currentContext.ramFile = path
         filename = os.path.basename(path)
         if filename not in self.configParams.recentRamFiles:
             self.ramFilenameComboBox.addItem(filename)
         self.configParams.recentRamFiles[filename] = path
         with BlockSignals(self.ramFilenameComboBox) as w:
             w.setCurrentIndex(self.ramFilenameComboBox.findText(filename))
     else:
         self.currentContext.ramFile = ''
         with BlockSignals(self.ramFilenameComboBox) as w:
             w.setCurrentIndex(self.ramFilenameComboBox.findText(''))
Beispiel #5
0
 def addObj(self, guiName, objName, name):
     """Add (objName, name) to the table widget, and add the appropriate tab to the tab widget.
     Args:
         guiName (str): 'hardware' or 'software'
         objName (str): The type of hardware or software
         name (str): The name of the specific piece of hardware or software
     """
     tabWidget, comboBox, tableWidget, nameEdit = self.guiDict[guiName]
     logger = logging.getLogger(__name__)
     if objName not in self.guiTemplate[guiName]:
         logger.error("No GUI template entry for {0}".format(objName))
     elif (objName, name) in getattr(self, guiName):
         logger.warning("{0} {1} already exists".format(
             guiName, self.project.fullName(objName, name)))
     elif ':' in name:
         logger.error("character ':' cannot be used in a name")
     else:
         templateDict = self.guiTemplate[guiName][objName]
         description = templateDict.get(
             'description') if templateDict else None
         with BlockSignals(tableWidget) as w:
             objItem = QtWidgets.QTableWidgetItem(objName)
             objItem.setFlags(QtCore.Qt.ItemIsEnabled
                              | QtCore.Qt.ItemIsUserCheckable
                              | QtCore.Qt.ItemIsSelectable)
             nameItem = QtWidgets.QTableWidgetItem(name)
             nameItem.setFlags(QtCore.Qt.ItemIsEnabled
                               | QtCore.Qt.ItemIsEditable
                               | QtCore.Qt.ItemIsSelectable)
             newrow = w.rowCount()
             w.insertRow(newrow)
             w.setItem(newrow, 0, objItem)
             w.setItem(newrow, 1, nameItem)
             if description:
                 objItem.setToolTip(description)
                 nameItem.setToolTip(description)
                 enabled = self.exptConfig[guiName].get(
                     objName, dict()).get(name,
                                          dict()).get('enabled', True)
                 checkState = QtCore.Qt.Checked if enabled else QtCore.Qt.Unchecked
                 objItem.setCheckState(checkState)
             w.setCurrentItem(objItem)
             w.resizeColumnsToContents()
         with BlockSignals(tabWidget) as w:
             widget = self.getWidget(guiName, objName, name)
             w.addTab(widget, self.project.fullName(objName, name))
             index = w.indexOf(widget)
             if description:
                 w.setTabToolTip(index, description)
             w.setCurrentIndex(index)
Beispiel #6
0
 def setSettings(self, settings):
     logger = logging.getLogger(__name__)
     logger.debug( str( settings) )
     logger.debug( "GateSequenceUi SetSettings {0}".format( settings.__dict__ ) )
     self.settings = settings
     self.GateSequenceEnableCheckBox.setChecked( self.settings.enabled )
     self.GateSequenceFrame.setEnabled( self.settings.enabled )
     self.GateEdit.setText( ", ".join(self.settings.gate ))
     self.repetitionSpinBox.setValue( self.settings.thisSequenceRepetition )
     if self.settings.startAddressParam:
         self.StartAddressBox.setCurrentIndex(self.StartAddressBox.findText(self.settings.startAddressParam) )
     else:
         self.settings.startAddressParam = str(self.StartAddressBox.currentText())
     self.settings.startAddressParam = str(self.settings.startAddressParam)
     try:
         updateComboBoxItems(self.GateDefinitionBox, list(self.settings.gateDefinitionCache.keys()))
         updateComboBoxItems(self.GateSequenceBox, list(self.settings.gateSequenceCache.keys()))
         self.updateDatastructures()
     except IOError as err:
         logger.warning( "{0} during loading of GateSequence Files, ignored.".format(err) )
     with BlockSignals(self.FullListRadioButton) as w:
         if self.settings.active == self.Mode.FullList:
             self.FullListRadioButton.setChecked(True)
         elif self.settings.active == self.Mode.Gate:
             self.GateRadioButton.setChecked(True)
Beispiel #7
0
 def setFitfunction(self, fitfunction):
     self.fitfunction = fitfunction
     self.fitfunctionTableModel.setFitfunction(self.fitfunction)
     self.fitResultsTableModel.setFitfunction(self.fitfunction)
     self.descriptionLabel.setText(
         self.fitfunction.functionString if self.fitfunction else "")
     if self.fitfunction:
         self.fitfunction.useSmartStartValues = self.fitfunction.useSmartStartValues and self.fitfunction.hasSmartStart
         with BlockSignals(self.checkBoxUseSmartStartValues):
             self.checkBoxUseSmartStartValues.setChecked(
                 self.fitfunction.useSmartStartValues)
             self.checkBoxUseSmartStartValues.setEnabled(
                 self.fitfunction.hasSmartStart)
         with BlockSignals(self.useErrorBarsCheckBox):
             self.useErrorBarsCheckBox.setChecked(
                 self.fitfunction.useErrorBars)
     self.evaluate()
 def currentFile(self, filename):
     """set currentFile, if it exists and is in recentFiles. Set combo box to match."""
     filename = str(filename)
     if (filename != self._currentFile) and exists(filename) and (
             filename in self.recentFiles):
         self._currentFile = filename
         with BlockSignals(self.filenameComboBox) as w:
             w.setCurrentIndex(w.findText(basename(filename)))
Beispiel #9
0
 def onSave(self):
     """save current settings"""
     self.settingsName = str(self.settingsComboBox.currentText())
     self.settingsDict[self.settingsName] = copy.deepcopy(self.settings)
     with BlockSignals(self.settingsComboBox) as w:
         self.settingsModel.setStringList(sorted(self.settingsDict.keys()))
         w.setCurrentIndex(w.findText(self.settingsName))
     self.saveButton.setEnabled(False)
Beispiel #10
0
 def onRamFilenameChange(self, name):
     name = str(name)
     if name in self.configParams.recentRamFiles and self.configParams.recentRamFiles[
             name] != self.currentContext.ramFile:
         self.loadRamFile(self.configParams.recentRamFiles[name])
         if str(self.ramFilenameComboBox.currentText()) != name:
             with BlockSignals(self.ramFilenameComboBox) as w:
                 w.setCurrentIndex(self.ramFilenameComboBox.findText(name))
     self.updateSaveStatus()
Beispiel #11
0
 def onLoad(self, name):
     """load settings"""
     for channelUi in self.awgChannelUiList:
         self.settings.channelSettingsList[channelUi.channel][
             'segmentTreeState'] = channelUi.segmentView.saveTreeState()
     name = str(name)
     if name in self.settingsDict:
         self.settingsName = name
         self.tableModel.beginResetModel()
         [
             channelUi.segmentModel.beginResetModel()
             for channelUi in self.awgChannelUiList
         ]
         self.settings.update(self.settingsDict[self.settingsName])
         self.programmingOptionsTable.setParameters(
             self.device.parameters())
         self.saveButton.setEnabled(False)
         with BlockSignals(self.filenameComboBox) as w:
             w.setCurrentIndex(
                 w.findText(os.path.basename(self.settings.filename)))
         with BlockSignals(self.cacheDepthSpinBox) as w:
             w.setValue(self.settings.cacheDepth)
         for channelUi in self.awgChannelUiList:
             channelUi.waveform.updateDependencies()
             channelUi.plotCheckbox.setChecked(
                 self.settings.channelSettingsList[
                     channelUi.channel]['plotEnabled'])
             with BlockSignals(channelUi.styleComboBox) as w:
                 w.setCurrentIndex(self.settings.channelSettingsList[
                     channelUi.channel]['plotStyle'])
             channelUi.segmentModel.root = self.settings.channelSettingsList[
                 channelUi.channel]['segmentDataRoot']
             channelUi.replot()
         self.onDependenciesChanged()
         self.saveButton.setEnabled(False)
         self.tableModel.endResetModel()
         [
             channelUi.segmentModel.endResetModel()
             for channelUi in self.awgChannelUiList
         ]
         for channelUi in self.awgChannelUiList:
             channelUi.segmentView.restoreTreeState(
                 self.settings.channelSettingsList[
                     channelUi.channel]['segmentTreeState'])
Beispiel #12
0
 def onRemoveFile(self):
     """Remove file button is clicked. Remove filename from combo box."""
     text = str(self.filenameComboBox.currentText())
     index = self.filenameComboBox.findText(text)
     if text in self.recentFiles:
         self.recentFiles.pop(text)
     with BlockSignals(self.filenameComboBox) as w:
         self.filenameModel.setStringList(list(self.recentFiles.keys()))
         w.setCurrentIndex(-1)
         self.onFilename(w.currentText())
 def recentFiles(self, filenames):
     """set recentFiles. Clear the combo box, add the filenames, and update the validator."""
     filenames = [s for s in filenames if isinstance(s, str)]
     if self._recentFiles != filenames:
         self._recentFiles = filenames
         with BlockSignals(self.filenameComboBox) as w:
             w.clear()
             for filename in filenames:
                 if filename and exists(filename):
                     w.addItem(basename(filename), filename)
             self.updateValidator()
Beispiel #14
0
 def onSelect(self, guiName, currentRow, currentColumn, previousRow,
              previousColumn):
     """Table widget is clicked. Change the current tab on the tab widget."""
     tabWidget, comboBox, tableWidget, nameEdit = self.guiDict[guiName]
     objName = str(tableWidget.item(currentRow, 0).text())
     name = str(tableWidget.item(currentRow, 1).text())
     widget = self.widgetDict[(guiName, objName, name)]['widget']
     index = tabWidget.indexOf(widget)
     with BlockSignals(tabWidget) as w:
         w.setCurrentIndex(index)
     self.currentObj[guiName] = (objName, name)
Beispiel #15
0
 def onRemove(self):
     """Remove current settings from combo box"""
     name = str(self.settingsComboBox.currentText())
     if name in self.settingsDict:
         self.settingsDict.pop(name)
         self.settingsName = list(
             self.settingsDict.keys())[0] if self.settingsDict else ''
         with BlockSignals(self.settingsComboBox) as w:
             self.settingsModel.setStringList(
                 sorted(self.settingsDict.keys()))
             w.setCurrentIndex(w.findText(self.settingsName))
         self.onLoad(self.settingsName)
Beispiel #16
0
 def updateFileComboBoxNames(self, fullnames):
     """repopulates combo box if MaxCount increases, otherwise updates displayed names if directory
        or file name change or if user opts to display full paths or just local names in options menu"""
     with BlockSignals(self.filenameComboBox) as w:
         if w.count() < w.maxCount() and w.count() < len(self.recentFiles):
             for fullname in self.recentFiles:
                 w.insertItem(0, self.getName(fullname))
                 w.setItemData(0, fullname)
                 w.setCurrentIndex(0)
         else:
             for ind in range(w.count()):
                 w.setItemText(ind, self.getName(w.itemData(ind)))
Beispiel #17
0
 def onNewFile(self):
     """New button is clicked. Pop up dialog asking for new name, and create file."""
     filename, _ = QtWidgets.QFileDialog.getSaveFileName(
         self, 'New File', self.lastDir, 'YAML (*.yml)')
     if filename:
         self.lastDir, basename = os.path.split(filename)
         self.recentFiles[basename] = filename
         self.settings.filename = filename
         with BlockSignals(self.filenameComboBox) as w:
             self.filenameModel.setStringList(list(self.recentFiles.keys()))
             w.setCurrentIndex(w.findText(basename))
         self.onSaveFile()
Beispiel #18
0
 def updatePathChanges(self, changedFiles):
     """updates path information in file tree, combo box, recentFiles,
        and script attributes after drag/drop or renaming"""
     with BlockSignals(self.filenameComboBox) as w:
         combolen = range(w.count())
         for oldPath, newPath in changedFiles:
             if oldPath == self.script.fullname:
                 self.script.fullname = newPath
             self.recentFiles.replace(oldPath, newPath)
             for ind in combolen:
                 if w.itemData(ind) == oldPath:
                     w.setItemData(ind, newPath)
                     w.setItemText(ind, self.getName(newPath))
Beispiel #19
0
 def loadpppFile(self, path):
     self.pppSourcePath = path
     _, self.pppSourceFile = os.path.split(path)
     with open(path, "r") as f:
         self.pppSource = f.read()
     self.updatepppDisplay()
     ppFilename = getPpFileName(path)
     if self.compileppp(ppFilename):
         self.loadppFile(ppFilename, cache=False)
     filename = os.path.basename(path)
     if filename not in self.configParams.recentFiles:
         self.filenameComboBox.addItem(filename)
     self.configParams.recentFiles[filename] = path
     with BlockSignals(self.filenameComboBox) as w:
         w.setCurrentIndex(self.filenameComboBox.findText(filename))
Beispiel #20
0
 def removeComboUtility(self, history, file, combo):
     """Utility used by onRemoveMapping/Definition/etc. to update the combo boxes and remove the entry from the file
        history."""
     for v, k in list(zip(history.values(), history.keys())):
         if v is file:
             history.pop(k)
     #updateComboBoxItems(self.definitionCombo, list(self.files.definitionHistory.keys()))
     # Cannot use updateComboBox because it would display the first item in the list. We want
     # the combo box to display a blank until the user switches the selection.
     # TODO: incorporate this as an option into updateComboBox
     with BlockSignals(combo):
         combo.clear()
         if history:
             combo.addItems(history)
         combo.setCurrentIndex(-1)
Beispiel #21
0
 def updateDisplayContext(self):
     self.setParentData(self.currentContext.parentContext)
     self.variableTableModel.setVariables(self.currentContext.parameters,
                                          self.currentContextName)
     self.variableTableModel.setContextHasParent(
         bool(self.currentContext.parentContext))
     with BlockSignals(self.parentComboBox) as w:
         w.setCurrentIndex(
             self.parentComboBox.findText(
                 self.currentContext.parentContext if self.currentContext.
                 parentContext else ''))
     self.variableView.resizeColumnsToContents()
     self.shutterTableModel.setDataDict(self.currentContext.shutters)
     self.triggerTableModel.setDataDict(self.currentContext.triggers)
     self.counterTableModel.setDataDict(self.currentContext.counters)
     self.writeRamCheckbox.setChecked(self.currentContext.writeRam)
Beispiel #22
0
 def onFilenameChange(self, shortname ):
     """A name is typed into the filename combo box."""
     shortname = str(shortname)
     logger = logging.getLogger(__name__)
     if not shortname:
         self.script.fullname=''
         self.textEdit.setPlainText('')
     elif shortname not in self.recentFiles:
         logger.info('Use "open" or "new" commands to access a file not in the drop down menu')
         self.loadFile(self.recentFiles[self.script.shortname])
     else:
         fullname = self.recentFiles[shortname]
         if os.path.isfile(fullname) and fullname != self.script.fullname:
             self.loadFile(fullname)
             if str(self.filenameComboBox.currentText())!=fullname:
                 with BlockSignals(self.filenameComboBox) as w:
                     w.setCurrentIndex( self.filenameComboBox.findText( shortname ))
Beispiel #23
0
 def loadFile(self, fullname):
     """Load in a file."""
     logger = logging.getLogger(__name__)
     if fullname:
         self.script.fullname = fullname
         with fullname.open("r") as f:
             self.script.code = f.read()
         self.textEdit.setPlainText(self.script.code)
         if self.script.fullname not in self.recentFiles:
             self.filenameComboBox.addItem(self.script.shortname)
         self.recentFiles.add(fullname)
         with BlockSignals(self.filenameComboBox) as w:
             ind = w.findText(str(self.script.shortname)) #having issues with findData Path object comparison
             w.removeItem(ind) #these two lines just push the loaded filename to the top of the combobox
             w.insertItem(0, str(self.script.shortname))
             w.setItemData(0, self.script.fullname)
             w.setCurrentIndex(0)
         logger.info('{0} loaded'.format(self.script.fullname))
         self.initcode = copy.copy(self.script.code)
Beispiel #24
0
 def loadFile(self, fullname):
     """Load in a file."""
     logger = logging.getLogger(__name__)
     if fullname:
         self.script.fullname = fullname
         with open(fullname, "r") as f:
             self.script.code = f.read()
         self.textEdit.setPlainText(self.script.code)
         if self.script.shortname not in self.recentFiles:
             self.recentFiles[self.script.shortname] = fullname
             self.filenameComboBox.addItem(self.script.shortname)
             self.updateValidator()
         with BlockSignals(self.filenameComboBox) as w:
             ind = w.findText(self.script.shortname)
             w.removeItem(ind)
             w.insertItem(0, self.script.shortname)
             w.setCurrentIndex(0)
         logger.info('{0} loaded'.format(self.script.fullname))
         self.initcode = copy.copy(self.script.code)
Beispiel #25
0
 def onLoadAnalysisConfiguration(self, name):
     name = str(name)
     if name is not None and name in self.analysisDefinitionDict:
         with Override(self.parameters, 'autoSave', False):
             self.currentAnalysisName = name
             self.setAnalysisDefinition(self.analysisDefinitionDict[name])
             self.onActiveAnalysisChanged(
                 self.analysisTableModel.createIndex(0, 0))
             if self.analysisConfigurationComboBox.currentText() != name:
                 with BlockSignals(self.analysisConfigurationComboBox):
                     self.analysisConfigurationComboBox.setCurrentIndex(
                         self.analysisConfigurationComboBox.findText(name))
             logging.getLogger(__name__).debug(
                 "Loaded Analysis '{0}' '{1}'".format(
                     self.currentAnalysisName,
                     self.analysisDefinition[0].name
                     if self.analysisDefinition else ""))
             self.currentAnalysisChanged.emit(self.currentAnalysisName)
         self.autoSave()
Beispiel #26
0
 def onItemChanged(self, guiName, item):
     """A new name is typed in for a table entry"""
     tabWidget, comboBox, tableWidget, nameEdit = self.guiDict[guiName]
     row = tableWidget.row(item)
     column = tableWidget.column(item)
     if self.currentObj[guiName]:
         _, oldName = self.currentObj[guiName]
     if column == 1:  #This should always be true, since column 0 is not editable
         newName = str(item.text())
         objName = str(tableWidget.item(row, 0).text())
         if newName == oldName:
             return
         elif getattr(self, guiName).count((objName, newName)) > 1:
             logging.getLogger(__name__).warning(
                 "{0} already exists".format(
                     self.project.fullName(objName, newName)))
             item.setText(oldName)
             return
         elif ':' in newName:
             logging.getLogger(__name__).warning(
                 "character ':' cannot be used in a name")
             return
         subDict = self.widgetDict.pop((guiName, objName, oldName))
         self.widgetDict[(guiName, objName, newName)] = subDict
         if objName == 'Opal Kelly FPGA':
             for fieldname, subwidget in subDict['subwidgetList']:
                 if fieldname == 'device':
                     subwidget.widget.name = newName
                     break
         oldFullName = self.project.fullName(objName, oldName)
         newFullName = self.project.fullName(objName, newName)
         self.currentObj[guiName] = (objName, newName)
         with BlockSignals(tabWidget) as w:
             widget = subDict['widget']
             index = w.indexOf(widget)
             w.setTabText(index, newFullName)
         templateDict = self.guiTemplate[guiName][objName]
         roles = templateDict.get('roles') if templateDict else None
         if roles:
             for role in roles:
                 self.roleDict[role].remove(oldFullName)
                 self.roleDict[role].append(newFullName)
             self.updateRoles.emit()
Beispiel #27
0
 def onTabWidgetChanged(self, guiName, index):
     """Tab widget is clicked. Change the selection in the table widget.
     Args:
         guiName (str): 'hardware' or 'software'
         index (int): new selected index in tab widget
     """
     tabWidget, comboBox, tableWidget, nameEdit = self.guiDict[guiName]
     fullName = str(tabWidget.tabText(index))
     objName, name = self.project.fromFullName(fullName)
     with BlockSignals(tableWidget) as w:
         numRows = w.rowCount()
         for row in range(numRows):
             objNameItem = tableWidget.item(row, 0)
             nameItem = tableWidget.item(row, 1)
             if str(objNameItem.text()) == objName and str(
                     nameItem.text()) == name:
                 w.setCurrentItem(objNameItem)
                 self.currentObj[guiName] = (objName, name)
                 break
Beispiel #28
0
 def doChangeScanTarget(self, name, scanParameter):
     """ Change the scan target as part of loading a parameter set,
     we know the ScanParameter to select and want it either selected or added as red item """
     name = str(name)
     if name != self.parameters.currentScanTarget:
         with BlockSignals(self.comboBoxScanTarget):
             self.comboBoxScanTarget.setCurrentIndex(
                 self.comboBoxScanTarget.findText(name))
         targets = self.scanTargetDict.get(name)
         if targets is not None:
             targets = sorted(targets)
         scanParameter = updateComboBoxItems(self.comboBoxParameter,
                                             targets, scanParameter)
         self.settings.scanTarget = name
         self.parameters.currentScanTarget = name
     else:
         self.comboBoxParameter.setCurrentIndex(
             self.comboBoxParameter.findText(scanParameter))
     self.checkSettingsSavable()
     return scanParameter
Beispiel #29
0
 def loadContextByName(self, name):
     if name in self.contextDict:
         self.loadContext(self.contextDict[name])
         with BlockSignals(self.contextComboBox) as w:
             w.setCurrentIndex(w.findText(name))
Beispiel #30
0
 def setEditorData(self, editor, index):
     """Set the data in the editor based on the model"""
     value = index.model().data(index, QtCore.Qt.EditRole)
     if value:
         with BlockSignals(editor) as e:
             e.setCurrentIndex(e.findText(value))