def SetUpItemView(self): """ Builds the TreeView for the items. """ self.itemView = self['itemView'] TMH.AddTextColumn(self.itemView,'Name',TMH.ItemListStore.col('Name')) TMH.AddTextColumn(self.itemView,'Bonuses',TMH.ItemListStore.col('Bonuses')) TMH.AddTextColumn(self.itemView,'Description',TMH.ItemListStore.col('Description')) TMH.RightClickToggle(self.itemView)
def SetUpTalentView(self): """ Builds the TreeView for the talents/flaws. """ self.talentView = self['talentView'] TMH.AddTextColumn(self.talentView,'Name',TMH.TalentListStore.col('Name')) TMH.AddTextColumn(self.talentView,'Bonuses',TMH.TalentListStore.col('Bonuses')) TMH.AddTextColumn(self.talentView,'Description',TMH.TalentListStore.col('Description')) TMH.RightClickToggle(self.talentView)
def SetUpWeaponSkillView(self): self.weaponSkillView = self['weaponOrderingView'] TMH.AddTextColumn(self.weaponSkillView,'Name',TMH.SkillTreeStore.col('Name')) self.weaponSkillView.enable_model_drag_dest([('text/plain',0,0)], gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE) self.weaponSkillView.enable_model_drag_source(gtk.gdk.BUTTON1_MASK, [('text/plain',0,0)], gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE)
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_skillstore(self): store = TMH.SkillTreeStore(self.char) for skIter, skill in zip(store.IterAll, self.char.Skills): sk, skName, skSB, skBon, skRanks = store.get( skIter, TMH.SkillTreeStore.col('obj'), TMH.SkillTreeStore.col('Name'), TMH.SkillTreeStore.col('ValueBonus'), TMH.SkillTreeStore.col('Bonus'), TMH.SkillTreeStore.col('Ranks')) self.assertIs(sk, skill) self.assertEqual(skName, skill.Name) self.assertEqual(skSB, skill.ValueBonus()) self.assertEqual(skBon, skill.Bonus()) self.assertEqual(skRanks, skill.Value)
def SetUpStatView(self): """ Builds the TreeView for the stats. """ self.statView = self['statView'] TMH.AddTextColumn(self.statView,'Name',TMH.StatListStore.col('Name'), editable=self.FromEditStatCell) TMH.AddTextColumn(self.statView,'Temp',TMH.StatListStore.col('Temporary'), editable=self.FromEditStatCell) TMH.AddTextColumn(self.statView,'Value Bonus',TMH.StatListStore.col('ValueBonus')) TMH.AddTextColumn(self.statView,'Potential',TMH.StatListStore.col('Potential'), editable=self.FromEditStatCell) TMH.AddTextColumn(self.statView,'Potential Bonus',TMH.StatListStore.col('PotentialBonus')) TMH.AddTextColumn(self.statView,'Bonus',TMH.StatListStore.col('Bonus')) TMH.RightClickToggle(self.statView)
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)
def SetUpSkillView(self): """ Builds the TreeView for the skills. Also builds the right-click menu to select visible columns. """ self.skillView = self['skillView'] TMH.AddTextColumn(self.skillView,'Name',TMH.SkillTreeStore.col('Name'), editable=self.FromEditSkillCell) TMH.AddTextColumn(self.skillView,'Ranks',TMH.SkillTreeStore.col('Ranks'), editable=self.FromEditSkillCell,viscol=TMH.SkillTreeStore.col('HasBonus')) TMH.AddTextColumn(self.skillView,'Rank Bonus',TMH.SkillTreeStore.col('ValueBonus'), viscol=TMH.SkillTreeStore.col('HasBonus')) TMH.AddTextColumn(self.skillView,'Bonus',TMH.SkillTreeStore.col('Bonus')) TMH.AddCheckboxColumn(self.skillView,'Commonly Used',TMH.SkillTreeStore.col('CommonlyUsed'), editable=self.FromToggleSkillCell) TMH.RightClickToggle(self.skillView) self['skillView'].enable_model_drag_dest([('text/plain',0,0)], gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE) self['skillView'].enable_model_drag_source(gtk.gdk.BUTTON1_MASK, [('text/plain',0,0)], gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE)
def SetUpCommonlyUsedSkillView(self): self.commonSkillView = self['commonSkillView'] TMH.AddTextColumn(self.commonSkillView,'Name',TMH.SkillTreeStore.col('Name')) TMH.AddTextColumn(self.commonSkillView,'Ranks',TMH.SkillTreeStore.col('Ranks')) TMH.AddTextColumn(self.commonSkillView,'Bonus',TMH.SkillTreeStore.col('Bonus'))