Exemple #1
0
 def getRecordDayList(self, date, sport=None):
     logging.debug('>>')
     logging.debug('Retrieving data for %s', date)
     date_range = DateRange.for_month_containing(date)
     for activity in self.pytrainer_main.activitypool.get_activities_period(
             date_range, sport=sport):
         yield activity.date.day
Exemple #2
0
 def refreshGraphView(self, view, sport=None):
     logging.debug('>>')
     if self.windowmain is None:
         logging.debug("First call to refreshGraphView")
         logging.debug('<<')
         return
     date_selected = self.date.getDate()
     if view == "record":
         logging.debug('record view')
         if self.windowmain.recordview.get_current_page() == 0:
             self.refreshRecordGraphView("info")
         elif self.windowmain.recordview.get_current_page() == 1:
             self.refreshRecordGraphView("graphs")
         elif self.windowmain.recordview.get_current_page() == 2:
             self.refreshRecordGraphView("map")
         elif self.windowmain.recordview.get_current_page() == 3:
             self.refreshRecordGraphView("heartrate")
         elif self.windowmain.recordview.get_current_page() == 4:
             self.refreshRecordGraphView("analytics")
     elif view == "day":
         logging.debug('day view')
         self.windowmain.actualize_dayview(date_selected)
     elif view == "week":
         logging.debug('week view')
         date_range = DateRange.for_week_containing(date_selected)
         self.windowmain.actualize_weekview(date_range)
     elif view == "month":
         logging.debug('month view')
         date_range = DateRange.for_month_containing(date_selected)
         nameMonth, daysInMonth = getNameMonth(date_selected)
         self.windowmain.actualize_monthview(date_range, nameMonth,
                                             daysInMonth)
     elif view == "year":
         logging.debug('year view')
         date_range = DateRange.for_year_containing(date_selected)
         self.windowmain.actualize_yearview(date_range, date_selected.year)
     elif view == "listview":
         logging.debug('list view')
         self.refreshListView()
     elif view == "athlete":
         logging.debug('athlete view')
         self.windowmain.on_athleteview_activate()
     elif view == "stats":
         logging.debug('stats view')
         self.windowmain.on_statsview_activate()
     else:
         logging.error("Unknown view %s", view)
     logging.debug('<<')
Exemple #3
0
 def refreshGraphView(self, view, sport=None):
     logging.debug('>>')
     if self.windowmain is None:
         logging.debug("First call to refreshGraphView")
         logging.debug('<<')
         return
     date_selected = self.date.getDate()
     if view=="record":
          logging.debug('record view')
          if self.windowmain.recordview.get_current_page()==0:
             self.refreshRecordGraphView("info")
          elif self.windowmain.recordview.get_current_page()==1:
             self.refreshRecordGraphView("graphs")
          elif self.windowmain.recordview.get_current_page()==2:
             self.refreshRecordGraphView("map")
          elif self.windowmain.recordview.get_current_page()==3:
             self.refreshRecordGraphView("heartrate")
          elif self.windowmain.recordview.get_current_page()==4:
             self.refreshRecordGraphView("analytics")
     elif view=="day":
          logging.debug('day view')
          self.windowmain.actualize_dayview(date_selected)
     elif view=="week":
          logging.debug('week view')
          date_range = DateRange.for_week_containing(date_selected)
          self.windowmain.actualize_weekview(date_range)
     elif view=="month":
          logging.debug('month view')
          date_range = DateRange.for_month_containing(date_selected)
          nameMonth, daysInMonth = getNameMonth(date_selected)
          self.windowmain.actualize_monthview(date_range, nameMonth, daysInMonth)
     elif view=="year":
          logging.debug('year view')
          date_range = DateRange.for_year_containing(date_selected)
          self.windowmain.actualize_yearview(date_range, date_selected.year)
     elif view=="listview":
         logging.debug('list view')
         self.refreshListView()
     elif view=="athlete":
         logging.debug('athlete view')
         self.windowmain.on_athleteview_activate()
     elif view=="stats":
         logging.debug('stats view')
         self.windowmain.on_statsview_activate()
     else:
         logging.error("Unknown view %s", view)
     logging.debug('<<')
Exemple #4
0
 def test_date_range_for_month_feb_should_end_feb_28(self):
     date_range = DateRange.for_month_containing(datetime.date(2011, 2, 11))
     self.assertEquals(datetime.date(2011, 2, 28), date_range.end_date)
Exemple #5
0
 def test_date_range_for_month_dec_should_end_dec_31(self):
     date_range = DateRange.for_month_containing(datetime.date(
         2011, 12, 11))
     self.assertEquals(datetime.date(2011, 12, 31), date_range.end_date)
Exemple #6
0
 def test_date_range_for_month_should_start_first_day_of_month(self):
     date_range = DateRange.for_month_containing(datetime.date(
         2011, 12, 11))
     self.assertEquals(datetime.date(2011, 12, 1), date_range.start_date)
Exemple #7
0
 def test_date_range_for_month_feb_should_end_feb_28(self):
     date_range = DateRange.for_month_containing(datetime.date(2011, 2, 11))
     self.assertEqual(datetime.date(2011, 2, 28), date_range.end_date)
Exemple #8
0
 def test_date_range_for_month_dec_should_end_dec_31(self):
     date_range = DateRange.for_month_containing(datetime.date(2011, 12, 11))
     self.assertEqual(datetime.date(2011, 12, 31), date_range.end_date)
Exemple #9
0
 def test_date_range_for_month_should_start_first_day_of_month(self):
     date_range = DateRange.for_month_containing(datetime.date(2011, 12, 11))
     self.assertEqual(datetime.date(2011, 12, 1), date_range.start_date)