def OnAddRow(self, evt): # Add some bogus data to a new row in the model's data id = len(Config.holdingsDf) + 1 #self.log.write("OnAddRow() id %d\n" % id) value = ["", "New ticker", "", "", ""] self.model.AddRow(id, value) # Clear the selection self.dvc.SetSelections(dv.DataViewItemArray())
def OnMoveDown(self, evt): items = self.dvc.GetSelections() rows = [self.model.GetRow(item) for item in items] self.model.MoveDown(rows) # Keep the moved-down rows selected self.dvc.UnselectAll() items = dv.DataViewItemArray() for row in rows: items.append(self.model.GetItem(row + 1)) self.dvc.SetSelections(items)