3 class AccountsModel(gtk.ListStore):
4 C_UID, C_APIKEY, C_CHARS = range(3)
6 def __init__(self, controller):
7 gtk.ListStore.__init__(self, str, str, str)
8 self.controller = controller
11 def get_accounts(self):
14 accts_dict = self.controller.get_accounts()
19 for uid, key in accts_dict.items():
21 chars = self.controller.get_chars_from_acct(uid)
23 char_str = ', '.join(chars)
24 char_str = "<small>%s</small>" % char_str
28 self.set(liter, self.C_UID, uid, self.C_APIKEY, key, self.C_CHARS, char_str)
32 class CharacterListModel(gtk.ListStore):
33 C_PORTRAIT, C_NAME, C_UID = range(3)
35 def __init__(self, controller):
36 gtk.ListStore.__init__(self, gtk.gdk.Pixbuf, str, str)
37 self.controller = controller
38 # should we do this on initialization?
41 def get_characters(self):
44 char_list = self.controller.get_characters()
46 for name, icon, uid in char_list:
48 self.set(liter, self.C_PORTRAIT, self._set_pix(icon), self.C_NAME, name, self.C_UID, uid)
50 def _set_pix(self, filename):
51 pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
55 class CharacterSkillsModel(gtk.ListStore):
56 C_NAME, C_RANK, C_SKILLPOINTS, C_LEVEL = range(4)
58 SP = [0, 250, 1414, 8000, 45255, 256000]
60 def __init__(self, controller, charID):
61 gtk.ListStore.__init__(self, str, str, str, str)
62 self.controller = controller
69 uid = self.controller.charid2uid(self.charID)
71 self.sheet = self.controller.get_char_sheet(uid, self.charID)
73 skilltree = self.controller.get_skill_tree()
75 for g in skilltree.skillGroups:
77 skills_trained_in_this_group = False
79 for skill in g.skills:
81 trained = self.sheet.skills.Get(skill.typeID, False)
85 if not skills_trained_in_this_group:
87 #TODO: add as a heading/category
88 skills_trained_in_this_group = True
90 # add row for this skill
92 self.set(liter, self.C_NAME, "%s" % skill.typeName,
93 self.C_RANK, "<small>(Rank %d)</small>" % skill.rank,
94 self.C_SKILLPOINTS, "SP: %d" % trained.skillpoints,
95 self.C_LEVEL, "Level %d" % trained.level)