def addSampleRow(self, sample=None, index=-1): if sample is None: samp = Sample() if self.tableWidget.rowCount() == 0: samp.type = "Buffer" else: samp.type = "Sample" else: samp = sample if index == -1: index = self.tableWidget.rowCount() self.createSampleRow(index) self.setSampleRow(index, samp) self.copyPushButton.setEnabled(1) self.tableWidget.setRangeSelected( Qt.QTableWidgetSelectionRange(0, 0, index - 1, len(self.column_headers) - 1), 0) self.tableWidget.setRangeSelected( Qt.QTableWidgetSelectionRange(index, 0, index, len(self.column_headers) - 1), 1) self.tableWidget.setCurrentCell(index, 0)
def addSampleRow( self, sample = None, index = -1 ): if sample is None: samp = Sample() if self.tableWidget.rowCount() == 0: samp.type = "Buffer" else: samp.type = "Sample" else: samp = sample if index == -1: index = self.tableWidget.rowCount() self.createSampleRow( index ) self.setSampleRow( index, samp ) self.copyPushButton.setEnabled( 1 ) self.tableWidget.setRangeSelected( Qt.QTableWidgetSelectionRange( 0, 0, index - 1, len( self.column_headers ) - 1 ), 0 ) self.tableWidget.setRangeSelected( Qt.QTableWidgetSelectionRange( index, 0, index, len( self.column_headers ) - 1 ), 1 ) self.tableWidget.setCurrentCell( index, 0 )
def getSampleRow( self, i ): table = self.tableWidget sampleRow = Sample() #ISPyBSample() sampleRow.enable = table.cellWidget( i, self.ENABLE_COLUMN ).isChecked() sampleRow.type = str( table.cellWidget( i, self.SAMPLETYPE_COLUMN ).currentText() ) sampleRow.typen = table.cellWidget( i, self.SAMPLETYPE_COLUMN ).currentIndex() sampleRow.plate = str( table.cellWidget( i, self.PLATE_COLUMN ).currentText() ) #sampleRow.row = str(table.cellWidget(i, self.ROW_COLUMN).currentText()) rowtxt = str( table.cellWidget( i, self.ROW_COLUMN ).currentText() ) sampleRow.row = rowletters.index( rowtxt ) + 1 sampleRow.well = str( table.cellWidget( i, self.WELL_COLUMN ).currentText() ) sampleRow.concentration = table.cellWidget( i, self.CONCENTRATION_COLUMN ).value() sampleRow.comments = str( table.cellWidget( i, self.COMMENTS_COLUMN ).text() ) sampleRow.code = str( table.cellWidget( i, self.CODE_COLUMN ).text() ) sampleRow.viscosity = str( table.cellWidget( i, self.VISCOSITY_COLUMN ).currentText() ) sampleRow.buffername = str( table.cellWidget( i, self.BUFFERNAME_COLUMN ).currentText() ) sampleRow.transmission = table.cellWidget( i, self.TRANSMISSION_COLUMN ).value() sampleRow.volume = table.cellWidget( i, self.VOLUME_COLUMN ).value() sampleRow.flow = table.cellWidget( i, self.FLOW_COLUMN ).isChecked() sampleRow.recuperate = table.cellWidget( i, self.RECUPERATE_COLUMN ).isChecked() if sampleRow.type == 'Sample': sampleRow.SEUtemperature = table.cellWidget( i, self.TEMPERATURE_COLUMN ).value() sampleRow.waittime = table.cellWidget( i, self.WAITTIME_COLUMN ).value() else: sampleRow.SEUtemperature = 4.0 sampleRow.waittime = 0.0 sampleRow.title = sampleRow.getTitle() return sampleRow
def getSampleRow(self, i): table = self.tableWidget sampleRow = Sample() sampleRow.enable = table.cellWidget(i, self.ENABLE_COLUMN).isChecked() sampleRow.type = str( table.cellWidget(i, self.SAMPLETYPE_COLUMN).currentText()) sampleRow.typen = table.cellWidget( i, self.SAMPLETYPE_COLUMN).currentIndex() sampleRow.plate = str( table.cellWidget(i, self.PLATE_COLUMN).currentText()) #sampleRow.row = str(table.cellWidget(i, self.ROW_COLUMN).currentText()) rowtxt = str(table.cellWidget(i, self.ROW_COLUMN).currentText()) sampleRow.row = rowletters.index(rowtxt) + 1 sampleRow.well = str( table.cellWidget(i, self.WELL_COLUMN).currentText()) sampleRow.concentration = table.cellWidget( i, self.CONCENTRATION_COLUMN).value() sampleRow.comments = str( table.cellWidget(i, self.COMMENTS_COLUMN).text()) sampleRow.macromolecule = str( table.cellWidget(i, self.MACROMOLECULE_COLUMN).text()) sampleRow.code = str(table.cellWidget(i, self.CODE_COLUMN).text()) sampleRow.viscosity = str( table.cellWidget(i, self.VISCOSITY_COLUMN).currentText()) sampleRow.buffername = str( table.cellWidget(i, self.BUFFERNAME_COLUMN).currentText()) sampleRow.transmission = table.cellWidget( i, self.TRANSMISSION_COLUMN).value() sampleRow.volume = table.cellWidget(i, self.VOLUME_COLUMN).value() sampleRow.flow = table.cellWidget(i, self.FLOW_COLUMN).isChecked() sampleRow.recuperate = table.cellWidget( i, self.RECUPERATE_COLUMN).isChecked() if sampleRow.type == 'Sample': sampleRow.SEUtemperature = table.cellWidget( i, self.TEMPERATURE_COLUMN).value() sampleRow.waittime = table.cellWidget( i, self.WAITTIME_COLUMN).value() else: sampleRow.SEUtemperature = 4.0 sampleRow.waittime = 0.0 sampleRow.title = sampleRow.getTitle() return sampleRow