Trying to add an extra level of protection while trying to hunt down this incomplete...
authorEd Page <eopage@byu.net>
Sat, 25 Apr 2009 02:04:32 +0000 (21:04 -0500)
committerEd Page <eopage@byu.net>
Sat, 25 Apr 2009 02:04:32 +0000 (21:04 -0500)
src/doneit_glade.py
src/rtm_api.py

index a3aee2c..2ec55cf 100755 (executable)
@@ -46,6 +46,7 @@ class DoneIt(object):
        _user_settings = "%s/settings.ini" % _user_data
 
        def __init__(self):
+               self._initDone = False
                self._todoUIs = {}
                self._todoUI = None
                self._osso = None
@@ -159,6 +160,8 @@ class DoneIt(object):
                        self._widgetTree.get_widget("connectMenuItem").connect("activate", lambda *args: self.switch_ui(self._defaultUIName))
                        self._widgetTree.get_widget("preferencesMenuItem").connect("activate", self._on_prefs)
 
+               self._initDone = True
+
        def display_error_message(self, msg):
                """
                @note UI Thread
@@ -271,10 +274,12 @@ class DoneIt(object):
 
                if status == conic.STATUS_CONNECTED:
                        self._deviceIsOnline = True
-                       self.switch_ui(self._defaultUIName)
+                       if self._initDone:
+                               self.switch_ui(self._defaultUIName)
                elif status == conic.STATUS_DISCONNECTED:
                        self._deviceIsOnline = False
-                       self.switch_ui(self._fallbackUIName)
+                       if self._initDone:
+                               self.switch_ui(self._fallbackUIName)
 
        def _on_window_state_change(self, widget, event, *args):
                """
@@ -290,13 +295,11 @@ class DoneIt(object):
                        if self._osso is not None:
                                self._osso.close()
 
-                       self._save_settings()
+                       if self._initDone:
+                               self._save_settings()
                finally:
                        gtk.main_quit()
 
-       def _on_paste(self, *args):
-               pass
-
        def _on_key_press(self, widget, event, *args):
                """
                @note Hildon specific
@@ -308,10 +311,16 @@ class DoneIt(object):
                                self.__window.fullscreen()
 
        def _on_logout(self, *args):
+               if not self._initDone:
+                       return
+
                self._todoUI.logout()
                self.switch_ui(self._fallbackUIName)
 
        def _on_prefs(self, *args):
+               if not self._initDone:
+                       return
+
                self._prefsDialog.enable()
                try:
                        self._prefsDialog.run(self)
index 0097e34..b027d24 100644 (file)
@@ -3,6 +3,8 @@
 Python library for Remember The Milk API
 
 @note For help, see http://www.rememberthemilk.com/services/api/methods/
+
+@bug Under random situations, the response comes back incomplete.  Maybe a race condition, but how?
 """
 
 import weakref