More todo work
[doneit] / src / gtk_rtmilk.py
index bab46aa..693cc62 100644 (file)
@@ -48,15 +48,14 @@ def get_token(username, apiKey, secret):
 
        authURL = rtm.getAuthURL()
        webbrowser.open(authURL)
-       # mb = gtk_toolbox.MessageBox2("You need to authorize DoneIt with\nRemember The Milk.\nClick OK after you authorize.")
-       # mb.run()
+       mb = gtk_toolbox.MessageBox2("You need to authorize DoneIt with\nRemember The Milk.\nClick OK after you authorize.")
+       mb.run()
 
        token = rtm.getToken()
        return token
 
 
 def get_credentials(credentialsDialog):
-       # @todo Figure out storage of credentials
        username, password = credentialsDialog.request_credentials()
        token = get_token(username, rtmilk.RtMilkManager.API_KEY, rtmilk.RtMilkManager.SECRET)
        return username, password, token
@@ -88,6 +87,7 @@ class GtkRtMilk(object):
                self._projectsCombo = widgetTree.get_widget("projectsCombo")
                self._onListActivateId = 0
 
+               # @todo Need to figure out how to make the list sortable, especially with weird priority sorting
                self._itemList = gtk.ListStore(
                        gobject.TYPE_STRING, # id
                        gobject.TYPE_BOOLEAN, # is complete
@@ -151,20 +151,24 @@ class GtkRtMilk(object):
                """
                @note Thread Agnostic
                """
-               username = config.get(self.name(), "username")
-               password = None
-               blobbedToken = config.get(self.name(), "bin_blob")
-               token = base64.b64decode(blobbedToken)
-               self._credentials = username, password, token
+               blobs = (
+                       config.get(self.name(), "bin_blob_%i" % i)
+                       for i in xrange(len(self._credentials))
+               )
+               creds = (
+                       base64.b64decode(blob)
+                       for blob in blobs
+               )
+               self._credentials = tuple(creds)
 
        def save_settings(self, config):
                """
                @note Thread Agnostic
                """
                config.add_section(self.name())
-               config.set(self.name(), "username", self._credentials[0])
-               blobbedToken = base64.b64encode(self._credentials[2])
-               config.set(self.name(), "bin_blob", blobbedToken)
+               for i, value in enumerate(self._credentials):
+                       blob = base64.b64encode(value)
+                       config.set(self.name(), "bin_blob_%i" % i, blob)
 
        def login(self):
                """
@@ -276,7 +280,7 @@ class GtkRtMilk(object):
                return currentProjectName
 
        def _populate_items(self):
-               # @todo Look using a button for notes and links, and labels for all else
+               # @todo Look into using a button for notes and links, and labels for all else
                currentProject = self._get_project()
                projId = self._manager.lookup_project(currentProject)["id"]
                for taskDetails in self._manager.get_tasks_with_details(projId):
@@ -309,6 +313,7 @@ class GtkRtMilk(object):
 
        def _on_item_select(self, treeView, path, viewColumn):
                # @todo See if there is a way to get a right click / tap'n'hold for more task goodness
+               #       https://garage.maemo.org/plugins/wiki/index.php?TapAndHold&id=40&type=g
                taskId = self._itemList[path[0]][self.ID_IDX]
 
                if viewColumn is self._priorityColumn: