Small todo about a way to handle the todo item list
[doneit] / src / gtk_rtmilk.py
index e92c0fb..54508e7 100644 (file)
@@ -47,13 +47,20 @@ 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 start_session(credentialsDialog):
+       # @todo Figure out storage of credentials
+       username, password = credentialsDialog.request_credentials()
+       token = get_token(username, rtmilk.RtMilkManager.API_KEY, rtmilk.RtMilkManager.SECRET)
+       return rtmilk.RtMilkManager(username, password, token)
+
+
 class GtkRtMilk(object):
 
        ID_IDX = 0
@@ -82,7 +89,7 @@ class GtkRtMilk(object):
 
                self._itemList = gtk.ListStore(
                        gobject.TYPE_STRING, # id
-                       gobject.TYPE_BOOLEAN,   # is complete
+                       gobject.TYPE_BOOLEAN, # is complete
                        gobject.TYPE_STRING, # name
                        gobject.TYPE_STRING, # priority
                        gobject.TYPE_STRING, # due
@@ -107,7 +114,7 @@ class GtkRtMilk(object):
                self._dueColumn = gtk.TreeViewColumn('Due')
                self._dueCell = gtk.CellRendererText()
                self._dueColumn.pack_start(self._nameCell, False)
-               self._dueColumn.set_attributes(self._nameCell, text=self.DUE_IDX)
+               self._dueColumn.set_attributes(self._nameCell, text=self.FUZZY_IDX)
                self._linkColumn = gtk.TreeViewColumn('') # Link
                self._linkCell = gtk.CellRendererText()
                self._linkColumn.pack_start(self._nameCell, False)
@@ -138,16 +145,11 @@ class GtkRtMilk(object):
        def name():
                return "Remember The Milk"
 
-       def start_session(self):
-               username, password = self._credentials.request_credentials()
-               token = get_token(username, rtmilk.RtMilkManager.API_KEY, rtmilk.RtMilkManager.SECRET)
-               return rtmilk.RtMilkManager(username, password, token)
-
        def enable(self):
                """
                @note UI Thread
                """
-               self._manager = self.start_session()
+               self._manager = start_session(self._credentials)
 
                self._projectsList.clear()
                self._populate_projects()
@@ -231,6 +233,7 @@ class GtkRtMilk(object):
                return currentProjectName
 
        def _populate_items(self):
+               # @todo Look 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):
@@ -262,6 +265,7 @@ class GtkRtMilk(object):
                self._reset_task_list()
 
        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
                taskId = self._itemList[path[0]][self.ID_IDX]
 
                if viewColumn is self._priorityColumn: