def SetValue(self, row, col, val): data = self.workset[row] if col == 0: data.item.value = val elif col == 1: data.item.name = val elif col == 2: data.item.desc = val if data.atrib == 'new' and data.item.valid: self.data.addInterrupt(data.item) my.post_event(self.parent, my.EVT_INT_ADDED, data.item)
def AddItem(self, obj): pn = self.data.newPeripheral('NEW_PERIPHERAL') dlg = wx.TextEntryDialog(self, 'Enter new peripheral name', 'New peripheral', pn.name) if wx.ID_OK == dlg.ShowModal(): pn.name = dlg.GetValue() names = [x.name for x in self.data.peripherals] if pn.name and pn.name not in names: self.data.addPeripheral(pn) my.post_event(self.GetGrandParent(), my.EVT_PER_ADDED, pn) else: wx.MessageBox('Incorrect or existed name', 'Error', wx.OK | wx.ICON_ERROR)
def AddItem(self, obj): dlg = wx.TextEntryDialog(self, 'Enter new Field name', 'New bitfield', 'NEW_BITFIELD') if wx.ID_OK == dlg.ShowModal(): nf = self.data.newField(dlg.GetValue()) names = [x.name for x in self.data.fields] if nf and nf.name and nf.name not in names: self.data.addField(nf) my.post_event(self, my.EVT_FIELD_ADDED, nf) else: wx.MessageBox('Incorrect or existed name', 'Error', wx.OK | wx.ICON_ERROR)
def SetValue(self, row, col, val): data = self.workset[row] if col == 0: data.item.bito = val if col == 1: data.item.bitw = val if col == 2: data.item.name = val if val else data.name if col == 3: data.item.desc = val if col == 4: data.item.access = val # checking for data add if data.atrib == 'new' and data.item.valid: self.data.addField(data.item) my.post_event(self.parent, my.EVT_FIELD_ADDED, data.item)
def SetValue(self, row, col, val): data = self.workset[row] if data.atrib == 'ref': return if col == 0: data.item.offset = val elif col == 1: if data.atrib == 'main': my.post_event(self.parent, my.EVT_REG_NAME_CHANGED, data.item) data.item.name = val elif col == 2: data.item.desc = val elif col == 3: data.item.access = val if data.atrib == 'new' and data.item.valid: self.data.addRegister(data.item) my.post_event(self.parent, my.EVT_REG_ADDED, data.item)
def SetValue(self, row, col, val): data = self.data if row == 0: data.name = val my.post_event(self.parent.GetGrandParent(), my.EVT_DEV_NAME_CHANGED, data) elif row == 1: data.desc = val elif row == 2: data.vendor = val elif row == 3: data.width = val elif row == 4: data.rsize = val elif row == 5: data.access = val elif row == 6: data.rvalue = val
def SetValue(self, row, col, val): data = self.data if data is None: return elif row == 0: if val and data.name != val: data.name = val my.post_event(self.parent, my.EVT_PER_NAME_CHANGED, data) elif row == 1: data.desc = val elif row == 2: data.group = val elif row == 3: if data.setRef(val): my.post_event(self.parent, my.EVT_PER_REF_CHANGED, data) elif row == 4: data.address = val elif row == 5: data.aoffset = val elif row == 6: data.asize = val
def AddItem(self, obj): if obj == self.igrid: dlg = wx.TextEntryDialog(self, 'Enter new Interrupt name', 'New interrupt', 'NEW_INTERRUPT') if wx.ID_OK == dlg.ShowModal(): ni = self.data.newInterrupt(dlg.GetValue()) names = [x.name for x in self.data.interrupts] if ni.name and ni.name not in names: self.data.addInterrupt(ni) my.post_event(self, my.EVT_INT_ADDED, ni) else: wx.MessageBox('Incorrect or existed name', 'Error', wx.OK | wx.ICON_ERROR) else: dlg = wx.TextEntryDialog(self, 'Enter new Register name', 'New register', 'NEW_REGISTER') if wx.ID_OK == dlg.ShowModal(): nr = self.data.newRegister(dlg.GetValue()) names = [x.name for x in self.data.registers] if nr.name and nr.name not in names: self.data.addRegister(nr) my.post_event(self, my.EVT_REG_ADDED, nr) else: wx.MessageBox('Incorrect or existed name', 'Error', wx.OK | wx.ICON_ERROR)
def SetValue(self, row, col, val): data = self.data if data is None: return elif row == 0: if val and data.name != val: data.name = val my.post_event(self.parent, my.EVT_REG_NAME_CHANGED, data) elif row == 1: data.dispname = val elif row == 2: data.desc = val elif row == 3: data.offset = val elif row == 4: data.rsize = val elif row == 5: if data.access != val: data.access = val my.post_event(self.parent, my.EVT_REG_ACCS_CHANGED, data) elif row == 6: data.rvalue = val
def DelRecord(self, index): record = self.workset[index] if record.atrib == 'main': self.data.delField(record.item) my.post_event(self.parent, my.EVT_FIELD_DELETED, record.item)
def OnSelChanged(self, event): item = self.tree.GetFocusedItem() obj = self.tree.GetPyData(item) my.post_event(self.GetGrandParent(), my.EVT_SELECTED, obj)
def DelRecord(self, index): record = self.workset[index] if record.atrib == 'main': self.data.delInterrupt(record.item) my.post_event(self.parent, my.EVT_INT_DELETED, record.item)