def setFieldValueCommand(self, field, value): '''Be careful, this is usually called from a qt callback, so we mustn't rebuild qt objects here.''' if self.value_is_adjusting: return #print 'setFieldValueCommand', repr(field), repr(value) #print '/%s/attrs/%s' % (State.getSel(),field) State.setKey('/%s/attrs/%s' % (State.getSel(),field),value) self.edit_signal.emit(State.getSel(),field,value) # DH self.clean_state() # if changing the field has side effects, these should happen before the push (I think) State.push('Set %s' % str(field)) undoCmd = State.getUndoCmd() self.undoItem.setText('&Undo' if undoCmd is None else '&Undo [%s]' % undoCmd) redoCmd = State.getRedoCmd() self.redoItem.setText('Re&do' if redoCmd is None else 'Re&do [%s]' % redoCmd)
def updateMenus(self): '''Keeps the GUI menus and the attribute editor in sync with the actual state.''' undoCmd = State.getUndoCmd() self.undoItem.setText('&Undo' if undoCmd is None else '&Undo [%s]' % undoCmd) redoCmd = State.getRedoCmd() self.redoItem.setText('Re&do' if redoCmd is None else 'Re&do [%s]' % redoCmd) #print undoCmd, redoCmd if self.attributeEditor is not None: sel = State.getSel() if sel is None: self.qfields.setFields('',[],{}) else: st = State.getKey(sel+'/type',None) sa = State.getKey(sel+'/attrs',{}) global fields self.qfields.setFields(sel, fields.get(st,[]), sa) self.attributeEditor.setWidget(self.qfields) self.updateGL()