self.gconf = gnome.gconf.client_get_default()
self.ui = ui.mEveMonUI(self)
-
def run(self):
gtk.main()
def set_uid(self, uid):
self.gconf.set_string("/apps/maemo/mevemon/eve_uid", uid)
- # really quick hack to get character list. doesn't handle errors well, and if it can't get the gconf settings it just returns the placeholders, when in reality it should tell the UI or something. basically half finished, just uploading to show ry... FIXME --danny
+ def eveapi_connect(self):
+ uid = self.get_uid()
+ api_key = self.get_api_key()
+ cached_api = eveapi.EVEAPIConnection( cacheHandler = apicache.cache_handler( debug = False ) )
+
+ try:
+ auth = cached_api.auth( userID = uid, apiKey = api_key )
+ except eveapi.Error, e:
+ # if we can't, return the error message/pic --danny
+ return None
+ except Exception, e:
+ # unknown exception, dunno if this needs to be here if I just
+ # ignore it... probably a bad idea, but it was in the
+ # apitest.py example... --danny
+ raise
+
+ return auth
+
+ def get_alliances(self, charID):
+ auth = eveapi_connect()
+
+ if auth:
+ alliance_list = auth.character(charID)
+
+
+
+
+
+ # really quick hack to get character list. doesn't handle errors well, and
+ # if it can't get the gconf settings it just returns the placeholders, when
+ # in reality it should tell the UI or something. basically half finished,
+ # just uploading to show ry... FIXME --danny
def get_characters( self ):
ui_char_list = []
# error message --danny
placeholder_chars = [("Please check your API settings.", "imgs/error.jpg")]
- cached_api = eveapi.EVEAPIConnection( cacheHandler = apicache.cache_handler( debug = False ) )
- uid = self.get_uid()
- api_key = self.get_api_key()
- # if they are entered into gconf, try getting api data --danny
- if ( uid and api_key ):
- auth = cached_api.auth( userID = uid, apiKey = api_key )
- try:
- api_char_list = auth.account.Characters()
- except eveapi.Error, e:
- # if we can't, return the error message/pic --danny
- return placeholder_chars
- except Exception, e:
- # unknown exception, dunno if this needs to be here if I just ignore it... probably a bad idea, but it was in the apitest.py example... --danny
- ##return placeholder_chars
- raise
+
+ auth = self.eveapi_connect()
+
+ try:
+ api_char_list = auth.account.Characters()
# append each char we get to the list we'll return to the UI --danny
for character in api_char_list.characters:
- ui_char_list.append( ( character.name, fetchimg.portrait_filename( character.characterID, 64 ) ) )
+ ui_char_list.append( ( character.name,
+ fetchimg.portrait_filename( character.characterID, 64 ) ) )
return ui_char_list
# if not entered into gconf, error message --danny
- else:
+ except eveapi.Error, e:
return placeholder_chars
if __name__ == "__main__":
# gtk.HILDON_UI_MODE_NORMAL -> not selection in the treeview
# gtk.HILDON_UI_MODE_EDIT -> selection in the treeview
treeview = hildon.GtkTreeView(gtk.HILDON_UI_MODE_NORMAL)
+ treeview.connect('row-activated', self.build_window)
self.char_model = self.create_char_model()
treeview.set_model(self.char_model)
win.show_all()
+ def build_window(self, treeview, path, view_column):
+ print "triggered treeview"
+ print treeview
+ print path
+ print view_column
+
def create_char_model(self):
lstore = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING)