Hopefully fix bug #5672
authorRyan Campbell <campbellr@gmail.com>
Thu, 6 May 2010 06:18:36 +0000 (00:18 -0600)
committerRyan Campbell <campbellr@gmail.com>
Thu, 6 May 2010 06:18:36 +0000 (00:18 -0600)
This will hopefully fix bug #5672 "meveon crashes when started without a
network connection". We fix this by using python-conic to connect to the
default network when mevemon stops, or if there is no default netowork,
pop up the system dialog for selecting a connection.

I also changed the "except eveapi.Error:" sections to just "except:",
probably not a great idea, but we were crashing on socket exceptions
sometimes too (see bug #5663).

package/Makefile
package/debian/changelog
package/debian/control
package/src/mevemon.py

index 7cb15fb..e5d1d6d 100644 (file)
@@ -5,7 +5,7 @@
 #edit these when creating a new release
 MAJOR_VER='0'
 MINOR_VER='3'
-PKG_VER='1'
+PKG_VER='2'
 
 compile:
        perl -ni -e 'print; exit if /^XB-Maemo-Icon-26:$$/' debian/control
index f08b82c..9499ce2 100644 (file)
@@ -1,5 +1,5 @@
-mevemon (0.3-1) stable; urgency=low
+mevemon (0.3-2) stable; urgency=low
 
-  * UI cleanup and multiple account support
+  * Fix crash when starting mevemon without network connection
 
- -- Ryan Campbell <campbellr@gmail.com>  Thu, 29 Apr 2010 20:46:12 -0007
+ -- Ryan Campbell <campbellr@gmail.com>  Thu, 06 May 2010 00:16:32 -0007
index d61094d..f5ff853 100644 (file)
@@ -7,8 +7,9 @@ Standards-Version: 3.7.2
 
 Package: mevemon
 Architecture: all
-Depends: python2.5, python2.5-gtk2, python-hildon | python2.5-hildon, python2.5-gobject |
- python-gobject, gnome-python | python2.5-gnome
+Depends: python2.5, python2.5-gtk2, python-hildon | python2.5-hildon, 
+ python2.5-gobject | python-gobject, gnome-python | python2.5-gnome,
+ python2.5-conic | python-conic
 Description: A character monitor for EVE Online.
  mEveMon allows you to monitor your EVE Online character from your N900 or N8x0.
 XSBC-Bugtracker: XSBC-Bugtracker: https://garage.maemo.org/tracker/?func=add&group_id=1544&atid=5565
index 2fdc4b1..c4e2404 100755 (executable)
@@ -25,6 +25,11 @@ import fetchimg
 import apicache
 import os.path
 
+#conic is used for connection handling
+import conic
+#import socket for handling socket exceptions
+import socket
+
 # we will store our preferences in gconf
 import gnome.gconf
 
@@ -49,6 +54,7 @@ class mEveMon():
         self.gconf = gnome.gconf.client_get_default()
         #NOTE: remove this after a few releases
         self.update_settings()
+        self.connect()
         self.cached_api = eveapi.EVEAPIConnection( cacheHandler = \
                 apicache.cache_handler(debug=False))
         self.gui = gui.mEveMonUI(self)
@@ -114,7 +120,7 @@ class mEveMon():
 
         try:
             auth = self.cached_api.auth(userID=uid, apiKey=api_key)
-        except eveapi.Error:
+        except: 
             return None
 
         return auth
@@ -126,7 +132,7 @@ class mEveMon():
         """
         try:
             sheet = self.get_auth(uid).character(char_id).CharacterSheet()
-        except eveapi.Error:
+        except:
             # TODO: we should really have a logger that logs this error somewhere
             return None
 
@@ -163,7 +169,7 @@ class mEveMon():
         try:
             chars = self.cached_api.eve.CharacterName(ids=char_id).characters
             name = chars[0].characterName
-        except eveapi.Error:
+        except:
             return None
 
         return name
@@ -179,7 +185,7 @@ class mEveMon():
             chars = self.cached_api.eve.CharacterID(names=name).characters
             char_id = chars[0].characterID
             char_name = chars[0].name
-        except eveapi.Error:
+        except:
             return None
 
         return char_id
@@ -195,7 +201,7 @@ class mEveMon():
             try:
                 api_char_list = auth.account.Characters()
                 char_list = [char.name for char in api_char_list.characters]
-            except eveapi.Error:
+            except:
                 return None
 
         return char_list
@@ -245,7 +251,7 @@ class mEveMon():
         """
         try:
             tree = self.cached_api.eve.SkillTree()
-        except eveapi.Error:
+        except:
             return None
         
         return tree
@@ -258,11 +264,21 @@ class mEveMon():
         """
         try:
             skill = self.get_auth(uid).character(char_id).SkillInTraining()
-        except eveapi.Error:
+        except:
             return None
 
         return skill
 
+    def connection_cb(self, connection, event, mgc):
+        pass    
+
+
+    def connect(self):
+        connection = conic.Connection()
+        #why 0xAA55?
+        connection.connect("connection-event", self.connection_cb, 0xAA55)
+        assert(connection.request_connection(conic.CONNECT_FLAG_NONE))
+
 
 if __name__ == "__main__":
     app = mEveMon()