def endEdit(self, row, col, accept, replace): if col in self.customColumns: value = str(self.text(row, col)) type = self.customColumns[col]['type'] if type == 'integer': try: v = int(value) except: QMessageBox.warning( None, 'Invalid value', '%s is not a valid integer value' % value, QMessageBox.Ok) accept = False elif type == 'float': try: v = float(value) except: QMessageBox.warning( None, 'Invalid value', '%s is not a valid float value' % value, QMessageBox.Ok) accept = False return QTable.endEdit(self, row, col, accept, replace)
def endEdit(self, row, col, accept, replace): if col == 1 and row >= 0: self.item(row, 2).setEnabled(0) if accept: property = self.propertyBag.getProperty(str(self.text(row, 0))) oldValue = property.getUserValue() if property.getType() == "boolean": property.setValue(self.item(row, 1).isChecked()) elif property.getType() == "combo": property.setValue(self.item(row, 1).currentText()) else: try: property.setValue(str(self.text(row, 1))) except BaseException: logging.getLogger().error( "Cannot assign value to property") if property.getUserValue() is None: self.setText(row, 1, "") else: self.setText(row, 1, str(property.getUserValue())) if not oldValue == property.getUserValue(): self.emit( PYSIGNAL("propertyChanged"), (property.getName(), oldValue, property.getUserValue()), ) return QTable.endEdit(self, row, col, accept, replace)
def endEdit(self, row, col, accept, replace): if col in self.customColumns: value = str(self.text(row, col)) type = self.customColumns[col]["type"] if type == "integer": try: v = int(value) except BaseException: QMessageBox.warning( None, "Invalid value", "%s is not a valid integer value" % value, QMessageBox.Ok, ) accept = False elif type == "float": try: v = float(value) except BaseException: QMessageBox.warning( None, "Invalid value", "%s is not a valid float value" % value, QMessageBox.Ok, ) accept = False return QTable.endEdit(self, row, col, accept, replace)
def endEdit(self, row, col, accept, replace): if col == 1 and row >= 0: self.item(row, 2).setEnabled(0) if accept: property = self.propertyBag.getProperty(str(self.text(row, 0))) oldValue = property.getUserValue() if property.getType() == 'boolean': property.setValue(self.item(row, 1).isChecked()) elif property.getType() == 'combo': property.setValue(self.item(row, 1).currentText()) else: try: property.setValue(str(self.text(row, 1))) except: logging.getLogger().error('Cannot assign value to property') if property.getUserValue() is None: self.setText(row, 1, '') else: self.setText(row, 1, str(property.getUserValue())) if not oldValue == property.getUserValue(): self.emit(PYSIGNAL('propertyChanged'), (property.getName(), oldValue, property.getUserValue(), )) return QTable.endEdit(self, row, col, accept, replace)
def endEdit(self, row, col, accept, replace): if col == 2: # start pos. motor = self.motors[str(self.text(row, 0))] if motor is not None and motor.isReady(): lowlimit, highlimit = motor.getLimits() try: if float(self.text(row, col)) < lowlimit: raise except: QMessageBox.warning( None, 'Invalid value', 'Cannot set start pos. below low limit %f' % lowlimit, QMessageBox.Ok) accept = False elif col == 3: # end pos. motor = self.motors[str(self.text(row, 0))] if motor is not None and motor.isReady(): lowlimit, highlimit = motor.getLimits() try: if float(self.text(row, col)) > highlimit: raise except: QMessageBox.warning( None, 'Invalid value', 'Cannot set end pos. beyond high limit %f' % highlimit, QMessageBox.Ok) accept = False elif col in self.customColumns: value = str(self.text(row, col)) type = self.customColumns[col]['type'] if type == 'integer': try: v = int(value) except: QMessageBox.warning( None, 'Invalid value', '%s is not a valid integer value' % value, QMessageBox.Ok) accept = False elif type == 'float': try: v = float(value) except: QMessageBox.warning( None, 'Invalid value', '%s is not a valid float value' % value, QMessageBox.Ok) accept = False return QTable.endEdit(self, row, col, accept, replace)
def endEdit(self, row, col, accept, replace): if col in self.customColumns: value = str(self.text(row, col)) type = self.customColumns[col]['type'] if type == 'integer': try: v = int(value) except: QMessageBox.warning(None, 'Invalid value', '%s is not a valid integer value' % value, QMessageBox.Ok) accept = False elif type == 'float': try: v = float(value) except: QMessageBox.warning(None, 'Invalid value', '%s is not a valid float value' % value, QMessageBox.Ok) accept = False return QTable.endEdit(self, row, col, accept, replace)
def endEdit(self, row, col, accept, replace): if col == 2: # start pos. motor = self.motors[str(self.text(row, 0))] if motor is not None and motor.isReady(): lowlimit, highlimit = motor.getLimits() try: if float(self.text(row, col)) < lowlimit: raise except: QMessageBox.warning(None, 'Invalid value', 'Cannot set start pos. below low limit %f' % lowlimit, QMessageBox.Ok) accept = False elif col == 3: # end pos. motor = self.motors[str(self.text(row, 0))] if motor is not None and motor.isReady(): lowlimit, highlimit = motor.getLimits() try: if float(self.text(row, col)) > highlimit: raise except: QMessageBox.warning(None, 'Invalid value', 'Cannot set end pos. beyond high limit %f' % highlimit, QMessageBox.Ok) accept = False elif col in self.customColumns: value = str(self.text(row, col)) type = self.customColumns[col]['type'] if type == 'integer': try: v = int(value) except: QMessageBox.warning(None, 'Invalid value', '%s is not a valid integer value' % value, QMessageBox.Ok) accept = False elif type == 'float': try: v = float(value) except: QMessageBox.warning(None, 'Invalid value', '%s is not a valid float value' % value, QMessageBox.Ok) accept = False return QTable.endEdit(self, row, col, accept, replace)
def endEdit(self, row, col, accept, replace): if col == 2: # start pos. motor = self.motors[str(self.text(row, 0))] if motor is not None and motor.isReady(): lowlimit, highlimit = motor.getLimits() try: if float(self.text(row, col)) < lowlimit: raise except BaseException: QMessageBox.warning( None, "Invalid value", "Cannot set start pos. below low limit %f" % lowlimit, QMessageBox.Ok, ) accept = False elif col == 3: # end pos. motor = self.motors[str(self.text(row, 0))] if motor is not None and motor.isReady(): lowlimit, highlimit = motor.getLimits() try: if float(self.text(row, col)) > highlimit: raise except BaseException: QMessageBox.warning( None, "Invalid value", "Cannot set end pos. beyond high limit %f" % highlimit, QMessageBox.Ok, ) accept = False elif col in self.customColumns: value = str(self.text(row, col)) type = self.customColumns[col]["type"] if type == "integer": try: v = int(value) except BaseException: QMessageBox.warning( None, "Invalid value", "%s is not a valid integer value" % value, QMessageBox.Ok, ) accept = False elif type == "float": try: v = float(value) except BaseException: QMessageBox.warning( None, "Invalid value", "%s is not a valid float value" % value, QMessageBox.Ok, ) accept = False return QTable.endEdit(self, row, col, accept, replace)