4 class AccountsModel(gtk.ListStore):
6 # userID no longer exists, we want keyID
7 # api key becomes verification code... --danny
8 C_KID, C_VCODE, C_CHARS = range(3)
10 def __init__(self, controller):
11 gtk.ListStore.__init__(self, str, str, str)
12 self.controller = controller
15 def get_accounts(self):
18 accts_dict = self.controller.settings.get_accounts()
23 for key_id, key in accts_dict.items():
25 chars, ids = self.controller.get_chars_from_acct(key_id)
27 char_str = ', '.join(chars)
28 char_str = "<small>%s</small>" % char_str
32 self.set(liter, self.C_KID, key_id, self.C_VCODE, key, self.C_CHARS, char_str)
36 class CharacterListModel(gtk.ListStore):
38 C_PORTRAIT, C_NAME, C_KID = range(3)
40 def __init__(self, controller):
41 gtk.ListStore.__init__(self, gtk.gdk.Pixbuf, str, str)
42 self.controller = controller
43 # should we do this on initialization?
46 def get_characters(self):
49 char_list = self.controller.get_characters()
51 for name, icon, key_id in char_list:
53 self.set(liter, self.C_PORTRAIT, self._set_pix(icon), self.C_NAME, name, self.C_KID, key_id)
55 def _set_pix(self, filename):
56 pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
60 class CharacterSkillsModel(gtk.ListStore):
61 C_NAME, C_RANK, C_SKILLPOINTS, C_LEVEL = range(4)
63 SP = [0, 250, 1414, 8000, 45255, 256000]
65 def __init__(self, controller, charID):
66 gtk.ListStore.__init__(self, str, str, str, str)
67 self.controller = controller
74 key_id = self.controller.charid2key_id(self.charID)
76 self.sheet = self.controller.get_char_sheet(key_id, self.charID)
78 skilltree = self.controller.get_skill_tree()
80 for g in skilltree.skillGroups:
82 skills_trained_in_this_group = False
84 for skill in g.skills:
86 trained = self.sheet.skills.Get(skill.typeID, False)
90 if not skills_trained_in_this_group:
92 #TODO: add as a heading/category
93 skills_trained_in_this_group = True
95 # add row for this skill
97 self.set(liter, self.C_NAME, "%s" % skill.typeName,
98 self.C_RANK, "<small>(Rank %d)</small>" % skill.rank,
99 self.C_SKILLPOINTS, "SP: %s" % util.comma(trained.skillpoints),
100 self.C_LEVEL, "Level %d" % trained.level)