Example #1
0
 def add_known_page(self, pageID, pageTitle):
     for id in self.known_pages:
         if id == pageID:
             return (id, self.known_pages[id]) #Return (id, title)
             nuclasses.log_info("found page with id %s" % id)
         else:
             pass
     nuclasses.log_info("Didn't find any previous page with id number %s" % pageID)
     self.known_pages[pageID] = pageTitle
Example #2
0
 def get_pages(self):
     ticket = self.get_ticket()
     pages_unformatted_xml = urllib.urlopen(self.ALL_PAGES_XML + "?ticket=%s&apikey=%s" % (ticket, self.API_KEY)).read()
     pages_xml = minidom.parseString(pages_unformatted_xml)
     nuclasses.log_info(pages_xml.toxml())
     list_of_page_details = pages_xml.firstChild.firstChild.firstChild.childNodes
     for each in list_of_page_details:
         current_page = each
         pageID = current_page.childNodes[0].firstChild.data
         pageTitle = current_page.childNodes[1].firstChild.data 
         if current_page.childNodes[2].firstChild.data == "true":
             self.current_home_page = pageID
         self.add_known_page(pageID, pageTitle)
     return self.known_pages
Example #3
0
 def calendar_day_selected(self, widget):
     theDate = self.calendarDateToString(widget)
     items = nuclasses.findItemsForDate(theDate)
     taskList = []
     eventList = []
     for item in items:
         nuclasses.log_info("Item.__class__.__name__ is: %s" % item.__class__.__name__)
         if item.__class__.__name__ == "task":
             taskList.append(item)
         elif item.__class__.__name__ == "event":
             eventList.append(item)
         else:
             pass
     self.treeview.set_model(self.__create_model_tasks(taskList))
     self.treeview_both.set_model(self.__create_model_both(taskList, eventList))
     nuclasses.log_info("Here is the taskList, eventList: %s %s" % (taskList, eventList))
Example #4
0
 def get_lists_on_page(self, pageID):
     ticket = self.get_ticket()
     lists_unformatted_xml = urllib.urlopen(self.ALL_LISTS_XML + "?ticket=%s&apikey=%s&pageId=%s" % (ticket, self.API_KEY, pageID)).read()
     lists_xml = minidom.parseString(lists_unformatted_xml)
     nuclasses.log_info(lists_xml.toxml())
     lists_details = lists_xml.firstChild.firstChild.firstChild.lastChild.childNodes
     lists_on_page = []
     for each in lists_details:
         listID = each.firstChild.firstChild.data
         listName = each.childNodes[1].firstChild.data
         try:
             items = []
             unit = each.childNodes[2]
             while unit.nextSibling != None:
                 items.append(unit)
                 unit = unit.nextSibling
         except IndexError:
             nuclasses.log_info("List '%s' has no subItems." % listName)
             items = []
         lists_on_page.append([listID, listName, items])
     return lists_on_page
Example #5
0
 def calendarDateToDateTime(self, calendar):
     year, month, day = calendar.get_date()
     nuclasses.log_info("Here is the year, month, day: %s %s %s" % (year, month, day))
     theTime = datetime.datetime(year, month+1, day)
     return theTime