def UpdateAll(self,*args): """ Refreshes all character information from self.char. A bit drastic of a modification unless loading a new character. Rebuilds self.statStore and self.skillStore. Rebuilds table of resistances. """ self.Block() self.statStore = TMH.StatListStore(self.char) self.statView.set_model(self.statStore) self.skillStore = TMH.SkillTreeStore(self.char) self.skillView.set_model(self.skillStore) self.skillListStore = TMH.SkillListStore(self.char) commonSkillStore = self.skillListStore.filter_new() commonSkillStore.set_visible_column(TMH.SkillTreeStore.col('CommonlyUsed')) self.commonSkillView.set_model(commonSkillStore) if hasattr(self,'weaponSkillStore'): self.Disconnect(self.weaponSkillStore) self.weaponSkillStore = TMH.WeaponListStore(self.char) self.weaponSkillView.set_model(self.weaponSkillStore) self.itemStore = TMH.ItemListStore(self.char) self.itemView.set_model(self.itemStore) self.talentStore = TMH.TalentListStore(self.char) self.talentView.set_model(self.talentStore) self.BuildStatTable(self.char) self.BuildResistanceTable(self.char) self.UpdateMisc() self.ShowHideLevelling() self.Unblock()
def test_statstore(self): store = TMH.StatListStore(self.char) for row, stat in zip(store, self.char.Stats): self.assertIs(row[TMH.StatListStore.col('obj')], stat) self.assertEqual(row[TMH.StatListStore.col('Name')], stat.Name) self.assertEqual(row[TMH.StatListStore.col('Temporary')], stat.Value) self.assertEqual(row[TMH.StatListStore.col('ValueBonus')], stat.ValueBonus()) self.assertEqual(row[TMH.StatListStore.col('Bonus')], stat.Bonus()) for stIter, stat in zip(store.IterAll, self.char.Stats): st, stName, stSB, stBon, stTemp = store.get( stIter, TMH.StatListStore.col('obj'), TMH.StatListStore.col('Name'), TMH.StatListStore.col('ValueBonus'), TMH.StatListStore.col('Bonus'), TMH.StatListStore.col('Temporary')) self.assertIs(st, stat) self.assertEqual(stName, stat.Name) self.assertEqual(stSB, stat.ValueBonus()) self.assertEqual(stBon, stat.Bonus()) self.assertEqual(stTemp, stat.Value)