3 class AccountsModel(gtk.ListStore):
4 C_UID, C_APIKEY = range(2)
6 def __init__(self, controller):
7 gtk.ListStore.__init__(self, 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 self.set(liter, self.C_UID, uid, self.C_APIKEY, key)
25 class CharacterListModel(gtk.ListStore):
26 C_PORTRAIT, C_NAME, C_UID = range(3)
28 def __init__(self, controller):
29 gtk.ListStore.__init__(self, gtk.gdk.Pixbuf, str, str)
30 self.controller = controller
31 # should we do this on initialization?
34 def get_characters(self):
37 char_list = self.controller.get_characters()
39 for name, icon, uid in char_list:
41 self.set(liter, self.C_PORTRAIT, self._set_pix(icon), self.C_NAME, name, self.C_UID, uid)
43 def _set_pix(self, filename):
44 pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
48 class CharacterSkillsModel(gtk.ListStore):
49 C_NAME, C_RANK, C_SKILLPOINTS, C_LEVEL = range(4)
51 SP = [0, 250, 1414, 8000, 45255, 256000]
53 def __init__(self, controller, charID):
54 gtk.ListStore.__init__(self, str, str, str, str)
55 self.controller = controller
62 uid = self.controller.charid2uid(self.charID)
64 self.sheet = self.controller.get_char_sheet(uid, self.charID)
66 skilltree = self.controller.get_skill_tree()
68 for g in skilltree.skillGroups:
70 skills_trained_in_this_group = False
72 for skill in g.skills:
74 trained = self.sheet.skills.Get(skill.typeID, False)
78 if not skills_trained_in_this_group:
80 #TODO: add as a heading/category
81 skills_trained_in_this_group = True
83 # add row for this skill
85 self.set(liter, self.C_NAME, "%s" % skill.typeName,
86 self.C_RANK, "<small>(Rank %d)</small>" % skill.rank,
87 self.C_SKILLPOINTS, "SP: %d" % trained.skillpoints,
88 self.C_LEVEL, "Level %d" % trained.level)