4 class AccountsModel(gtk.ListStore):
5 C_UID, C_APIKEY, C_CHARS = range(3)
7 def __init__(self, controller):
8 gtk.ListStore.__init__(self, str, str, str)
9 self.controller = controller
12 def get_accounts(self):
15 accts_dict = self.controller.settings.get_accounts()
20 for uid, key in accts_dict.items():
22 chars = self.controller.get_chars_from_acct(uid)
24 char_str = ', '.join(chars)
25 char_str = "<small>%s</small>" % char_str
29 self.set(liter, self.C_UID, uid, self.C_APIKEY, key, self.C_CHARS, char_str)
33 class CharacterListModel(gtk.ListStore):
34 C_PORTRAIT, C_NAME, C_UID = range(3)
36 def __init__(self, controller):
37 gtk.ListStore.__init__(self, gtk.gdk.Pixbuf, str, str)
38 self.controller = controller
39 # should we do this on initialization?
42 def get_characters(self):
45 char_list = self.controller.get_characters()
47 for name, icon, uid in char_list:
49 self.set(liter, self.C_PORTRAIT, self._set_pix(icon), self.C_NAME, name, self.C_UID, uid)
51 def _set_pix(self, filename):
52 pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
56 class CharacterSkillsModel(gtk.ListStore):
57 C_NAME, C_RANK, C_SKILLPOINTS, C_LEVEL = range(4)
59 SP = [0, 250, 1414, 8000, 45255, 256000]
61 def __init__(self, controller, charID):
62 gtk.ListStore.__init__(self, str, str, str, str)
63 self.controller = controller
70 uid = self.controller.charid2uid(self.charID)
72 self.sheet = self.controller.get_char_sheet(uid, self.charID)
74 skilltree = self.controller.get_skill_tree()
76 for g in skilltree.skillGroups:
78 skills_trained_in_this_group = False
80 for skill in g.skills:
82 trained = self.sheet.skills.Get(skill.typeID, False)
86 if not skills_trained_in_this_group:
88 #TODO: add as a heading/category
89 skills_trained_in_this_group = True
91 # add row for this skill
93 self.set(liter, self.C_NAME, "%s" % skill.typeName,
94 self.C_RANK, "<small>(Rank %d)</small>" % skill.rank,
95 self.C_SKILLPOINTS, "SP: %s" % util.comma(trained.skillpoints),
96 self.C_LEVEL, "Level %d" % trained.level)