"""
Returns an object from eveapi containing information about the
current skill in training
-
"""
try:
skill = self.get_auth(uid).character(char_id).SkillInTraining()
return skill
def connection_cb(self, connection, event, mgc):
+ """
+ I'm not sure why we need this, but connection.connect() won't work
+ without it, even empty.
+ """
pass
def connect_to_network(self):
+ """
+ This will connect to the default network if avaliable, or pop up the
+ connection dialog to select a connection.
+ Running this when we start the program ensures we are connected to a
+ network.
+ """
connection = conic.Connection()
#why 0xAA55?
connection.connect("connection-event", self.connection_cb, 0xAA55)
def get_sp(self, uid, char_id):
- sheet = self.get_char_sheet(uid, char_id)
-
- # TODO: we also have to calculate how much we earned from a
- # currently training skill
-
+ """
+ Adds up the SP for all known skills, then calculates the SP gained
+ from an in-training skill.
+ """
actual_sp = 0
+ sheet = self.get_char_sheet(uid, char_id)
for skill in sheet.skills:
actual_sp += skill.skillpoints
"""
returns the additional SP that the in-training skill has acquired
"""
-
spps_tuple = self.get_spps(uid, char_id)
- print spps_tuple
-
if not spps_tuple:
return 0
-
spps, start_time = spps_tuple
-
eve_time = time.time() #evetime is utc, right?
-
time_diff = eve_time - start_time
return (spps * time_diff)
def build_window(self, treeview, path, view_column):
# TODO: this is a really long and ugly function, split it up somehow
- win = hildon.StackableWindow()
- win.show_all()
- hildon.hildon_gtk_window_set_progress_indicator(win, 1)
+ self.win = hildon.StackableWindow()
+ #win.show_all()
+ hildon.hildon_gtk_window_set_progress_indicator(self.win, 1)
# Create menu
# NOTE: we probably want a window-specific menu for this page, but the
# main appmenu works for now
- menu = self.create_menu(win)
+ menu = self.create_menu(self.win)
# Attach menu to the window
- win.set_app_menu(menu)
+ self.win.set_app_menu(menu)
pannable_area = hildon.PannableArea()
self.sheet = self.controller.get_char_sheet(self.uid, self.char_id)
- win.set_title(char_name)
+ self.win.set_title(char_name)
hbox = gtk.HBox(False, 0)
self.add_columns_to_skills_view(skills_treeview)
vbox.pack_start(skills_treeview, False, False, 1)
- win.add(pannable_area)
- win.show_all()
+ self.win.add(pannable_area)
+ self.win.show_all()
- hildon.hildon_gtk_window_set_progress_indicator(win, 0)
+ hildon.hildon_gtk_window_set_progress_indicator(self.win, 0)
def display_skill_in_training(self, vbox):
skill = self.controller.get_skill_in_training(self.uid, self.char_id)
self.add_label("<small><b>Corp:</b> %s</small>" % self.sheet.corporationName, box)
self.add_label("<small><b>Balance:</b> %s ISK</small>" % self.sheet.balance, box)
self.live_sp_val = self.controller.get_sp(self.uid, self.char_id)
- print self.live_sp_val
self.live_sp = self.add_label("<small><b>Total SP:</b> %s</small>" %
self.live_sp_val, box)
treeview.append_column(column)
- def refresh_clicked(self, button, window):
- hildon.hildon_gtk_window_set_progress_indicator(window, 1)
+ def refresh_clicked(self, button):
+ hildon.hildon_gtk_window_set_progress_indicator(self.win, 1)
self.skills_model.get_skills()
- hildon.hildon_gtk_window_set_progress_indicator(window, 0)
+ hildon.hildon_gtk_window_set_progress_indicator(self.win, 0)
def update_live_sp(self):
+ # we don't want to keep the timer running in the background
+ # when this callback returns False, the timer destorys itself
+ if not self.win.get_is_topmost():
+ return False
+
self.live_sp_val = self.live_sp_val + self.spps * self.UPDATE_INTERVAL
self.live_sp.set_label("<small><b>Total SP:</b> %d</small>" %
self.live_sp_val)