You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
|
Feb
(1) |
Mar
(15) |
Apr
(20) |
May
(2) |
Jun
(9) |
Jul
(3) |
Aug
(2) |
Sep
(17) |
Oct
(16) |
Nov
(38) |
Dec
(40) |
2010 |
Jan
(51) |
Feb
(11) |
Mar
(24) |
Apr
(31) |
May
(24) |
Jun
(3) |
Jul
(9) |
Aug
(1) |
Sep
(29) |
Oct
(33) |
Nov
(81) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(4) |
Mar
(13) |
Apr
(4) |
May
(24) |
Jun
(4) |
Jul
(19) |
Aug
(46) |
Sep
(10) |
Oct
(28) |
Nov
(31) |
Dec
|
From: <dg...@us...> - 2009-12-01 21:17:02
|
Revision: 418 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=418&view=rev Author: dgranda Date: 2009-12-01 21:16:51 +0000 (Tue, 01 Dec 2009) Log Message: ----------- Initial changelog submission for 1.7.0 version Modified Paths: -------------- pytrainer/trunk/CHANGES Modified: pytrainer/trunk/CHANGES =================================================================== --- pytrainer/trunk/CHANGES 2009-12-01 09:56:12 UTC (rev 417) +++ pytrainer/trunk/CHANGES 2009-12-01 21:16:51 UTC (rev 418) @@ -1,3 +1,20 @@ +- PyTrainer changes for 1.7.0: + +Modified on_sportlist_changed event to improve performance (svn rev 409) +Fix for minor bug in translation scripts (svn rev 402) +Fix for bug #2811470 - clickable link for further details on MET (links to wikipedia) (svn rev 391) +Fix for bug #2089342 auto refresh after import, edit and delete of records (svn rev 390) +Refactoring database and config file sanity checks (triggered with --check) (svn rev 389,392,396,401) +Added weekly view (svn rev 388,393,394,395,398,403-410) +Fix for multiple graphs view (svn rev 386,387) +Better error handling preventing pytrainer to crash (svn rev 364,369) +Support for plugin validation (svn rev 361,363,371) +Import TCXv2 files (svn rev 351,355,356) +Improving import from TCXv1 format (svn rev 354,371,375,376) +Several improvements in plugins handling (svn rev 350,353,360,378) +Import GPX files (svn rev 349) + + - PyTrainer tasks for 1.6.0.9: Added dynamic loading and unloading of plugin menu items (svn rev 344) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-12-01 09:56:21
|
Revision: 417 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=417&view=rev Author: jblance Date: 2009-12-01 09:56:12 +0000 (Tue, 01 Dec 2009) Log Message: ----------- Some interim lap progress Modified Paths: -------------- pytrainer/trunk/pytrainer/extensions/googlemaps.py pytrainer/trunk/pytrainer/lib/gpx.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/extensions/googlemaps.py =================================================================== --- pytrainer/trunk/pytrainer/extensions/googlemaps.py 2009-12-01 09:41:27 UTC (rev 416) +++ pytrainer/trunk/pytrainer/extensions/googlemaps.py 2009-12-01 09:56:12 UTC (rev 417) @@ -189,9 +189,9 @@ });\n''' for lap in laps: - lapNumber = laps.index(lap) + lapNumber = laps.index(lap)+1 content += "var lap%dmarker = new google.maps.Marker({position: new google.maps.LatLng(%f, %f), icon: lapimage, map: map, title:\"Lap%d\"}); \n " % (lapNumber, float(lap[1]), float(lap[2]), lapNumber) - content += "var lap%d = new google.maps.InfoWindow({content: \"End of lap:%s<br>Elapsed time:%s\" });\n" % (lapNumber, lapNumber+1, lap[0]) + content += "var lap%d = new google.maps.InfoWindow({content: \"End of lap:%s<br>Elapsed time:%s\" });\n" % (lapNumber, lapNumber, lap[0]) content += "google.maps.event.addListener(lap%dmarker, 'click', function() { lap%d.open(map,lap%dmarker); });\n" % (lapNumber,lapNumber,lapNumber) content += ''' Modified: pytrainer/trunk/pytrainer/lib/gpx.py =================================================================== --- pytrainer/trunk/pytrainer/lib/gpx.py 2009-12-01 09:41:27 UTC (rev 416) +++ pytrainer/trunk/pytrainer/lib/gpx.py 2009-12-01 09:56:12 UTC (rev 417) @@ -126,7 +126,7 @@ temp = trkpt.findtext(timeTag) time = datetime.strptime(temp, "%Y-%m-%dT%H:%M:%SZ") elapsedTime = time - startTime - print "Found time: %s, lat: %s lon: %s" % (elapsedTime, lat, lon) + #print "Found time: %s, lat: %s lon: %s" % (elapsedTime, lat, lon) lapInfo.append((elapsedTime, lat, lon)) return lapInfo Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-12-01 09:41:27 UTC (rev 416) +++ pytrainer/trunk/pytrainer/main.py 2009-12-01 09:56:12 UTC (rev 417) @@ -97,7 +97,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#416" + self.version ="1.6.0.9_svn#417" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-12-01 09:41:34
|
Revision: 416 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=416&view=rev Author: jblance Date: 2009-12-01 09:41:27 +0000 (Tue, 01 Dec 2009) Log Message: ----------- Some interim lap progress Modified Paths: -------------- pytrainer/trunk/pytrainer/extensions/googlemaps.py pytrainer/trunk/pytrainer/lib/gpx.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/extensions/googlemaps.py =================================================================== --- pytrainer/trunk/pytrainer/extensions/googlemaps.py 2009-11-30 10:02:45 UTC (rev 415) +++ pytrainer/trunk/pytrainer/extensions/googlemaps.py 2009-12-01 09:41:27 UTC (rev 416) @@ -81,6 +81,7 @@ points = points.replace("\\","\\\\") if self.useGM3: logging.debug("Using Google Maps version 3 API") + laps = gpx.getLaps() # [](elapsedTime, lat, lon) #"sports.name,date,distance,time,beats,comments,average,calories,id_record,title,upositive,unegative,maxspeed,maxpace,pace,maxbeats" info = self.record.getrecordInfo(id_record) timeHours = int(info[0][3]) / 3600 @@ -88,7 +89,7 @@ time = "%d%s %02d%s" % (timeHours, _("h"), timeMin, _("min")) startinfo = "<div id='info_content'>%s: %s</div>" % (info[0][0], info[0][9]) finishinfo = "<div id='info_content'>%s: %s<br>%s: %s%s</div>" % (_("Time"), time, _("Distance"), info[0][2], _("km")) - self.createHtml_api3(polyline, minlat, minlon, maxlat, maxlon, startinfo, finishinfo) + self.createHtml_api3(polyline, minlat, minlon, maxlat, maxlon, startinfo, finishinfo, laps) else: logging.debug("Using Google Maps version 2 API") self.createHtml(points,levels,pointlist[0]) @@ -99,7 +100,7 @@ self.moz.load_url("file://%s" % (self.htmlfile)) logging.debug("<<") - def createHtml_api3(self,polyline, minlat, minlon, maxlat, maxlon, startinfo, finishinfo): + def createHtml_api3(self,polyline, minlat, minlon, maxlat, maxlon, startinfo, finishinfo, laps): ''' Generate a Google maps html file using the v3 api documentation at http://code.google.com/apis/maps/documentation/v3 @@ -125,6 +126,7 @@ content += " var finishcontent = \"%s\";\n" % (finishinfo) content += " var startimageloc = \"%s/glade/start.png\";\n" % (os.path.abspath(self.data_path)) content += " var finishimageloc = \"%s/glade/finish.png\";\n" % (os.path.abspath(self.data_path)) + content += " var lapimageloc = \"%s/glade/waypoint.png\";\n" % (os.path.abspath(self.data_path)) content +=''' var myOptions = { zoom: 8, @@ -148,6 +150,14 @@ // The anchor for this image is the base of the flagpole new google.maps.Point(16, 32));\n + var lapimage = new google.maps.MarkerImage(lapimageloc,\n + // This marker is 32 pixels wide by 32 pixels tall. + new google.maps.Size(32, 32), + // The origin for this image is 0,0. + new google.maps.Point(0,0), + // The anchor for this image is the base of the flagpole + new google.maps.Point(16, 32));\n + var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var startmarker = new google.maps.Marker({ position: startlatlng, @@ -176,8 +186,16 @@ google.maps.event.addListener(finishmarker, 'click', function() { finishinfo.open(map,finishmarker); - }); + });\n''' + for lap in laps: + lapNumber = laps.index(lap) + content += "var lap%dmarker = new google.maps.Marker({position: new google.maps.LatLng(%f, %f), icon: lapimage, map: map, title:\"Lap%d\"}); \n " % (lapNumber, float(lap[1]), float(lap[2]), lapNumber) + content += "var lap%d = new google.maps.InfoWindow({content: \"End of lap:%s<br>Elapsed time:%s\" });\n" % (lapNumber, lapNumber+1, lap[0]) + content += "google.maps.event.addListener(lap%dmarker, 'click', function() { lap%d.open(map,lap%dmarker); });\n" % (lapNumber,lapNumber,lapNumber) + + content += ''' + var boundsBox = new google.maps.LatLngBounds(swlatlng, nelatlng );\n map.fitBounds(boundsBox);\n var polylineCoordinates = [\n''' Modified: pytrainer/trunk/pytrainer/lib/gpx.py =================================================================== --- pytrainer/trunk/pytrainer/lib/gpx.py 2009-11-30 10:02:45 UTC (rev 415) +++ pytrainer/trunk/pytrainer/lib/gpx.py 2009-12-01 09:41:27 UTC (rev 416) @@ -24,6 +24,7 @@ from system import checkConf import time +from datetime import datetime import logging from xmlUtils import XMLParser #import xml.dom @@ -37,6 +38,8 @@ timeTag = mainNS.substitute(tag="time") trackTag = mainNS.substitute(tag="trk") trackPointTag = mainNS.substitute(tag="trkpt") +trackPointTagLast = mainNS.substitute(tag="trkpt[last()]") +trackSegTag = mainNS.substitute(tag="trkseg") elevationTag = mainNS.substitute(tag="ele") nameTag = mainNS.substitute(tag="name") @@ -107,6 +110,25 @@ def getCalories(self): return self.calories + + def getLaps(self): + logging.debug(">>") + lapInfo = [] + tree = self.tree + date = tree.findtext(timeTag) + startTime = datetime.strptime(date, "%Y-%m-%dT%H:%M:%SZ") + trksegs = tree.findall(trackSegTag) + for trkseg in trksegs: + trkpts = trkseg.findall(trackPointTag) + trkpt = trkpts[-1] + lat = trkpt.get("lat") + lon = trkpt.get("lon") + temp = trkpt.findtext(timeTag) + time = datetime.strptime(temp, "%Y-%m-%dT%H:%M:%SZ") + elapsedTime = time - startTime + print "Found time: %s, lat: %s lon: %s" % (elapsedTime, lat, lon) + lapInfo.append((elapsedTime, lat, lon)) + return lapInfo def _getValues(self): ''' Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-30 10:02:45 UTC (rev 415) +++ pytrainer/trunk/pytrainer/main.py 2009-12-01 09:41:27 UTC (rev 416) @@ -97,7 +97,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#415" + self.version ="1.6.0.9_svn#416" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-30 10:02:55
|
Revision: 415 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=415&view=rev Author: jblance Date: 2009-11-30 10:02:45 +0000 (Mon, 30 Nov 2009) Log Message: ----------- Added info windows to Google Maps version 3 api code Modified Paths: -------------- pytrainer/trunk/pytrainer/extensions/googlemaps.py pytrainer/trunk/pytrainer/lib/date.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/extensions/googlemaps.py =================================================================== --- pytrainer/trunk/pytrainer/extensions/googlemaps.py 2009-11-30 06:58:09 UTC (rev 414) +++ pytrainer/trunk/pytrainer/extensions/googlemaps.py 2009-11-30 10:02:45 UTC (rev 415) @@ -25,6 +25,7 @@ from pytrainer.lib.gpx import Gpx import pytrainer.lib.points as Points from pytrainer.lib.fileUtils import fileUtils +from pytrainer.record import Record class Googlemaps: def __init__(self, data_path = None, vbox = None, waypoint = None, useGM3 = False): @@ -38,6 +39,7 @@ self.htmlfile = "%s/index.html" % (self.conf.getValue("tmpdir")) self.waypoint=waypoint self.useGM3 = useGM3 + self.record = Record() logging.debug("<<") def drawMap(self,id_record): @@ -79,8 +81,13 @@ points = points.replace("\\","\\\\") if self.useGM3: logging.debug("Using Google Maps version 3 API") - startinfo = "Start<br>TODO: Put ??? info here" - finishinfo = "End<br>TODO: Put summary info here?" + #"sports.name,date,distance,time,beats,comments,average,calories,id_record,title,upositive,unegative,maxspeed,maxpace,pace,maxbeats" + info = self.record.getrecordInfo(id_record) + timeHours = int(info[0][3]) / 3600 + timeMin = (float(info[0][3]) / 3600.0 - timeHours) * 60 + time = "%d%s %02d%s" % (timeHours, _("h"), timeMin, _("min")) + startinfo = "<div id='info_content'>%s: %s</div>" % (info[0][0], info[0][9]) + finishinfo = "<div id='info_content'>%s: %s<br>%s: %s%s</div>" % (_("Time"), time, _("Distance"), info[0][2], _("km")) self.createHtml_api3(polyline, minlat, minlon, maxlat, maxlon, startinfo, finishinfo) else: logging.debug("Using Google Maps version 2 API") Modified: pytrainer/trunk/pytrainer/lib/date.py =================================================================== --- pytrainer/trunk/pytrainer/lib/date.py 2009-11-30 06:58:09 UTC (rev 414) +++ pytrainer/trunk/pytrainer/lib/date.py 2009-11-30 10:02:45 UTC (rev 415) @@ -59,7 +59,7 @@ Problems as python date functions do not respect locale (i.e. Sunday is always start of week????) Note: %w gives weekday as a decimal number [0(Sunday),6(Saturday)]. ''' - if prf_us_system == "True": + if prf_us_system: #Sunday is first day of week weekDate = datetime.datetime.strptime(date, "%Y-%m-%d") dayOfWeek = int(weekDate.strftime("%w")) Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-30 06:58:09 UTC (rev 414) +++ pytrainer/trunk/pytrainer/main.py 2009-11-30 10:02:45 UTC (rev 415) @@ -50,7 +50,6 @@ #from gui.windowextensions import WindowExtensions from gui.windowmain import Main from gui.warning import Warning -from lib.system import checkConf from lib.date import Date from lib.gpx import Gpx from lib.soapUtils import webService @@ -98,7 +97,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#414" + self.version ="1.6.0.9_svn#415" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? @@ -119,7 +118,10 @@ self.filename = self.conf.getValue("conffile") logging.debug('retrieving data from '+ self.filename) self.configuration = XMLParser(self.filename) - self.prf_us_system = self.configuration.getValue("pytraining","prf_us_system") + if self.configuration.getValue("pytraining","prf_us_system") == "True": + self.prf_us_system = True + else: + self.prf_us_system = False self.ddbb = DDBB(self.configuration) logging.debug('connecting to DDBB') self.ddbb.connect() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-30 06:58:15
|
Revision: 414 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=414&view=rev Author: jblance Date: 2009-11-30 06:58:09 +0000 (Mon, 30 Nov 2009) Log Message: ----------- Fix error in gpx.py Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/gpx.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/lib/gpx.py =================================================================== --- pytrainer/trunk/pytrainer/lib/gpx.py 2009-11-30 06:53:27 UTC (rev 413) +++ pytrainer/trunk/pytrainer/lib/gpx.py 2009-11-30 06:58:09 UTC (rev 414) @@ -236,12 +236,12 @@ returns: string with start time - 2008-03-22T12:17:43Z""" logging.debug(">>") date_time = self.tree.find(timeTag) #returns first instance found - logging.debug(gpxFile+" | "+ date_time) if date_time is None: print "Problems when retrieving start time from "+gpxFile+". Please check data integrity" - date_time=0 + return 0 + logging.debug(gpxFile+" | "+ date_time.text) logging.debug("<<") - return date_time + return date_time.text #TODO Pending removal ''' Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-30 06:53:27 UTC (rev 413) +++ pytrainer/trunk/pytrainer/main.py 2009-11-30 06:58:09 UTC (rev 414) @@ -98,7 +98,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#413" + self.version ="1.6.0.9_svn#414" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-30 06:53:37
|
Revision: 413 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=413&view=rev Author: jblance Date: 2009-11-30 06:53:27 +0000 (Mon, 30 Nov 2009) Log Message: ----------- Fix error in gpx.py Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/gpx.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/lib/gpx.py =================================================================== --- pytrainer/trunk/pytrainer/lib/gpx.py 2009-11-30 06:24:35 UTC (rev 412) +++ pytrainer/trunk/pytrainer/lib/gpx.py 2009-11-30 06:53:27 UTC (rev 413) @@ -76,7 +76,7 @@ return self.date def getTrackRoutes(self): - trks = tree.findall(trackTag) + trks = self.tree.findall(trackTag) tracks = [] retorno = [] for trk in trks: @@ -235,7 +235,7 @@ - gpxFile: path to xml file (gpx format) returns: string with start time - 2008-03-22T12:17:43Z""" logging.debug(">>") - date_time = tree.find(timeTag) #returns first instance found + date_time = self.tree.find(timeTag) #returns first instance found logging.debug(gpxFile+" | "+ date_time) if date_time is None: print "Problems when retrieving start time from "+gpxFile+". Please check data integrity" Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-30 06:24:35 UTC (rev 412) +++ pytrainer/trunk/pytrainer/main.py 2009-11-30 06:53:27 UTC (rev 413) @@ -98,7 +98,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#412" + self.version ="1.6.0.9_svn#413" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-30 06:24:45
|
Revision: 412 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=412&view=rev Author: jblance Date: 2009-11-30 06:24:35 +0000 (Mon, 30 Nov 2009) Log Message: ----------- Migrate gpx.py to lxml Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/gpx.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/lib/gpx.py =================================================================== --- pytrainer/trunk/pytrainer/lib/gpx.py 2009-11-29 09:52:42 UTC (rev 411) +++ pytrainer/trunk/pytrainer/lib/gpx.py 2009-11-30 06:24:35 UTC (rev 412) @@ -26,21 +26,23 @@ import time import logging from xmlUtils import XMLParser -import xml.dom -from xml.dom import minidom, Node, getDOMImplementation -import xml.etree.cElementTree -from gtrnctr2gpx import gtrnctr2gpx # copied to pytrainer/lib/ directory +#import xml.dom +#from xml.dom import minidom, Node, getDOMImplementation +#import xml.etree.cElementTree +from lxml import etree +#from gtrnctr2gpx import gtrnctr2gpx # copied to pytrainer/lib/ directory # use of namespaces is mandatory if defined -mainNS = string.Template("{http://www.topografix.com/GPX/1/1}$tag") +mainNS = string.Template(".//{http://www.topografix.com/GPX/1/1}$tag") timeTag = mainNS.substitute(tag="time") trackTag = mainNS.substitute(tag="trk") trackPointTag = mainNS.substitute(tag="trkpt") +elevationTag = mainNS.substitute(tag="ele") +nameTag = mainNS.substitute(tag="name") -mainNSGpX = string.Template("{http://www.topografix.com/GPX/1/1}$tag") -trackTag = mainNSGpX.substitute(tag="trk") -trackPointTag = mainNSGpX.substitute(tag="trkpt") -timeTag = mainNSGpX.substitute(tag="time") +gpxdataNS = string.Template(".//{http://www.cluetrust.com/XML/GPXDATA/1/0}$tag") +calorieTag = gpxdataNS.substitute(tag="calories") +hrTag = gpxdataNS.substitute(tag="hr") class Gpx: def __init__(self, data_path = None, filename = None, trkname = None): @@ -62,7 +64,7 @@ if not os.path.isfile(self.filename): return None logging.debug("parsing content from "+self.filename) - self.dom = xml.dom.minidom.parse(self.filename) + self.tree = etree.ElementTree(file=filename).getroot() logging.debug("getting values...") self.Values = self._getValues() logging.debug("<<") @@ -74,16 +76,18 @@ return self.date def getTrackRoutes(self): - trks = self.dom.getElementsByTagName("trk") + trks = tree.findall(trackTag) tracks = [] retorno = [] for trk in trks: - if len(trk.getElementsByTagName("name")) > 0: - name = trk.getElementsByTagName("name")[0].firstChild.data + nameResult = trk.find(nameTag) + if nameResult is not None: + name = nameResult.text else: name = _("No Name") - if len(trk.getElementsByTagName("time")) > 0: - time_ = trk.getElementsByTagName("time")[0].firstChild.data # check timezone + timeResult = trk.find(timeTag) + if timeResult is not None: + time_ = timeResult.text # check timezone mk_time = time.strptime(time_, "%Y-%m-%dT%H:%M:%SZ") time_ = time.strftime("%Y-%m-%d", mk_time) else: @@ -103,17 +107,21 @@ def getCalories(self): return self.calories - - def _getValues(self): # migrate to cElementTree + + def _getValues(self): + ''' + Migrated to eTree XML processing 26 Nov 2009 - jblance + ''' + logging.debug(">>") - dom = self.dom + tree = self.tree - trkpoints = dom.getElementsByTagName("trkpt") + trkpoints = tree.findall(trackPointTag) #start with the info at trkseg level #calories - maybe more than one, currently adding them together - calorieCollection = dom.getElementsByTagName("gpxdata:calories") + calorieCollection = tree.findall(calorieTag) for cal in calorieCollection: - self.calories += int(cal.firstChild.data) + self.calories += int(cal.text) retorno = [] his_vel = [] last_lat = "False" @@ -127,37 +135,39 @@ if not len(trkpoints): return retorno - date_ = trkpoints[0].getElementsByTagName("time")[0].firstChild.data + date_ = tree.find(timeTag).text mk_time = time.strptime(date_, "%Y-%m-%dT%H:%M:%SZ") self.date = time.strftime("%Y-%m-%d", mk_time) for trkpoint in trkpoints: - lat = trkpoint.attributes["lat"].value - lon = trkpoint.attributes["lon"].value + lat = trkpoint.get("lat") + lon = trkpoint.get("lon") #get the heart rate value from the gpx extended format file - if len(trkpoint.getElementsByTagName("gpxdata:hr")) > 0: - hr = int(trkpoint.getElementsByTagName("gpxdata:hr")[0].firstChild.data) + hrResult = trkpoint.find(hrTag) + if hrResult is not None: + hr = int(hrResult.text) len_validhrpoints += 1 else: hr = 0 - if len(trkpoint.getElementsByTagName("time")) > 0: - time_ = trkpoint.getElementsByTagName("time")[0].firstChild.data + timeResult = trkpoint.find(timeTag) + if timeResult is not None: + time_ = timeResult.text mk_time = time.strptime(time_, "%Y-%m-%dT%H:%M:%SZ") time_ = time.mktime(mk_time) else: time_ = 1 - ele = trkpoint.getElementsByTagName("ele")[0].firstChild.data - #chequeamos que la altura sea correcta + ele = trkpoint.find(elevationTag).text + #chequeamos que la altura sea correcta / check that the height is correct if len(ele)<15: tmp_alt = int(float(ele)) - #evitamos los puntos blancos + #evitamos los puntos blancos / we avoid the white points if (float(lat) < -0.000001) or (float(lat) > 0.0000001): tmp_lat = float(lat)*0.01745329252 tmp_lon = float(lon)*0.01745329252 tmp_time = int(time_) - #Para las vueltas diferentes a la primera + #Para las vueltas diferentes a la primera / For the returns different from first if last_lat != "False": time_ = tmp_time - last_time if time_>0: @@ -175,16 +185,16 @@ total_hr += hr if hr>self.maxhr: self.maxhr = hr - #dividimos kilometros por hora (no por segundo) + #dividimos kilometros por hora (no por segundo) / Calculate kilometers per hour (not including seconds) tmp_vel = dist/((time_)/3600.0) - vel,his_vel = self._calculate_velocity(tmp_vel,his_vel) - #si la velocidad es menor de 90 lo damos por bueno + vel,his_vel = self._calculate_velocity(tmp_vel,his_vel, 3) + #si la velocidad es menor de 90 lo damos por bueno / if speed is greater than 90 or time greater than 100 we exclude the result if vel<90 and time_ <100: if vel>self.maxvel: self.maxvel=vel self.total_time += time_ - retorno.append((total_dist,tmp_alt, self.total_time,vel,lat,lon,hr)) - rel_alt = tmp_alt - last_alt + retorno.append((total_dist,tmp_alt, self.total_time,vel,lat,lon,hr)) #Could add rpm here + rel_alt = tmp_alt - last_alt #Could allow for some 'jitter' in height here if rel_alt > 0: self.upositive += rel_alt elif rel_alt < 0: @@ -202,47 +212,39 @@ logging.debug("<<") return retorno - def _calculate_velocity(self,velocity, arr_velocity): - #logging.debug(">>") + def _calculate_velocity(self,velocity, arr_velocity, numToAverage): #TODO Check & make generic + '''Function to calculate moving average for speed''' arr_velocity.append(velocity) - if len(arr_velocity)>3: + if len(arr_velocity)>numToAverage: arr_velocity.pop(0) - if len(arr_velocity)<3: - vel=0 - else: - vel = (arr_velocity[0]+arr_velocity[1]+arr_velocity[2])/3 - #logging.debug("<<") + if len(arr_velocity)<numToAverage: + #Got too few numbers to average + #Pad with duplicates + for x in range(len(arr_velocity), numToAverage): + arr_velocity.append(velocity) + vel = 0 + for v in arr_velocity: + vel+= v + vel /= numToAverage return vel,arr_velocity - """ - def getStartTimeFromGPX(self, gpxFile): - 25.03.2008 - dgranda - Retrieves start time from a given gpx file - args: - - gpxFile: path to xml file (gpx format) - returns: string with start time - 2008-03-22T12:17:43Z - logging.debug("--") - xmldoc = xml.dom.minidom.parse(gpxFile) - times = xmldoc.getElementsByTagName("time") - return times[0].firstChild.data - """ def getStartTimeFromGPX(self, gpxFile): """03.05.2008 - dgranda - Retrieves start time from a given gpx file (cElementTree version) + Retrieves start time from a given gpx file args: - gpxFile: path to xml file (gpx format) returns: string with start time - 2008-03-22T12:17:43Z""" logging.debug(">>") - try: - tree = xml.etree.cElementTree.parse(gpxFile) - date_time = tree.getroot().findtext(".//"+timeTag) #returns first instance found - logging.debug(gpxFile+" | "+ date_time) - except Exception: + date_time = tree.find(timeTag) #returns first instance found + logging.debug(gpxFile+" | "+ date_time) + if date_time is None: print "Problems when retrieving start time from "+gpxFile+". Please check data integrity" date_time=0 logging.debug("<<") return date_time + #TODO Pending removal + ''' def retrieveDataFromGTRNCTR(self, gtrnctrFile, entry): """23.03.2008 - dgranda Builds a new GPX file based on one entry from GPS (dates matching) @@ -256,4 +258,4 @@ newGPXEntry = self.conf.tmpdir + "/new_entry.gpx" gtrnctr2gpx(selectedEntry, newGPXEntry) logging.debug('<<') - return newGPXEntry + return newGPXEntry ''' Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-29 09:52:42 UTC (rev 411) +++ pytrainer/trunk/pytrainer/main.py 2009-11-30 06:24:35 UTC (rev 412) @@ -98,7 +98,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#411" + self.version ="1.6.0.9_svn#412" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-29 09:52:51
|
Revision: 411 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=411&view=rev Author: jblance Date: 2009-11-29 09:52:42 +0000 (Sun, 29 Nov 2009) Log Message: ----------- Start of rework for Google Map rendering - experimental so far, test with --gmaps3 at startup Modified Paths: -------------- pytrainer/trunk/pytrainer/extensions/googlemaps.py pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/main.py Added Paths: ----------- pytrainer/trunk/glade/finish.png pytrainer/trunk/glade/start.png Added: pytrainer/trunk/glade/finish.png =================================================================== (Binary files differ) Property changes on: pytrainer/trunk/glade/finish.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: pytrainer/trunk/glade/start.png =================================================================== (Binary files differ) Property changes on: pytrainer/trunk/glade/start.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: pytrainer/trunk/pytrainer/extensions/googlemaps.py =================================================================== --- pytrainer/trunk/pytrainer/extensions/googlemaps.py 2009-11-29 01:30:31 UTC (rev 410) +++ pytrainer/trunk/pytrainer/extensions/googlemaps.py 2009-11-29 09:52:42 UTC (rev 411) @@ -27,7 +27,7 @@ from pytrainer.lib.fileUtils import fileUtils class Googlemaps: - def __init__(self, data_path = None, vbox = None, waypoint = None): + def __init__(self, data_path = None, vbox = None, waypoint = None, useGM3 = False): logging.debug(">>") self.data_path = data_path self.conf = checkConf() @@ -35,11 +35,18 @@ self.moz = gtkmozembed.MozEmbed() vbox.pack_start(self.moz, True, True) vbox.show_all() - self.htmlfile = "" + self.htmlfile = "%s/index.html" % (self.conf.getValue("tmpdir")) self.waypoint=waypoint + self.useGM3 = useGM3 logging.debug("<<") def drawMap(self,id_record): + '''Draw google map + create html file using Google API version?? + render using embedded Mozilla + + info at http://www.pygtk.org/pygtkmozembed/class-gtkmozembed.html + ''' logging.debug(">>") code = "googlemapsviewer" extensiondir = self.conf.getValue("extensiondir")+"/"+code @@ -48,30 +55,151 @@ points = [] levels = [] pointlist = [] - htmlfile = self.conf.getValue("tmpdir")+"/index.html" - gpxfile = self.conf.getValue("gpxdir")+"/%s.gpx" %id_record + polyline = [] + + gpxfile = "%s/%s.gpx" % (self.conf.getValue("gpxdir"), id_record) if os.path.isfile(gpxfile): gpx = Gpx(self.data_path,gpxfile) list_values = gpx.getTrackList() - for i in list_values: - pointlist.append((i[4],i[5])) - points,levels = Points.encodePoints(pointlist) - points = points.replace("\\","\\\\") - - self.createHtml(points,levels,pointlist[0]) - htmlfile = os.path.abspath(htmlfile) - logging.debug("HTML file created: "+htmlfile) - if htmlfile != self.htmlfile: - self.moz.load_url("file://"+htmlfile) + if len(list_values) > 0: + minlat, minlon = float(list_values[0][4]),float(list_values[0][5]) + maxlat=minlat + maxlon=minlon + for i in list_values: + lat, lon = float(i[4]), float(i[5]) + minlat = min(minlat, lat) + maxlat = max(maxlat, lat) + minlon = min(minlon, lon) + maxlon = max(maxlon, lon) + pointlist.append((lat,lon)) + polyline.append("new google.maps.LatLng(%s, %s)" % (lat, lon)) + logging.debug("minlat: %s, maxlat: %s" % (minlat, maxlat)) + logging.debug("minlon: %s, maxlon: %s" % (minlon, maxlon)) + points,levels = Points.encodePoints(pointlist) + points = points.replace("\\","\\\\") + if self.useGM3: + logging.debug("Using Google Maps version 3 API") + startinfo = "Start<br>TODO: Put ??? info here" + finishinfo = "End<br>TODO: Put summary info here?" + self.createHtml_api3(polyline, minlat, minlon, maxlat, maxlon, startinfo, finishinfo) + else: + logging.debug("Using Google Maps version 2 API") + self.createHtml(points,levels,pointlist[0]) + else: + self.createErrorHtml() else: self.createErrorHtml() - self.moz.load_url("file://"+htmlfile) + self.moz.load_url("file://%s" % (self.htmlfile)) logging.debug("<<") + def createHtml_api3(self,polyline, minlat, minlon, maxlat, maxlon, startinfo, finishinfo): + ''' + Generate a Google maps html file using the v3 api + documentation at http://code.google.com/apis/maps/documentation/v3 + ''' + logging.debug(">>") + waypoints = self.waypoint.getAllWaypoints() + #TODO waypoints not supported in this function yet + #TODO sort polyline encoding (not supported in v3?) + #TODO check http://code.google.com/apis/maps/documentation/v3/overlays.html#Polylines for MVArray?? + content = ''' + <html> + <head> + <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> + <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> + <script type="text/javascript"> + function initialize() {\n''' + content += " var startlatlng = %s ;\n" % (polyline[0]) + content += " var centerlatlng = new google.maps.LatLng(%f, %f);\n" % ((minlat+maxlat)/2., (minlon+maxlon)/2.) + content += " var endlatlng = %s;\n" % (polyline[-1]) + content += " var swlatlng = new google.maps.LatLng(%f, %f);\n" % (minlat,minlon) + content += " var nelatlng = new google.maps.LatLng(%f, %f);\n" % (maxlat,maxlon) + content += " var startcontent = \"%s\";\n" % (startinfo) + content += " var finishcontent = \"%s\";\n" % (finishinfo) + content += " var startimageloc = \"%s/glade/start.png\";\n" % (os.path.abspath(self.data_path)) + content += " var finishimageloc = \"%s/glade/finish.png\";\n" % (os.path.abspath(self.data_path)) + content +=''' + var myOptions = { + zoom: 8, + center: centerlatlng, + scaleControl: true, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + + var startimage = new google.maps.MarkerImage(startimageloc,\n + // This marker is 32 pixels wide by 32 pixels tall. + new google.maps.Size(32, 32), + // The origin for this image is 0,0. + new google.maps.Point(0,0), + // The anchor for this image is the base of the flagpole + new google.maps.Point(16, 32));\n\n + var finishimage = new google.maps.MarkerImage(finishimageloc,\n + // This marker is 32 pixels wide by 32 pixels tall. + new google.maps.Size(32, 32), + // The origin for this image is 0,0. + new google.maps.Point(0,0), + // The anchor for this image is the base of the flagpole + new google.maps.Point(16, 32));\n + + var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); + var startmarker = new google.maps.Marker({ + position: startlatlng, + map: map, + icon: startimage, + title:"Start"}); + + var finishmarker = new google.maps.Marker({ + position: endlatlng, + icon: finishimage, + map: map, + title:"End"}); \n + + //Add an infowindows + var startinfo = new google.maps.InfoWindow({ + content: startcontent + }); + + var finishinfo = new google.maps.InfoWindow({ + content: finishcontent + }); + + google.maps.event.addListener(startmarker, 'click', function() { + startinfo.open(map,startmarker); + }); + + google.maps.event.addListener(finishmarker, 'click', function() { + finishinfo.open(map,finishmarker); + }); + + var boundsBox = new google.maps.LatLngBounds(swlatlng, nelatlng );\n + map.fitBounds(boundsBox);\n + var polylineCoordinates = [\n''' + for point in polyline: + content += " %s,\n" % (point) + content += ''' ];\n + // Add a polyline.\n + var polyline = new google.maps.Polyline({\n + path: polylineCoordinates,\n + strokeColor: \"#3333cc\",\n + strokeOpacity: 0.6,\n + strokeWeight: 5,\n + });\n + polyline.setMap(map);\n + } + + </script> + </head> + <body onload="initialize()"> + <div id="map_canvas" style="width:100%; height:100%"></div> + </body> + </html>''' + file = fileUtils(self.htmlfile,content) + file.run() + logging.debug("<<") + def createHtml(self,points,levels,init_point): logging.debug(">>") waypoints = self.waypoint.getAllWaypoints() - tmpdir = self.conf.getValue("tmpdir") content = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \n" content += " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" content += " <html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\">\n" @@ -164,24 +292,20 @@ content += " <div id=\"map\" style=\"width: 520px; height: 480px\"></div>\n" content += " </body>\n" content += "</html>\n" - filename = tmpdir+"/index.html" - file = fileUtils(filename,content) + file = fileUtils(self.htmlfile,content) file.run() logging.debug("<<") def createErrorHtml(self): logging.debug(">>") - content = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \n" - content += " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" - content += " <html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\">\n" - content += """ <head>\n + content = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> +<head> <body> No Gpx Data </body> </html> - """ - tmpdir = self.conf.getValue("tmpdir") - filename = tmpdir+"/index.html" - file = fileUtils(filename,content) + ''' + file = fileUtils(self.htmlfile,content) file.run() logging.debug("<<") Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-29 01:30:31 UTC (rev 410) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-29 09:52:42 UTC (rev 411) @@ -120,8 +120,8 @@ self.drawareamonth = MonthGraph(self.month_vbox, self.window1, self.month_combovalue,self.month_combovalue2) self.drawareayear = YearGraph(self.year_vbox, self.window1, self.year_combovalue,self.year_combovalue2) - def createMap(self,Googlemaps,waypoint): - self.googlemaps = Googlemaps(self.data_path, self.map_vbox,waypoint) + def createMap(self,Googlemaps,waypoint, useGM3): + self.googlemaps = Googlemaps(self.data_path, self.map_vbox,waypoint, useGM3) def updateSportList(self,listSport): logging.debug(">>") @@ -835,10 +835,11 @@ if self.block: self.block = False else: - #self.notebook.set_current_page(1) - #self.selected_view="day" self.parent.refreshListRecords() self.parent.refreshGraphView(self.selected_view) + if self.selected_view == "record": + self.recordview.set_current_page(0) + self.parent.refreshRecordGraphView("info") def on_calendar_changemonth(self,widget): logging.debug("--") Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-29 01:30:31 UTC (rev 410) +++ pytrainer/trunk/pytrainer/main.py 2009-11-29 09:52:42 UTC (rev 411) @@ -59,6 +59,9 @@ from lib.system import checkConf from lib.heartrate import * + +##TODO The below should all be able to be in the __init__ section, i.e. does not need to be global + # ERROR is the default log level PATH = os.environ['HOME']+"/.pytrainer" if not os.path.exists(PATH): @@ -71,16 +74,18 @@ For more help on valid options try: %prog -h """ parser = OptionParser(usage=usage) -parser.set_defaults(log_level=logging.ERROR, validate=False) +parser.set_defaults(log_level=logging.ERROR, validate=False, gm3=False) parser.add_option("-d", "--debug", action="store_const", const=logging.DEBUG, dest="log_level", help="enable logging at debug level") parser.add_option("-i", "--info", action="store_const", const=logging.INFO, dest="log_level", help="enable logging at info level") parser.add_option("-w", "--warn", action="store_const", const=logging.WARNING, dest="log_level", help="enable logging at warning level") parser.add_option("--valid", action="store_true", dest="validate", help="enable validation of files imported by plugins (details at info or debug logging level) - note plugin must support validation") parser.add_option("--check", action="store_true", dest="check", help="triggers database (only sqlite based) and configuration file sanity checks, adding fields if necessary. Backup of database is done before any change. Details at info or debug logging level") +parser.add_option("--gmaps3", action="store_true", dest="gm3", help="EXPERIMENTAL: use Google Maps API version3 (currently slower than version 2, but includes some new functionality)") (options, args) = parser.parse_args() log_level = options.log_level validate = options.validate check = options.check +gm3 = options.gm3 # Adding rotating support to default logger with customized format rotHandler = logging.handlers.RotatingFileHandler(LOG_FILENAME, maxBytes=100000, backupCount=5) @@ -93,7 +98,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#410" + self.version ="1.6.0.9_svn#411" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? @@ -104,6 +109,7 @@ self.log_level = log_level self.validate = validate self.check = check + self.gm3 = gm3 self.windowmain = None logging.debug('checking configuration...') @@ -140,7 +146,7 @@ self.loadPlugins() self.loadExtensions() self.windowmain.createGraphs(RecordGraph,DayGraph,WeekGraph, MonthGraph,YearGraph,HeartRateGraph) - self.windowmain.createMap(Googlemaps,self.waypoint) + self.windowmain.createMap(Googlemaps,self.waypoint, self.gm3) self.windowmain.createWaypointEditor(WaypointEditor,self.waypoint) self.windowmain.on_calendar_selected(None) self.refreshMainSportList() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-29 01:30:40
|
Revision: 410 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=410&view=rev Author: jblance Date: 2009-11-29 01:30:31 +0000 (Sun, 29 Nov 2009) Log Message: ----------- Fixes for average heart rate, changes to graph labels and titles Modified Paths: -------------- pytrainer/trunk/glade/pytrainer.glade pytrainer/trunk/pytrainer/gui/drawArea.py pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/monthgraph.py pytrainer/trunk/pytrainer/weekgraph.py pytrainer/trunk/pytrainer/yeargraph.py Modified: pytrainer/trunk/glade/pytrainer.glade =================================================================== --- pytrainer/trunk/glade/pytrainer.glade 2009-11-29 00:19:32 UTC (rev 409) +++ pytrainer/trunk/glade/pytrainer.glade 2009-11-29 01:30:31 UTC (rev 410) @@ -5015,10 +5015,10 @@ <child> <widget class="GtkComboBoxEntry" id="week_combovalue"> <property name="visible">True</property> - <property name="items" translatable="yes">Kilometers + <property name="items" translatable="yes">Distance Time -Beats -Average +Average Heart Rate +Average Speed Calories</property> <property name="add_tearoffs">False</property> <property name="has_frame">True</property> @@ -5061,10 +5061,10 @@ <widget class="GtkComboBoxEntry" id="week_combovalue2"> <property name="visible">True</property> <property name="items" translatable="yes">None -Kilometers +Distance Time -Beats -Average +Average Heart Rate +Average Speed Calories</property> <property name="add_tearoffs">False</property> <property name="has_frame">True</property> @@ -6157,10 +6157,10 @@ <child> <widget class="GtkComboBoxEntry" id="month_combovalue"> <property name="visible">True</property> - <property name="items" translatable="yes">Kilometers + <property name="items" translatable="yes">Distance Time -Beats -Average +Average Heart Rate +Average Speed Calories</property> <property name="add_tearoffs">False</property> <property name="has_frame">True</property> @@ -6203,10 +6203,10 @@ <widget class="GtkComboBoxEntry" id="month_combovalue2"> <property name="visible">True</property> <property name="items" translatable="yes">None -Kilometers +Distance Time -Beats -Average +Average Heart Rate +Average Speed Calories</property> <property name="add_tearoffs">False</property> <property name="has_frame">True</property> @@ -7313,10 +7313,10 @@ <child> <widget class="GtkComboBoxEntry" id="year_combovalue"> <property name="visible">True</property> - <property name="items" translatable="yes">Kilometers + <property name="items" translatable="yes">Distance Time -Beats -Average +Average Heart Rate +Average Speed Calories</property> <property name="add_tearoffs">False</property> <property name="has_frame">True</property> @@ -7359,10 +7359,10 @@ <widget class="GtkComboBoxEntry" id="year_combovalue2"> <property name="visible">True</property> <property name="items" translatable="yes">None -Kilometers +Distance Time -Beats -Average +Average Heart Rate +Average Speed Calories</property> <property name="add_tearoffs">False</property> <property name="has_frame">True</property> Modified: pytrainer/trunk/pytrainer/gui/drawArea.py =================================================================== --- pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-29 00:19:32 UTC (rev 409) +++ pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-29 01:30:31 UTC (rev 410) @@ -88,7 +88,7 @@ pass axis.grid(True) - axis.set_title("%s" %(ylabel[0])) + axis.set_title("%s" %(title[0])) for tl in axis.get_yticklabels(): tl.set_color('%s' %color[0]) @@ -109,7 +109,7 @@ pass for tl in ax2.get_yticklabels(): tl.set_color('%s' %color[1]) - axis.set_title("%s vs %s" %(ylabel[0],ylabel[1])) + axis.set_title("%s vs %s" %(title[0],title[1])) tickLocations = [x+0.5 for x in xrange(0, numCols)] axis.set_xticks(tickLocations) @@ -150,8 +150,8 @@ def drawStackedBars(self,xvalues,yvalues,ylabel,title, valuesAreTime=False): '''function to draw stacked bars - xvalues needs to be a list of strings, e.g. [0]["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] - yvalues needs to be a dict e.g. [0]{'Kayak': {'Tue': 10.08, 'Fri': 17.579999999999998, 'Thu': 15.66, 'Sat': 30.619999999999997}, {'Run': {'Mon': 9.65, 'Sun': 15.59}} + xvalues needs to be a list of lists of strings, e.g. [0]["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] + yvalues needs to be a list of dicts e.g. [0]{'Kayak': {'Tue': 10.08, 'Fri': 17.579999999999998, 'Thu': 15.66, 'Sat': 30.619999999999997}, {'Run': {'Mon': 9.65, 'Sun': 15.59}} ''' #TODO tidy logging.debug('>>') @@ -242,11 +242,12 @@ #print "ax2", xvals, yheights, ybottoms ax2.bar(xvals, yheights, bottom=ybottoms, width=barWidth, color=color, align='edge', label=key) else: #Only zero results + ax2.bar(xvals, [0]*numCols, bottom=[0]*numCols, width=barWidth, color=color, align='edge', label=key) pass ax2.set_xticklabels('' * len(xvalues[1])) ax2.set_ylabel(ylabel[1]) ax2.legend(loc=0) - plt.title("%s vs %s" %(ylabel[0],ylabel[1])) + plt.title("%s vs %s" %(title[0],title[1])) ## try to do some table stuff colLabels = xvalues[0] Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-29 00:19:32 UTC (rev 409) +++ pytrainer/trunk/pytrainer/main.py 2009-11-29 01:30:31 UTC (rev 410) @@ -93,7 +93,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#409" + self.version ="1.6.0.9_svn#410" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? Modified: pytrainer/trunk/pytrainer/monthgraph.py =================================================================== --- pytrainer/trunk/pytrainer/monthgraph.py 2009-11-29 00:19:32 UTC (rev 409) +++ pytrainer/trunk/pytrainer/monthgraph.py 2009-11-29 01:30:31 UTC (rev 410) @@ -60,19 +60,19 @@ yval.append(yvalues) xlab.append(xlabel) ylab.append(ylabel) - tit.append("") + tit.append(title) col.append(color) self.drawarea.stadistics("bars",xval,yval,xlab,ylab,tit,col) def get_value_params(self,value): if value == 0: - return _("day"),_("Kilometers"),_("Daily kilometers"),"y" + return _("day"),_("Distance (km)"),_("Daily Distance"),"y" elif value == 1: - return _("day"),_("Time in Hours"), _("Daily Time"),"b" + return _("day"),_("Time (hours)"), _("Daily Time"),"b" elif value == 2: - return _("day"),_("Beats per Minute"), _("Daily Beats"),"r" + return _("day"),_("Average Heart Rate (bpm)"), _("Daily Average Heart Rate"),"r" elif value == 3: - return _("day"),_("Average (km/h)"), _("Daily Averages"),"g" + return _("day"),_("Average Speed (km/h)"), _("Daily Average Speed"),"g" elif value == 4: return _("day"),_("Calories"), _("Daily Calories"),"b" @@ -103,12 +103,13 @@ year,month,day = date.split("-") #si es una opcion de suma de absolutos / if it is an option of sum of absolute - if ((value_selected == 0) or (value_selected==1) or (value_selected==4)): - list_values[int(day)] += graph_value - #si se trata de calcular medias / if one is to calculate averages: - else: - list_values[int(day)] += graph_value - list_average[int(day)] += 1 + if ((value_selected == 0) or (value_selected==1) or (value_selected==4)): + list_values[int(day)] += graph_value + #si se trata de calcular medias / if one is to calculate averages: + else: + if graph_value is not None and graph_value != 0: + list_values[int(day)] += graph_value + list_average[int(day)] += 1 xunits = [] yunits = [] Modified: pytrainer/trunk/pytrainer/weekgraph.py =================================================================== --- pytrainer/trunk/pytrainer/weekgraph.py 2009-11-29 00:19:32 UTC (rev 409) +++ pytrainer/trunk/pytrainer/weekgraph.py 2009-11-29 01:30:31 UTC (rev 410) @@ -108,15 +108,15 @@ def get_value_params(self,value): if value == 0: - return _("Kilometers"),_("Weekly kilometers") + return _("Distance (km)"),_("Daily Distance") elif value == 1: - return _("Time in Hours"), _("Weekly Time") + return _("Time (hours)"), _("Daily Time") elif value == 2: - return _("Beats per Minute"), _("weekly Beats") + return _("Average Heart Rate (bpm)"), _("Daily Average Heart Rate") elif value == 3: - return _("Average Speed (km/h)"), _("Weekly Speed Averages") + return _("Average Speed (km/h)"), _("Daily Average Speed") elif value == 4: - return _("Calories"), _("Weekly Calories") + return _("Calories"), _("Daily Calories") def getValue(self,record,value_selected): #hacemos una relacion entre el value_selected y los values / we make a relation between value_selected and the values Modified: pytrainer/trunk/pytrainer/yeargraph.py =================================================================== --- pytrainer/trunk/pytrainer/yeargraph.py 2009-11-29 00:19:32 UTC (rev 409) +++ pytrainer/trunk/pytrainer/yeargraph.py 2009-11-29 01:30:31 UTC (rev 410) @@ -61,21 +61,21 @@ yval.append(yvalues) xlab.append(xlabel) ylab.append(ylabel) - tit.append("") + tit.append(title) col.append(color) self.drawarea.stadistics("bars",xval,yval,xlab,ylab,tit,col) def get_value_params(self,value): if value == 0: - return 12,_("month"),_("kilometers"),_("monthly kilometers"),"y" + return 12,_("month"),_("Distance (km)"),_("Monthly Distance"),"y" elif value == 1: - return 12,_("month"),_("time in hours"), _("monthly time"),"b" + return 12,_("month"),_("Time (hours)"), _("Monthly Time"),"b" elif value == 2: - return 12,_("month"),_("beats per minute"), _("monthly beats"),"r" + return 12,_("month"),_("Average Heart Rate (bpm)"), _("Monthly Average Heart Rate"),"r" elif value == 3: - return 12,_("month"),_("average (hm/h)"), _("monthly averages"),"g" + return 12,_("month"),_("Average Speed (km/h)"), _("Monthly Average Speed"),"g" elif value == 4: - return 12,_("month"),_("calories"), _("monthly calories"),"b" + return 12,_("month"),_("Calories"), _("Monthly Calories"),"b" def get_values(self,values,value_selected,monthsnumber): #hacemos una relacion entre el value_selected y los values @@ -87,61 +87,46 @@ 4: 6 #value 4 es calorias(6) } list_values = {} - km_total = {} - tm_total = {} list_average = {} - i = 1 - while i < 13: - list_values[i] = 0 - list_average[i] = 0 + tm_total = {} + for i in range(1,monthsnumber+1): + list_values[i]=0 + list_average[i]=0 tm_total[i] = 0 - i += 1 value_sel = conv[value_selected] - log = [] for value in values: date = value[0] year,month,day = date.split("-") month = int(month) - #si la opcion es tiempo lo pasamos a horas + #si la opcion es tiempo lo pasamos a horas / if the option is time we passed it to hours if (value_sel == 2): graph_value = self.getFloatValue(value[value_sel])/3600 - #Si la opcion es la media tenemos que recalcular km y tiempo total - elif (value_sel == 5): - graph_value = self.getFloatValue(value[1]) else: graph_value = self.getFloatValue(value[value_sel]) - #si es una opcion de suma de absolutos: - if ((value_selected == 0) or (value_selected==1) or (value_selected==4)): + #si es una opcion de suma de absolutos / if it is an option of sum of absolute + if ((value_selected == 0) or (value_selected==1) or (value_selected==4)): list_values[int(month)] += graph_value - - #Si es pa la media de velocidad - elif (value_selected == 3): - list_values[int(month)] += graph_value - tm_total[int(month)] += self.getFloatValue(value[2]) - - #si se trata de calcular medias: + #si se trata de calcular medias / if one is to calculate averages: else: - list_values[int(month)] += graph_value - list_average[int(month)] += 1 - + if graph_value is not None and graph_value != 0: + list_values[int(month)] += graph_value + list_average[int(month)] += 1 + xunits = [] yunits = [] for i in range (0,monthsnumber): xunits.append(unicode(calendar.month_abbr[i+1])) - #xunits.append(i) yunits.append(float(0)) - for i in list_values: - if list_average[i] > 0: - val = list_values[i]/list_average[i] - if tm_total[i] > 0: - val = list_values[i]/(tm_total[i]/3600) + for value in list_values: + if ((value_selected == 0) or (value_selected==1) or (value_selected==4)): + yunits[value-1] = list_values[value] else: - val = list_values[i] - yunits[i-1] = val - return xunits,yunits + if list_average[value]>0: + yunits[value-1] = list_values[value]/list_average[value] + return xunits,yunits def getFloatValue(self, value): try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-29 00:20:26
|
Revision: 409 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=409&view=rev Author: jblance Date: 2009-11-29 00:19:32 +0000 (Sun, 29 Nov 2009) Log Message: ----------- Modified on_sportlist_changed event to improve performance Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-26 09:48:08 UTC (rev 408) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-29 00:19:32 UTC (rev 409) @@ -46,6 +46,7 @@ self.popup = PopupMenu(data_path,self) self.block = False + self.activeSport = None def new(self): self.menublocking = 0 @@ -122,15 +123,19 @@ def createMap(self,Googlemaps,waypoint): self.googlemaps = Googlemaps(self.data_path, self.map_vbox,waypoint) - def updateSportList(self,listSport): + def updateSportList(self,listSport): logging.debug(">>") - self.sportlist.set_active(1) - while (self.sportlist.get_active() == 1): - self.sportlist.remove_text(1) - self.sportlist.set_active(1) + liststore = self.sportlist.get_model() + if self.sportlist.get_active() is not 0: + self.sportlist.set_active(0) #Set first item active if it isnt + firstEntry = self.sportlist.get_active_text() + liststore.clear() #Delete all items + #Re-add "All Sports" + liststore.append([firstEntry]) + #Re-add all sports in listSport for i in listSport: - self.sportlist.append_text(i[0]) - self.sportlist.set_active(0) + liststore.append([i[0]]) + self.sportlist.set_active(0) logging.debug("<<") def create_treeview(self,treeview,column_names): @@ -769,7 +774,11 @@ def on_sportlist_changed(self,widget): logging.debug("--") - self.parent.refreshGraphView(self.selected_view) + if self.sportlist.get_active() != self.activeSport: + self.activeSport = self.sportlist.get_active() + self.parent.refreshGraphView(self.selected_view) + else: + logging.debug("on_sportlist_changed called with no change") def on_page_change(self,widget,gpointer,page): logging.debug("--") Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-26 09:48:08 UTC (rev 408) +++ pytrainer/trunk/pytrainer/main.py 2009-11-29 00:19:32 UTC (rev 409) @@ -93,7 +93,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#408" + self.version ="1.6.0.9_svn#409" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-26 09:48:15
|
Revision: 408 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=408&view=rev Author: jblance Date: 2009-11-26 09:48:08 +0000 (Thu, 26 Nov 2009) Log Message: ----------- Updated week view to allow second axis use Modified Paths: -------------- pytrainer/trunk/glade/pytrainer.glade pytrainer/trunk/pytrainer/gui/drawArea.py pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/weekgraph.py Modified: pytrainer/trunk/glade/pytrainer.glade =================================================================== --- pytrainer/trunk/glade/pytrainer.glade 2009-11-26 07:51:34 UTC (rev 407) +++ pytrainer/trunk/glade/pytrainer.glade 2009-11-26 09:48:08 UTC (rev 408) @@ -5060,7 +5060,12 @@ <child> <widget class="GtkComboBoxEntry" id="week_combovalue2"> <property name="visible">True</property> - <property name="items" translatable="yes">None</property> + <property name="items" translatable="yes">None +Kilometers +Time +Beats +Average +Calories</property> <property name="add_tearoffs">False</property> <property name="has_frame">True</property> <property name="focus_on_click">True</property> Modified: pytrainer/trunk/pytrainer/gui/drawArea.py =================================================================== --- pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-26 07:51:34 UTC (rev 407) +++ pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-26 09:48:08 UTC (rev 408) @@ -148,19 +148,29 @@ else: return '%1.1f' % x - def drawStackedBars(self,xbars,yvalues,ylabel,title, valuesAreTime=False): + def drawStackedBars(self,xvalues,yvalues,ylabel,title, valuesAreTime=False): '''function to draw stacked bars - xbars needs to be a list of strings, e.g. ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] - yvalues needs to be a dict e.g. {'Kayak': {'Tue': 10.08, 'Fri': 17.579999999999998, 'Thu': 15.66, 'Sat': 30.619999999999997}, {'Run': {'Mon': 9.65, 'Sun': 15.59}} + xvalues needs to be a list of strings, e.g. [0]["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] + yvalues needs to be a dict e.g. [0]{'Kayak': {'Tue': 10.08, 'Fri': 17.579999999999998, 'Thu': 15.66, 'Sat': 30.619999999999997}, {'Run': {'Mon': 9.65, 'Sun': 15.59}} ''' #TODO tidy - #Add totals to table? logging.debug('>>') logging.debug("Title: %s", (title, )) self.removeVboxChildren() - keys = yvalues.keys() + + #Check how many axes to draw + if len(xvalues) == 1: #One axis + barWidth = 0.8 + barOffset = 0.1 + elif len(xvalues) == 2: #Twin axes + barWidth = 0.4 + barOffset = 0.1 + else: #Error + return + + keys = yvalues[0].keys() numRows = len(keys) - numCols = len(xbars) + numCols = len(xvalues[0]) if numRows == 0: return width = .8 @@ -170,35 +180,76 @@ ybottoms = [0] * numCols yheights = [0] * numCols inds = xrange(0, numCols) - xvals = [x+(1-width)/2 for x in xrange(0, numCols)] + xvals = [x+barOffset for x in range(0, numCols)] cellText = [] self.showGraph=False + + #Display first axis for key in keys: for ind in inds: ybottoms[ind] += yheights[ind] yheights[ind] = 0 #Zero heights color = self.getColor(keys.index(key)) - for xvalue in xbars: - index = xbars.index(xvalue) - if xvalue in yvalues[key]: - height = yvalues[key][xvalue] + for xvalue in xvalues[0]: + index = xvalues[0].index(xvalue) + if xvalue in yvalues[0][key]: + height = yvalues[0][key][xvalue] if float(height) > 0.0: self.showGraph=True else: height = self.NEARLY_ZERO yheights[index] = height - cellText.append([self.fmtTableText(x, valuesAreTime) for x in yheights]) + cellText.append([self.fmtTableText(x, valuesAreTime[0]) for x in yheights]) if self.showGraph: - axis.bar(xvals, yheights, bottom=ybottoms, width=width, color=color, align='edge', label=key) + axis.bar(xvals, yheights, bottom=ybottoms, width=barWidth, color=color, align='edge', label=key) else: #Only zero results pass - axis.set_xticklabels('' * len(xbars)) - axis.set_ylabel(ylabel) - plt.title(title) - axis.legend(loc=0) + axis.set_xticklabels('' * len(xvalues[0])) + axis.set_ylabel(ylabel[0]) + if len(xvalues) == 1: + plt.title(title[0]) + axis.legend(loc=0) + #Display twin axis + if len(xvalues) == 2: + self.showGraph=False + ax2 = axis.twinx() + keys = yvalues[1].keys() + ybottoms = [0] * numCols + yheights = [self.NEARLY_ZERO] * numCols + for key in keys: + for ind in inds: + ybottoms[ind] += yheights[ind] + yheights[ind] = 0.0 #Zero heights + color = self.getColor(keys.index(key)) + for xvalue in xvalues[0]: + index = xvalues[0].index(xvalue) + if xvalue in yvalues[1][key]: + height = yvalues[1][key][xvalue] + if float(height) > 0.0: + self.showGraph=True + else: + height = self.NEARLY_ZERO + yheights[index] = height + textToAdd = self.fmtTableText(height, valuesAreTime[1]) + if textToAdd is not ' ': + row = keys.index(key) + col = index + cellText[row][col] += " | %s" % (self.fmtTableText(height, valuesAreTime[1])) + #print "Would add %s to %s %s" % (self.fmtTableText(height, valuesAreTime[1]), index, keys.index(key)) + if self.showGraph: + xvals = [x+barOffset+barWidth for x in range(0, numCols)] + #print "ax2", xvals, yheights, ybottoms + ax2.bar(xvals, yheights, bottom=ybottoms, width=barWidth, color=color, align='edge', label=key) + else: #Only zero results + pass + ax2.set_xticklabels('' * len(xvalues[1])) + ax2.set_ylabel(ylabel[1]) + ax2.legend(loc=0) + plt.title("%s vs %s" %(ylabel[0],ylabel[1])) + ## try to do some table stuff - colLabels = xbars + colLabels = xvalues[0] rowLabels = keys axis.table(cellText=cellText, cellLoc='center', rowLabels=rowLabels, colLabels=colLabels, loc='bottom') plt.subplots_adjust(left=0.15,bottom=0.08+(0.03*numRows)) Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-26 07:51:34 UTC (rev 407) +++ pytrainer/trunk/pytrainer/main.py 2009-11-26 09:48:08 UTC (rev 408) @@ -93,7 +93,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#407" + self.version ="1.6.0.9_svn#408" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? Modified: pytrainer/trunk/pytrainer/weekgraph.py =================================================================== --- pytrainer/trunk/pytrainer/weekgraph.py 2009-11-26 07:51:34 UTC (rev 407) +++ pytrainer/trunk/pytrainer/weekgraph.py 2009-11-26 09:48:08 UTC (rev 408) @@ -29,6 +29,13 @@ def drawgraph(self,values, date_ini, date_end): logging.debug(">>") + yval = [] + xlab = [] + ylab = [] + tit = [] + valsAreTime = [] + + #Reset the comboboxes if nothing selected value_selected = self.combovalue.get_active() if value_selected < 0: self.combovalue.set_active(0) @@ -37,17 +44,36 @@ if value_selected2 < 0: self.combovalue2.set_active(0) value_selected2 = 0 - logging.debug(str(values)) + + #build localised days list + days = self.getDays(date_ini) + ylabel,title = self.get_value_params(value_selected) - #build days list to ensure localised values are used. - #TODO look at using calendar.day_abbr for this - days = [] - for day in range(0, 7): - dateTemp = datetime.datetime.strptime(date_ini, "%Y-%m-%d") - incrementDay = datetime.timedelta(days=day) - dateToUse = dateTemp + incrementDay - days.append( unicode(dateToUse.strftime("%a")) ) + ylab.append(ylabel) + tit.append(title) + + #TODO + yvalues, valuesAreTime = self.get_values(values,value_selected) + yval.append(yvalues) + xlab.append(days) + valsAreTime.append(valuesAreTime) + + #Second combobox used + if value_selected2 > 0: + value_selected2 = value_selected2-1 + ylabel,title = self.get_value_params(value_selected2) + ylab.append(ylabel) + tit.append(title) + yvalues, valuesAreTime = self.get_values(values,value_selected2) + yval.append(yvalues) + xlab.append(days) + valsAreTime.append(valuesAreTime) + #Draw chart + self.drawarea.drawStackedBars(xlab,yval,ylab,tit,valsAreTime) + logging.debug("<<") + + def get_values(self, values, value_selected): valueDict = {} #Stores the totals valueCount = {} #Counts the totals to allow for averaging if needed @@ -78,8 +104,7 @@ else: valuesAreTime=False - self.drawarea.drawStackedBars(days,valueDict,ylabel,title, valuesAreTime) - logging.debug("<<") + return valueDict, valuesAreTime def get_value_params(self,value): if value == 0: @@ -115,5 +140,12 @@ except: return float(0) - - + def getDays(self, date_ini): + #TODO look at using calendar.day_abbr for this + days = [] + for day in range(0, 7): + dateTemp = datetime.datetime.strptime(date_ini, "%Y-%m-%d") + incrementDay = datetime.timedelta(days=day) + dateToUse = dateTemp + incrementDay + days.append( unicode(dateToUse.strftime("%a")) ) + return days This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-26 07:51:44
|
Revision: 407 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=407&view=rev Author: jblance Date: 2009-11-26 07:51:34 +0000 (Thu, 26 Nov 2009) Log Message: ----------- Fix for month and year graphs to correctly display 0 height columns. Year graph now displays text version of month Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/drawArea.py pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/lib/date.py pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/monthgraph.py pytrainer/trunk/pytrainer/weekgraph.py pytrainer/trunk/pytrainer/yeargraph.py Modified: pytrainer/trunk/pytrainer/gui/drawArea.py =================================================================== --- pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-26 05:40:08 UTC (rev 406) +++ pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-26 07:51:34 UTC (rev 407) @@ -57,52 +57,70 @@ logging.debug('>>') self.removeVboxChildren() figure = Figure(figsize=(6,4), dpi=72) - #canvas = FigureCanvasGTK(figure) # a gtk.DrawingArea - + numCols=len(xvalues[0]) xmod = 0.4 - if len(xvalues) > 1: - width = 0.40 - else: - width = 0.80 - i=0 - - for value in xvalues: - if i<1: - axis = figure.add_subplot(111) - axis.set_xlim(-width,len(xvalues[i])) - axis.set_xlabel(xlabel[i]) - axis.set_ylabel(ylabel[i]) - axis.set_title(title[i]) - j=0 - #print "xvalues: %s" % (xvalues) - #print "yvalues: %s" % (yvalues) - for x in xvalues[i]: - xvalues[i][j]=x-xmod - j+=1 - axis.bar(xvalues[i], yvalues[i], width, color=color[i]) - - axis.grid(True) - for tl in axis.get_yticklabels(): - tl.set_color('%s' %color[i]) - if i>=1: - ax2 = axis.twinx() - ax2.bar(xvalues[i], yvalues[i], width, color=color[i]) - for tl in ax2.get_yticklabels(): - tl.set_color('%s' %color[i]) - axis.set_xlabel(xlabel[i]) - i+=1 - - if (len(xvalues)>1): + self.showGraph=False + axis = figure.add_subplot(111) + + if len(xvalues) == 1: #One axis + barWidth = 0.8 + barOffset = 0.1 + elif len(xvalues) == 2: #Twin axes + barWidth = 0.4 + barOffset = 0.1 + else: #Error + return + + axis.set_xlabel(xlabel[0]) + axis.set_ylabel(ylabel[0]) + xvals = [x+barOffset for x in range(0, numCols)] + yvals = [0] * numCols + for i in range(0, numCols): + yval = yvalues[0][i] + if float(yval) > 0.0: + self.showGraph=True + else: + yval = self.NEARLY_ZERO + yvals[i] = yval + if self.showGraph: + axis.bar(xvals, yvals, barWidth, color=color[0], align='edge') + else: #Only zero results + pass + + axis.grid(True) + axis.set_title("%s" %(ylabel[0])) + for tl in axis.get_yticklabels(): + tl.set_color('%s' %color[0]) + + if len(xvalues) == 2: #Display twin axis + ax2 = axis.twinx() + xvals = [x+barOffset+barWidth for x in range(0, numCols)] + for i in range(0, numCols): + yval = yvalues[1][i] + if float(yval) > 0.0: + self.showGraph=True + else: + yval = self.NEARLY_ZERO + yvals[i] = yval + if self.showGraph: + ax2.bar(xvals, yvals, barWidth, color=color[1], align='edge') + ax2.set_ylabel(ylabel[1]) + else: #Only zero results + pass + for tl in ax2.get_yticklabels(): + tl.set_color('%s' %color[1]) axis.set_title("%s vs %s" %(ylabel[0],ylabel[1])) - else: - axis.set_title("%s" %(ylabel[0])) + tickLocations = [x+0.5 for x in xrange(0, numCols)] + axis.set_xticks(tickLocations) + axis.set_xticklabels(xvalues[0]) + axis.set_xlim(0, numCols) canvas = FigureCanvasGTK(figure) # a gtk.DrawingArea canvas.show() self.vbox.pack_start(canvas, True, True) - toolbar = NavigationToolbar(canvas, self.window) - self.vbox.pack_start(toolbar, False, False) + #toolbar = NavigationToolbar(canvas, self.window) + #self.vbox.pack_start(toolbar, False, False) for child in self.vbox.get_children(): logging.debug('Child available: '+str(child)) @@ -115,13 +133,22 @@ x = x % len(colors) return colors[x] - def fmt(self, x): + def fmtTableText(self, x, valuesAreTime): if x <= 0.0001: return ' ' + elif valuesAreTime: + hour = int(x) + minutes = int((x-hour)*60) + hourLabel = _("h") + minLabel = _("min") + if hour > 0: + return "%d%s %02d%s" % (hour, hourLabel, minutes, minLabel) + else: + return "%02d%s" % (minutes, minLabel) else: return '%1.1f' % x - def drawStackedBars(self,xbars,yvalues,xlabel,ylabel,title): + def drawStackedBars(self,xbars,yvalues,ylabel,title, valuesAreTime=False): '''function to draw stacked bars xbars needs to be a list of strings, e.g. ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] yvalues needs to be a dict e.g. {'Kayak': {'Tue': 10.08, 'Fri': 17.579999999999998, 'Thu': 15.66, 'Sat': 30.619999999999997}, {'Run': {'Mon': 9.65, 'Sun': 15.59}} @@ -160,7 +187,7 @@ else: height = self.NEARLY_ZERO yheights[index] = height - cellText.append([self.fmt(x) for x in yheights]) + cellText.append([self.fmtTableText(x, valuesAreTime) for x in yheights]) if self.showGraph: axis.bar(xvals, yheights, bottom=ybottoms, width=width, color=color, align='edge', label=key) else: #Only zero results Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-26 05:40:08 UTC (rev 406) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-26 07:51:34 UTC (rev 407) @@ -205,8 +205,8 @@ self.record_date.set_text(str(date)) hour,min,sec=self.parent.date.second2time(int(record_list[3])) self.record_hour.set_text("%d" %hour) - self.record_minute.set_text("%d" %min) - self.record_second.set_text("%d" %sec) + self.record_minute.set_text("%02d" %min) + self.record_second.set_text("%02d" %sec) self.record_calories.set_text("%0.0f" %calories) self.record_title.set_text(title) buffer = self.record_comments.get_buffer() @@ -497,9 +497,9 @@ self.monthview.set_sensitive(0) logging.debug("<<") - def actualize_monthgraph(self,record_list): + def actualize_monthgraph(self,record_list, daysInMonth): logging.debug(">>") - self.drawareamonth.drawgraph(record_list) + self.drawareamonth.drawgraph(record_list, daysInMonth) logging.debug("<<") def actualize_yearview(self,record_list, year): Modified: pytrainer/trunk/pytrainer/lib/date.py =================================================================== --- pytrainer/trunk/pytrainer/lib/date.py 2009-11-26 05:40:08 UTC (rev 406) +++ pytrainer/trunk/pytrainer/lib/date.py 2009-11-26 07:51:34 UTC (rev 407) @@ -93,22 +93,24 @@ return date_ini, date_end def getNameMonth(self, date): - month_name = { - "01":_("January"), - "02":_("Febrary"), - "03":_("March"), - "04":_("April"), - "05":_("May"), - "06":_("June"), - "07":_("July"), - "08":_("August"), - "09":_("September"), - "10":_("October"), - "11":_("November"), - "12":_("December") - } + #month_name = { + # "01":_("January"), + # "02":_("Febrary"), + # "03":_("March"), + # "04":_("April"), + # "05":_("May"), + # "06":_("June"), + # "07":_("July"), + # "08":_("August"), + # "09":_("September"), + # "10":_("October"), + # "11":_("November"), + # "12":_("December") + # } year,month,day = date.split("-") - return month_name["%s" %month] + day, daysInMonth = calendar.monthrange(int(year), int(month)) + monthName = calendar.month_name[int(month)] + return monthName, daysInMonth def getYear(self,date): year,month,day = date.split("-") Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-26 05:40:08 UTC (rev 406) +++ pytrainer/trunk/pytrainer/main.py 2009-11-26 07:51:34 UTC (rev 407) @@ -93,7 +93,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#406" + self.version ="1.6.0.9_svn#407" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? @@ -243,9 +243,9 @@ sport = self.windowmain.getSportSelected() record_list = self.record.getrecordPeriodSport(date_ini, date_end,sport) #logging.debug('record list: '+record_list) - nameMonth = self.date.getNameMonth(date_selected) + nameMonth, daysInMonth = self.date.getNameMonth(date_selected) self.windowmain.actualize_monthview(record_list, nameMonth) - self.windowmain.actualize_monthgraph(record_list) + self.windowmain.actualize_monthgraph(record_list, daysInMonth) elif view=="year": logging.debug('year view') date_ini, date_end = self.date.getYearInterval(date_selected) Modified: pytrainer/trunk/pytrainer/monthgraph.py =================================================================== --- pytrainer/trunk/pytrainer/monthgraph.py 2009-11-26 05:40:08 UTC (rev 406) +++ pytrainer/trunk/pytrainer/monthgraph.py 2009-11-26 07:51:34 UTC (rev 407) @@ -24,7 +24,7 @@ self.combovalue = combovalue self.combovalue2 = combovalue2 - def drawgraph(self,values): + def drawgraph(self,values, daysInMonth): xval = [] yval = [] xlab = [] @@ -36,9 +36,8 @@ if value_selected < 0: self.combovalue.set_active(0) value_selected = 0 - daysmonth,xlabel,ylabel,title,color = self.get_value_params(value_selected) - #print "daysmonth %s,xlabel %s,ylabel %s,title %s,color %s" % (daysmonth,xlabel,ylabel,title,color) - xvalues,yvalues = self.get_values(values,value_selected,daysmonth) + xlabel,ylabel,title,color = self.get_value_params(value_selected) + xvalues,yvalues = self.get_values(values,value_selected,daysInMonth) xval.append(xvalues) yval.append(yvalues) @@ -55,8 +54,8 @@ value_selected2 = 0 if value_selected2 > 0: value_selected2 = value_selected2-1 - daysmonth,xlabel,ylabel,title,color = self.get_value_params(value_selected2) - xvalues,yvalues = self.get_values(values,value_selected2,daysmonth) + xlabel,ylabel,title,color = self.get_value_params(value_selected2) + xvalues,yvalues = self.get_values(values,value_selected2,daysInMonth) xval.append(xvalues) yval.append(yvalues) xlab.append(xlabel) @@ -67,17 +66,17 @@ def get_value_params(self,value): if value == 0: - return 32,_("day"),_("Kilometers"),_("Daily kilometers"),"y" + return _("day"),_("Kilometers"),_("Daily kilometers"),"y" elif value == 1: - return 32,_("day"),_("Time in Hours"), _("Daily Time"),"b" + return _("day"),_("Time in Hours"), _("Daily Time"),"b" elif value == 2: - return 32,_("day"),_("Beats per Minute"), _("Daily Beats"),"r" + return _("day"),_("Beats per Minute"), _("Daily Beats"),"r" elif value == 3: - return 32,_("day"),_("Average (km/h)"), _("Daily Averages"),"g" + return _("day"),_("Average (km/h)"), _("Daily Averages"),"g" elif value == 4: - return 32,_("day"),_("Calories"), _("Daily Calories"),"b" + return _("day"),_("Calories"), _("Daily Calories"),"b" - def get_values(self,values,value_selected,daysmonth): + def get_values(self,values,value_selected,daysInMonth): #hacemos una relacion entre el value_selected y los values / we make a relation between value_selected and the values conv = { 0: 1, #value 0 es kilometros (1) @@ -88,7 +87,7 @@ } list_values = {} list_average = {} - for i in range(1,32): + for i in range(1,daysInMonth+1): list_values[i]=0 list_average[i]=0 @@ -113,8 +112,8 @@ xunits = [] yunits = [] - for i in range (0,daysmonth): - xunits.append(i) + for i in range (1,daysInMonth+1): + xunits.append(i) yunits.append(float(0)) for value in list_values: Modified: pytrainer/trunk/pytrainer/weekgraph.py =================================================================== --- pytrainer/trunk/pytrainer/weekgraph.py 2009-11-26 05:40:08 UTC (rev 406) +++ pytrainer/trunk/pytrainer/weekgraph.py 2009-11-26 07:51:34 UTC (rev 407) @@ -19,6 +19,7 @@ from gui.drawArea import DrawArea import logging import datetime +import calendar class WeekGraph: def __init__(self, vbox = None, window = None, combovalue = None, combovalue2 = None): @@ -38,8 +39,8 @@ value_selected2 = 0 logging.debug(str(values)) ylabel,title = self.get_value_params(value_selected) - xlabel = "" #build days list to ensure localised values are used. + #TODO look at using calendar.day_abbr for this days = [] for day in range(0, 7): dateTemp = datetime.datetime.strptime(date_ini, "%Y-%m-%d") @@ -72,8 +73,12 @@ if valueCount[sport][day] > 1: #Only average if 2 or more entries on this day valueDict[sport][day] /= valueCount[sport][day] logging.debug("averaging values: after %s" % valueDict[sport][day]) + if value_selected == 1: #Values are of time type + valuesAreTime=True + else: + valuesAreTime=False - self.drawarea.drawStackedBars(days,valueDict,xlabel,ylabel,title) + self.drawarea.drawStackedBars(days,valueDict,ylabel,title, valuesAreTime) logging.debug("<<") def get_value_params(self,value): Modified: pytrainer/trunk/pytrainer/yeargraph.py =================================================================== --- pytrainer/trunk/pytrainer/yeargraph.py 2009-11-26 05:40:08 UTC (rev 406) +++ pytrainer/trunk/pytrainer/yeargraph.py 2009-11-26 07:51:34 UTC (rev 407) @@ -17,6 +17,7 @@ #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. from gui.drawArea import DrawArea +import calendar class YearGraph: def __init__(self, vbox = None, window = None, combovalue = None, combovalue2 = None): @@ -129,7 +130,8 @@ xunits = [] yunits = [] for i in range (0,monthsnumber): - xunits.append(i) + xunits.append(unicode(calendar.month_abbr[i+1])) + #xunits.append(i) yunits.append(float(0)) for i in list_values: if list_average[i] > 0: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-26 05:40:16
|
Revision: 406 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=406&view=rev Author: jblance Date: 2009-11-26 05:40:08 +0000 (Thu, 26 Nov 2009) Log Message: ----------- Fix to pad minutes and second in time to 2 digits in day, week, month and year view Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-26 05:30:09 UTC (rev 405) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-26 05:40:08 UTC (rev 406) @@ -310,8 +310,8 @@ self.day_distance.set_text("%0.2f" %distance) hour,min,sec=self.parent.date.second2time(timeinseconds) self.day_hour.set_text("%d" %hour) - self.day_minute.set_text("%d" %min) - self.day_second.set_text("%d" %sec) + self.day_minute.set_text("%02d" %min) + self.day_second.set_text("%02d" %sec) self.day_beats.set_text("%0.2f" %tbeats) self.day_maxbeats.set_text("%0.2f" %maxbeats) self.day_average.set_text("%0.2f" %average) @@ -405,8 +405,8 @@ self.weeka_distance.set_text("%0.2f" %km) hour,min,sec = self.parent.date.second2time(time) self.weeka_hour.set_text("%d" %hour) - self.weeka_minute.set_text("%d" %min) - self.weeka_second.set_text("%d" %sec) + self.weeka_minute.set_text("%02d" %min) + self.weeka_second.set_text("%02d" %sec) self.weeka_maxbeats.set_text("%0.2f" %(maxbeats)) self.weeka_beats.set_text("%0.2f" %(tbeats)) self.weeka_average.set_text("%0.2f" %average) @@ -483,8 +483,8 @@ self.montha_distance.set_text("%0.2f" %km) hour,min,sec = self.parent.date.second2time(time) self.montha_hour.set_text("%d" %hour) - self.montha_minute.set_text("%d" %min) - self.montha_second.set_text("%d" %sec) + self.montha_minute.set_text("%02d" %min) + self.montha_second.set_text("%02d" %sec) self.montha_maxbeats.set_text("%0.2f" %(maxbeats)) self.montha_beats.set_text("%0.2f" %(tbeats)) self.montha_average.set_text("%0.2f" %average) @@ -543,8 +543,8 @@ self.yeara_distance.set_text("%0.2f" %km) hour,min,sec = self.parent.date.second2time(time) self.yeara_hour.set_text("%d" %hour) - self.yeara_minute.set_text("%d" %min) - self.yeara_second.set_text("%d" %sec) + self.yeara_minute.set_text("%02d" %min) + self.yeara_second.set_text("%02d" %sec) self.yeara_beats.set_text("%0.2f" %tbeats) self.yeara_maxbeats.set_text("%0.2f" %(maxbeats)) self.yeara_average.set_text("%0.2f" %average) Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-26 05:30:09 UTC (rev 405) +++ pytrainer/trunk/pytrainer/main.py 2009-11-26 05:40:08 UTC (rev 406) @@ -93,7 +93,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#405" + self.version ="1.6.0.9_svn#406" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-26 05:30:18
|
Revision: 405 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=405&view=rev Author: jblance Date: 2009-11-26 05:30:09 +0000 (Thu, 26 Nov 2009) Log Message: ----------- Fix for week view labels to dosplay correctly with non-ascii characters Modified Paths: -------------- pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/weekgraph.py Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-25 10:43:46 UTC (rev 404) +++ pytrainer/trunk/pytrainer/main.py 2009-11-26 05:30:09 UTC (rev 405) @@ -93,7 +93,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#404" + self.version ="1.6.0.9_svn#405" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? Modified: pytrainer/trunk/pytrainer/weekgraph.py =================================================================== --- pytrainer/trunk/pytrainer/weekgraph.py 2009-11-25 10:43:46 UTC (rev 404) +++ pytrainer/trunk/pytrainer/weekgraph.py 2009-11-26 05:30:09 UTC (rev 405) @@ -45,7 +45,7 @@ dateTemp = datetime.datetime.strptime(date_ini, "%Y-%m-%d") incrementDay = datetime.timedelta(days=day) dateToUse = dateTemp + incrementDay - days.append( dateToUse.strftime("%a") ) + days.append( unicode(dateToUse.strftime("%a")) ) valueDict = {} #Stores the totals valueCount = {} #Counts the totals to allow for averaging if needed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-25 10:43:59
|
Revision: 404 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=404&view=rev Author: jblance Date: 2009-11-25 10:43:46 +0000 (Wed, 25 Nov 2009) Log Message: ----------- Update week view to allow selection of distance, time, beats, average speed or calories Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/drawArea.py pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/weekgraph.py Modified: pytrainer/trunk/pytrainer/gui/drawArea.py =================================================================== --- pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-25 09:45:20 UTC (rev 403) +++ pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-25 10:43:46 UTC (rev 404) @@ -145,6 +145,7 @@ inds = xrange(0, numCols) xvals = [x+(1-width)/2 for x in xrange(0, numCols)] cellText = [] + self.showGraph=False for key in keys: for ind in inds: ybottoms[ind] += yheights[ind] @@ -154,11 +155,16 @@ index = xbars.index(xvalue) if xvalue in yvalues[key]: height = yvalues[key][xvalue] + if float(height) > 0.0: + self.showGraph=True else: height = self.NEARLY_ZERO yheights[index] = height cellText.append([self.fmt(x) for x in yheights]) - axis.bar(xvals, yheights, bottom=ybottoms, width=width, color=color, align='edge', label=key) + if self.showGraph: + axis.bar(xvals, yheights, bottom=ybottoms, width=width, color=color, align='edge', label=key) + else: #Only zero results + pass axis.set_xticklabels('' * len(xbars)) axis.set_ylabel(ylabel) plt.title(title) Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-25 09:45:20 UTC (rev 403) +++ pytrainer/trunk/pytrainer/main.py 2009-11-25 10:43:46 UTC (rev 404) @@ -93,7 +93,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#403" + self.version ="1.6.0.9_svn#404" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? Modified: pytrainer/trunk/pytrainer/weekgraph.py =================================================================== --- pytrainer/trunk/pytrainer/weekgraph.py 2009-11-25 09:45:20 UTC (rev 403) +++ pytrainer/trunk/pytrainer/weekgraph.py 2009-11-25 10:43:46 UTC (rev 404) @@ -32,7 +32,13 @@ if value_selected < 0: self.combovalue.set_active(0) value_selected = 0 + value_selected2 = self.combovalue2.get_active() + if value_selected2 < 0: + self.combovalue2.set_active(0) + value_selected2 = 0 logging.debug(str(values)) + ylabel,title = self.get_value_params(value_selected) + xlabel = "" #build days list to ensure localised values are used. days = [] for day in range(0, 7): @@ -40,29 +46,69 @@ incrementDay = datetime.timedelta(days=day) dateToUse = dateTemp + incrementDay days.append( dateToUse.strftime("%a") ) - valueDict = {} - #TODO Need to add time etc (currently distance only) + valueDict = {} #Stores the totals + valueCount = {} #Counts the totals to allow for averaging if needed + for record in values: day = datetime.datetime.strptime(record[0], "%Y-%m-%d").strftime("%a") # Gives Sun, Mon etc for this record sport = record[9] - distance = record[1] + value = self.getValue(record, value_selected) if sport in valueDict: #Already got this sport if day in valueDict[sport]: #Already got this sport on this day - valueDict[sport][day] += distance + valueDict[sport][day] += value + valueCount[sport][day] += 1 else: #New day for this sport - valueDict[sport][day] = distance + valueDict[sport][day] = value + valueCount[sport][day] = 1 else: #New sport - valueDict[sport] = {day: distance} + valueDict[sport] = {day: value} + valueCount[sport] = {day: 1} - xlabel = _("Day") - ylabel = _("kilometers") - title = _("Week View") + if value_selected == 2 or value_selected == 3: + for sport in valueDict.keys(): + for day in valueDict[sport].keys(): + logging.debug("averaging values: before %s (count %s)" % (valueDict[sport][day],valueCount[sport][day])) + if valueCount[sport][day] > 1: #Only average if 2 or more entries on this day + valueDict[sport][day] /= valueCount[sport][day] + logging.debug("averaging values: after %s" % valueDict[sport][day]) + self.drawarea.drawStackedBars(days,valueDict,xlabel,ylabel,title) logging.debug("<<") + def get_value_params(self,value): + if value == 0: + return _("Kilometers"),_("Weekly kilometers") + elif value == 1: + return _("Time in Hours"), _("Weekly Time") + elif value == 2: + return _("Beats per Minute"), _("weekly Beats") + elif value == 3: + return _("Average Speed (km/h)"), _("Weekly Speed Averages") + elif value == 4: + return _("Calories"), _("Weekly Calories") + def getValue(self,record,value_selected): + #hacemos una relacion entre el value_selected y los values / we make a relation between value_selected and the values + conv = { + 0: 1, #value 0 es kilometros (1) + 1: 2, #value 1 es tiempo (2) + 2: 3, #value 2 es pulsaciones(3) + 3: 5, #value 3 es media(5) + 4: 6 #value 4 es calorias(6) + } + value_sel = conv[value_selected] + #si la opcion es tiempo lo pasamos a horas / if the option is time we passed it to hours + if (value_sel == 2): + return self.getFloatValue(record[value_sel])/3600 + else: + return self.getFloatValue(record[value_sel]) + + def getFloatValue(self, value): + try: + return float(value) + except: + return float(0) - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-25 09:45:28
|
Revision: 403 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=403&view=rev Author: jblance Date: 2009-11-25 09:45:20 +0000 (Wed, 25 Nov 2009) Log Message: ----------- Fix for week view to enable sport filtering Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/record.py Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-23 22:09:52 UTC (rev 402) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-25 09:45:20 UTC (rev 403) @@ -941,7 +941,7 @@ if (sport > 0): return self.sportlist.get_active_text() else: - return -1 + return None def quit(self, *args): self.parent.quit() Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-23 22:09:52 UTC (rev 402) +++ pytrainer/trunk/pytrainer/main.py 2009-11-25 09:45:20 UTC (rev 403) @@ -93,7 +93,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9_svn#401" + self.version ="1.6.0.9_svn#403" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? @@ -234,9 +234,8 @@ elif view=="week": logging.debug('week view') date_ini, date_end = self.date.getWeekInterval(date_selected, self.prf_us_system) - #sport = self.windowmain.getSportSelected() - #still need to fix for sport selection - record_list = self.record.getrecordPeriod(date_ini, date_end) + sport = self.windowmain.getSportSelected() + record_list = self.record.getrecordPeriod(date_ini, date_end, sport) self.windowmain.actualize_weekview(record_list, date_ini, date_end) elif view=="month": logging.debug('month view') Modified: pytrainer/trunk/pytrainer/record.py =================================================================== --- pytrainer/trunk/pytrainer/record.py 2009-11-23 22:09:52 UTC (rev 402) +++ pytrainer/trunk/pytrainer/record.py 2009-11-25 09:45:20 UTC (rev 403) @@ -253,14 +253,18 @@ "sports.name,date,distance,time,beats,comments,average,calories,id_record,maxspeed,maxbeats", "date=\"%s\" and records.sport=sports.id_sports" %date) - def getrecordPeriod(self,date_ini, date_end): + def getrecordPeriod(self,date_ini, date_end, sport=None): + #This is essentially the same as getrecordPeriodSport (except date ranges) - need to look at merging the two tables = "records,sports" - condition = "date>=\"%s\" and date<=\"%s\" and records.sport=sports.id_sports" %(date_ini,date_end) + if not sport: + condition = "date>=\"%s\" and date<=\"%s\" and records.sport=sports.id_sports" %(date_ini,date_end) + else: + condition = "date>=\"%s\" and date<=\"%s\" and records.sport=sports.id_sports and sports.name=\"%s\"" %(date_ini,date_end, sport) return self.ddbb.select(tables,"date,distance,time,beats,comments,average,calories,maxspeed,maxbeats, sports.name", condition) def getrecordPeriodSport(self,date_ini, date_end,sport): - if sport<1 : + if not sport: tables = "records" condition = "date>\"%s\" and date<\"%s\"" %(date_ini,date_end) else : This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dg...@us...> - 2009-11-23 22:10:03
|
Revision: 402 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=402&view=rev Author: dgranda Date: 2009-11-23 22:09:52 +0000 (Mon, 23 Nov 2009) Log Message: ----------- Fixed find instruction as per Pierre message Modified Paths: -------------- pytrainer/trunk/utils/translator.sh Modified: pytrainer/trunk/utils/translator.sh =================================================================== --- pytrainer/trunk/utils/translator.sh 2009-11-23 21:49:22 UTC (rev 401) +++ pytrainer/trunk/utils/translator.sh 2009-11-23 22:09:52 UTC (rev 402) @@ -1,6 +1,5 @@ #!/bin/sh - SOFTWARE=$(zenity --list --text="Select your translation software" --radiolist --column "Pick" --column "Software" TRUE "gtranslator" FALSE "kbabel" FALSE "poedit") if [ $? != 0 ]; then exit ; fi @@ -11,7 +10,7 @@ xgettext glade/pytrainer.glade -o ./messages.pot if [ $? != 0 ]; then echo "WARNNING: xgettext not found. Please, install gettext package"; exit; fi -find ./ -iname "*.py" -exec xgettext -k_ -j -o ./messages.pot ./pytrainer/main.py {} +find ./ -iname "*.py" -exec xgettext -k_ -j -o ./messages.pot ./pytrainer/main.py {} \; msginit -i ./messages.pot -l $LANGUAGE -o ./locale/$LANGUAGE/LC_MESSAGES/pytrainer_$LANGUAGE.pot @@ -21,4 +20,3 @@ if [ $? != 0 ]; then echo "WARNNING: $SOFTWARE not found"; exit ; fi make - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dg...@us...> - 2009-11-23 21:49:30
|
Revision: 401 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=401&view=rev Author: dgranda Date: 2009-11-23 21:49:22 +0000 (Mon, 23 Nov 2009) Log Message: ----------- Added command line flag --check to trigger database and config file sanity checks Modified Paths: -------------- pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-23 21:27:06 UTC (rev 400) +++ pytrainer/trunk/pytrainer/main.py 2009-11-23 21:49:22 UTC (rev 401) @@ -59,8 +59,6 @@ from lib.system import checkConf from lib.heartrate import * -# 21.03.2008 - dgranda (updated 17.04.2008) -# Only one parameter from command line is accepted # ERROR is the default log level PATH = os.environ['HOME']+"/.pytrainer" if not os.path.exists(PATH): @@ -78,9 +76,11 @@ parser.add_option("-i", "--info", action="store_const", const=logging.INFO, dest="log_level", help="enable logging at info level") parser.add_option("-w", "--warn", action="store_const", const=logging.WARNING, dest="log_level", help="enable logging at warning level") parser.add_option("--valid", action="store_true", dest="validate", help="enable validation of files imported by plugins (details at info or debug logging level) - note plugin must support validation") +parser.add_option("--check", action="store_true", dest="check", help="triggers database (only sqlite based) and configuration file sanity checks, adding fields if necessary. Backup of database is done before any change. Details at info or debug logging level") (options, args) = parser.parse_args() log_level = options.log_level validate = options.validate +check = options.check # Adding rotating support to default logger with customized format rotHandler = logging.handlers.RotatingFileHandler(LOG_FILENAME, maxBytes=100000, backupCount=5) @@ -93,7 +93,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.6.0.9 svn 397" + self.version ="1.6.0.9_svn#401" self.date = Date() main_dir = os.path.realpath(os.path.dirname(__file__)) #why? sys.path.insert(0, main_dir) #why? @@ -103,6 +103,7 @@ self.profile.isProfileConfigured() self.log_level = log_level self.validate = validate + self.check = check self.windowmain = None logging.debug('checking configuration...') @@ -118,7 +119,11 @@ self.ddbb.connect() self.record = Record(data_path,self) - self.migrationCheck() + if self.check: + #self.migrationCheck() + self.sanityCheck() # Deprecates migrationCheck. Review first installation and version control + else: + logging.info('No sanity check requested') #preparamos la ventana principal self.windowmain = Main(data_path,self,self.version) @@ -455,11 +460,23 @@ if version_tmp < "1.6.0.3": logging.info('Checking pace and max pace stored in DB') self.checkPacesDB() - logging.info('Checking configuration file integrity') - self.profile.checkProfile() + logging.info('Checking configuration file integrity') + self.profile.checkProfile() if version_tmp < self.version: self.configuration.setVersion(self.version) logging.debug('<<') + + def sanityCheck(self): + """23.11.2009 - dgranda + Checks database and configuration file if flag "--check" is enabled at start + args: none + returns: none""" + logging.debug('>>') + logging.info('Checking database integrity') + self.ddbb.checkDBIntegrity() + logging.info('Checking configuration file integrity') + self.profile.checkProfile() + logging.debug('<<') def addDateTimeUTC(self): """12.07.2008 - dgranda This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dg...@us...> - 2009-11-23 21:27:16
|
Revision: 400 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=400&view=rev Author: dgranda Date: 2009-11-23 21:27:06 +0000 (Mon, 23 Nov 2009) Log Message: ----------- Credits updated Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/aboutdialog.py Modified: pytrainer/trunk/pytrainer/gui/aboutdialog.py =================================================================== --- pytrainer/trunk/pytrainer/gui/aboutdialog.py 2009-11-23 10:54:53 UTC (rev 399) +++ pytrainer/trunk/pytrainer/gui/aboutdialog.py 2009-11-23 21:27:06 UTC (rev 400) @@ -32,8 +32,8 @@ self.version = version def run(self): - authors = ["Fiz Vázquez <vu...@si...>\nDavid García Granda <dg...@gm...>"] - translator_credits = "Basque: Jabier Santamaria <men...@gm...>\nCatalan: Eloi Crespillo Itchart <el...@ik...>\nCzech: Lobus Pokorny <sp...@se...>\nFrench: Dj <dj...@dj...>\nFrench: Pierre Gaigé <pg...@fr...>\nNorwegian: Havard Davidsen <hav...@gm...>\nPolish: Seweryn Kokot <sk...@po...>\nGerman: Aleks <al...@sc...>, Noèl Köthe <no...@de...>\nSpanish: Fiz Vázquez <vu...@si...>" + authors = ["Fiz Vázquez <vu...@si...>\nDavid García Granda <dg...@gm...>\nJohn Blance <joh...@gm...>\n\n-Package maintainers:\n\nRedHat/Fedora: Douglas E. Warner <sil...@si...>\nDebian: Noèl Köthe <no...@de...>\nUbuntu: Kevin Dwyer <ke...@ph...>"] + translator_credits = "Basque: Jabier Santamaria <men...@gm...>\nCatalan: Eloi Crespillo Itchart <el...@ik...>\nCzech: Lobus Pokorny <sp...@se...>\nFrench: Dj <dj...@dj...>, Pierre Gaigé <pg...@fr...>\nNorwegian: Havard Davidsen <hav...@gm...>\nPolish: Seweryn Kokot <sk...@po...>\nGerman: Aleks <al...@sc...>, Noèl Köthe <no...@de...>\nSpanish: Fiz Vázquez <vu...@si...>" license = "PyTrainer - The free sport tracking center\nCopyright (C) 2005-09 Fiz Vázquez\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA" about_dialog = gtk.AboutDialog() about_dialog.set_destroy_with_parent(True) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-23 10:55:20
|
Revision: 399 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=399&view=rev Author: jblance Date: 2009-11-23 10:54:53 +0000 (Mon, 23 Nov 2009) Log Message: ----------- Small fix to debug info Modified Paths: -------------- pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-11-23 10:42:47 UTC (rev 398) +++ pytrainer/trunk/pytrainer/main.py 2009-11-23 10:54:53 UTC (rev 399) @@ -208,7 +208,7 @@ logging.debug('>>') if self.windowmain is None: logging.debug("First call to refreshGraphView") - logging.debug('>>') + logging.debug('<<') return date_selected = self.date.getDate() if view=="record": This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-23 10:43:14
|
Revision: 398 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=398&view=rev Author: jblance Date: 2009-11-23 10:42:47 +0000 (Mon, 23 Nov 2009) Log Message: ----------- Added summary information to week view, made view sticky for changes of day Modified Paths: -------------- pytrainer/trunk/INSTALL pytrainer/trunk/glade/pytrainer.glade pytrainer/trunk/pytrainer/gui/drawArea.py pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/lib/date.py pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/monthgraph.py pytrainer/trunk/pytrainer/record.py pytrainer/trunk/pytrainer/weekgraph.py Modified: pytrainer/trunk/INSTALL =================================================================== --- pytrainer/trunk/INSTALL 2009-11-23 09:46:07 UTC (rev 397) +++ pytrainer/trunk/INSTALL 2009-11-23 10:42:47 UTC (rev 398) @@ -20,6 +20,11 @@ gnome-python2-gtkmozembed-2.19.1-27 gpsbabel-1.3.5-1 +(additional packages from 1.7.0 onwards) +python-lxml +libxml2 +libxslt + 1.2.- Optional packages (Google Maps integration) xulrunner-1.9.0.7-1 Modified: pytrainer/trunk/glade/pytrainer.glade =================================================================== --- pytrainer/trunk/glade/pytrainer.glade 2009-11-23 09:46:07 UTC (rev 397) +++ pytrainer/trunk/glade/pytrainer.glade 2009-11-23 10:42:47 UTC (rev 398) @@ -3995,96 +3995,1132 @@ <property name="type">tab</property> </packing> </child> - <child> - <widget class="GtkVBox" id="weekview"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - <child> - <widget class="GtkTable" id="weekview_table"> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <child> <!-- weekview_weeklabel --> - <widget class="GtkLabel" id="weekview_weeklabel"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xpad">17</property> - <property name="ypad">7</property> - <property name="use_markup">True</property> - <property name="label" translatable="yes"><b>Week:</b></property> - <property name="single_line_mode">True</property> - <property name="track_visited_links">False</property> - </widget> - <packing> - <property name="x_options">GTK_SHRINK</property> - <property name="y_options">GTK_SHRINK</property> - </packing> - </child> <!-- weekview_weeklabel --> + +<child> <!-- Start week view tab --> + <widget class="GtkVBox" id="weekview"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkFrame" id="frame4"> + <property name="border_width">6</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + + <child> + <widget class="GtkAlignment" id="alignment4"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + <child> - <widget class="GtkAlignment" id="weekview_alignment"> - <property name="visible">True</property> - <property name="xalign">0</property> - <child> <!-- weekview_weekinfo --> - <widget class="GtkLabel" id="weekview_weekinfo"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">7</property> + <widget class="GtkTable" id="table8"> + <property name="border_width">10</property> + <property name="visible">True</property> + <property name="n_rows">5</property> + <property name="n_columns">6</property> + <property name="homogeneous">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">3</property> + + <child> + <widget class="GtkLabel" id="w_distance_unit"> + <property name="visible">True</property> + <property name="label" translatable="yes">Km</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">5</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">5</property> + <property name="right_attach">6</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="weeka_distance"> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">4</property> + <property name="right_attach">5</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label99"> + <property name="width_request">90</property> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Distance:</b></property> + <property name="use_underline">False</property> <property name="use_markup">True</property> - <property name="label" translatable="yes"></property> - <property name="single_line_mode">True</property> - <property name="track_visited_links">False</property> - </widget> - <packing> - </packing> - </child> <!-- weekview_weekinfo --> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> <!-- weekview_alignment --> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> - <child> <!-- weekview_combovalue --> - <widget class="GtkComboBoxEntry" id="week_combovalue"> - <property name="visible">True</property> - <property name="items" translatable="yes">Distance + <child> + <widget class="GtkLabel" id="label100"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Time:</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox15"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="weeka_hour"> + <property name="visible">True</property> + <property name="label" translatable="yes">000</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label108"> + <property name="visible">True</property> + <property name="label" translatable="yes">:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="weeka_minute"> + <property name="visible">True</property> + <property name="label" translatable="yes">00</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label109"> + <property name="visible">True</property> + <property name="label" translatable="yes">:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="weeka_second"> + <property name="visible">True</property> + <property name="label" translatable="yes">00</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label102"> + <property name="width_request">90</property> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Speed:</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="weeka_average"> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="w_speed_unit"> + <property name="visible">True</property> + <property name="label" translatable="yes">km/h</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">5</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label103"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Calories: </b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="weeka_calories"> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label107"> + <property name="visible">True</property> + <property name="label" translatable="yes">Cal</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">5</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label-2147483648"> + <property name="width_request">90</property> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Max Speed:</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="weeka_maxspeed"> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">4</property> + <property name="right_attach">5</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="w_maxspeed_unit"> + <property name="visible">True</property> + <property name="label" translatable="yes">km/h</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">5</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">5</property> + <property name="right_attach">6</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label110"> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label101"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Beats avg:</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="weeka_beats"> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label105"> + <property name="visible">True</property> + <property name="label" translatable="yes">bpm</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">5</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label-2147483645"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Pace:</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label-2147483644"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Max Pace:</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="w_pace_unit"> + <property name="visible">True</property> + <property name="label" translatable="yes">min/km</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">5</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="w_maxpace_unit"> + <property name="visible">True</property> + <property name="label" translatable="yes">min/km</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">5</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">5</property> + <property name="right_attach">6</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label-2147483641"> + <property name="visible">True</property> + <property name="label" translatable="yes">bpm</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">5</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">5</property> + <property name="right_attach">6</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label-2147483640"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Max Beats:</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="weeka_pace"> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="weeka_maxpace"> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">4</property> + <property name="right_attach">5</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="weeka_maxbeats"> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">4</property> + <property name="right_attach">5</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkHBox" id="hbox14"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label95"> + <property name="visible">True</property> + <property name="label" translatable="yes"> <b>Week:</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="week_date"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">5</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="week_vbox"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkHBox" id="hbox19"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">8</property> + + <child> + <widget class="GtkLabel" id="label-2147483648"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkComboBoxEntry" id="week_combovalue"> + <property name="visible">True</property> + <property name="items" translatable="yes">Kilometers Time -</property> - <property name="add_tearoffs">False</property> - <property name="has_frame">True</property> - <property name="focus_on_click">True</property> - <signal name="changed" handler="on_week_combovalue_changed" /> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_SHRINK</property> - <property name="y_options">GTK_SHRINK</property> - </packing> - </child> <!-- weekview_combovalue --> - </widget> +Beats +Average +Calories</property> + <property name="add_tearoffs">False</property> + <property name="has_frame">True</property> + <property name="focus_on_click">True</property> + <signal name="changed" handler="on_week_combovalue_changed" last_modification_time="Fri, 14 Apr 2006 07:29:22 GMT"/> + </widget> <packing> - <property name="padding">5</property> + <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> </packing> - </child> <!-- weekview_table --> - </widget> + </child> + + <child> + <widget class="GtkLabel" id="label-2147483648"> + <property name="visible">True</property> + <property name="label" translatable="yes">Versus</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkComboBoxEntry" id="week_combovalue2"> + <property name="visible">True</property> + <property name="items" translatable="yes">None</property> + <property name="add_tearoffs">False</property> + <property name="has_frame">True</property> + <property name="focus_on_click">True</property> + <signal name="changed" handler="on_week_combovalue_changed" last_modification_time="Fri, 14 Apr 2006 07:29:22 GMT"/> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label-2147483647"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <placeholder/> + </child> + </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> </packing> - </child> <!-- weekview--> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> <child> <widget class="GtkLabel" id="weekviewlabel"> <property name="visible">True</property> @@ -5226,7 +6262,7 @@ <property name="tab_expand">False</property> <property name="tab_fill">True</property> </packing> - </child> +</child> <!-- End week view tab --> <child> <widget class="GtkLabel" id="label45"> Modified: pytrainer/trunk/pytrainer/gui/drawArea.py =================================================================== --- pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-23 09:46:07 UTC (rev 397) +++ pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-23 10:42:47 UTC (rev 398) @@ -34,6 +34,7 @@ self.window = window #self.canvas = FigureCanvasGTK(self.figure) # a gtk.DrawingArea #self.drawDefault() + self.NEARLY_ZERO = 0.0000000000000000000001 logging.debug('<<') def stadistics(self,type,xvalues,yvalues,xlabel,ylabel,title,color=None,zones=None): @@ -73,6 +74,8 @@ axis.set_ylabel(ylabel[i]) axis.set_title(title[i]) j=0 + #print "xvalues: %s" % (xvalues) + #print "yvalues: %s" % (yvalues) for x in xvalues[i]: xvalues[i][j]=x-xmod j+=1 @@ -152,7 +155,7 @@ if xvalue in yvalues[key]: height = yvalues[key][xvalue] else: - height = 0.0000000000000000001 + height = self.NEARLY_ZERO yheights[index] = height cellText.append([self.fmt(x) for x in yheights]) axis.bar(xvals, yheights, bottom=ybottoms, width=width, color=color, align='edge', label=key) Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-23 09:46:07 UTC (rev 397) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-23 10:42:47 UTC (rev 398) @@ -68,6 +68,7 @@ self._createXmlListView(self.fileconf) self.showAllRecordTreeViewColumns() self.allRecordTreeView.set_search_column(1) + self.notebook.set_current_page(1) def _createXmlListView(self,file): menufile = XMLParser(file) @@ -114,7 +115,7 @@ self.drawareaheartrate = HeartRateGraph(self.heartrate_vbox, self.window1, self.heartrate_vbox2) #self.drawareaday = DayGraph(self.day_vbox, self.day_combovalue) self.day_vbox.hide() - self.drawareaweek = WeekGraph(self.weekview, self.window1, self.week_combovalue) + self.drawareaweek = WeekGraph(self.weekview, self.window1, self.week_combovalue, self.week_combovalue2) self.drawareamonth = MonthGraph(self.month_vbox, self.window1, self.month_combovalue,self.month_combovalue2) self.drawareayear = YearGraph(self.year_vbox, self.window1, self.year_combovalue,self.year_combovalue2) @@ -342,7 +343,80 @@ logging.debug(">>") date_s = datetime.datetime.strptime(date_ini, "%Y-%m-%d") date_e = datetime.datetime.strptime(date_end, "%Y-%m-%d") - self.weekview_weekinfo.set_text("%s - %s" % (datetime.datetime.strftime(date_s, "%a %d %b"), datetime.datetime.strftime(date_e, "%a %d %b")) ) + self.week_date.set_text("%s - %s (%d)" % (datetime.datetime.strftime(date_s, "%a %d %b"), datetime.datetime.strftime(date_e, "%a %d %b"), int(datetime.datetime.strftime(date_e, "%W"))+1) ) + + km = calories = time = average = beats = 0 + num_records = len(record_list) + time_in_min = 0 + tbeats = 0 + maxspeed = 0 + pace = "0.00" + maxpace = "0.00" + maxbeats = 0 + + conf = checkConf() + filename = conf.getValue("conffile") + configuration = XMLParser(filename) + if configuration.getValue("pytraining","prf_us_system") == "True": + self.w_distance_unit.set_text(_("miles")) + self.w_speed_unit.set_text(_("miles/h")) + self.w_maxspeed_unit.set_text(_("miles/h")) + self.w_pace_unit.set_text(_("min/mile")) + self.w_maxpace_unit.set_text(_("min/mile")) + else: + self.w_distance_unit.set_text(_("km")) + self.w_speed_unit.set_text(_("km/h")) + self.w_maxspeed_unit.set_text(_("km/h")) + self.w_pace_unit.set_text(_("min/km")) + self.w_maxpace_unit.set_text(_("min/km")) + + if num_records>0: + for record in record_list: + km += self.parseFloat(record[1]) + time += self.parseFloat(record[2]) + average += self.parseFloat(record[5]) + calories += self.parseFloat(record[6]) + beats = self.parseFloat(record[3]) + if float(beats) > 0: + time_in_min += time/60 + tbeats += beats*(time/60) + if record[7] > maxspeed: + maxspeed = self.parseFloat(record[7]) + if record[8] > maxbeats: + maxbeats = self.parseFloat(record[8]) + + if configuration.getValue("pytraining","prf_us_system") == "True": + km = km2miles(km) + maxspeed = km2miles(maxspeed) + + if time_in_min > 0: + tbeats = tbeats/time... [truncated message content] |
From: <jb...@us...> - 2009-11-23 09:46:15
|
Revision: 397 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=397&view=rev Author: jblance Date: 2009-11-23 09:46:07 +0000 (Mon, 23 Nov 2009) Log Message: ----------- Added configuration option to garmin-hr (import via GPSBabel) plugin to force sport Modified Paths: -------------- pytrainer/trunk/plugins/garmin-hr/conf.xml Modified: pytrainer/trunk/plugins/garmin-hr/conf.xml =================================================================== --- pytrainer/trunk/plugins/garmin-hr/conf.xml 2009-11-22 20:50:22 UTC (rev 396) +++ pytrainer/trunk/plugins/garmin-hr/conf.xml 2009-11-23 09:46:07 UTC (rev 397) @@ -7,4 +7,5 @@ executable="garminhr" > <conf-values variable="device" value="usb:"/> +<conf-values variable="Force_sport_to" value=""/> </pytrainer-plugin> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dg...@us...> - 2009-11-22 20:50:35
|
Revision: 396 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=396&view=rev Author: dgranda Date: 2009-11-22 20:50:22 +0000 (Sun, 22 Nov 2009) Log Message: ----------- Addig functions to check database Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/ddbb.py pytrainer/trunk/pytrainer/lib/sqliteUtils.py Modified: pytrainer/trunk/pytrainer/lib/ddbb.py =================================================================== --- pytrainer/trunk/pytrainer/lib/ddbb.py 2009-11-22 09:18:26 UTC (rev 395) +++ pytrainer/trunk/pytrainer/lib/ddbb.py 2009-11-22 20:50:22 UTC (rev 396) @@ -21,6 +21,8 @@ import logging import traceback +import commands +from system import checkConf class DDBB: def __init__(self, configuration): @@ -30,6 +32,10 @@ else: from sqliteUtils import Sql + self.conf = checkConf() + self.confdir = self.conf.getValue("confdir") + self.ddbb_path = "%s/pytrainer.ddbb" %self.confdir + ddbb_host = configuration.getValue("pytraining","prf_ddbbhost") ddbb = configuration.getValue("pytraining","prf_ddbbname") ddbb_user = configuration.getValue("pytraining","prf_ddbbuser") @@ -202,10 +208,11 @@ def checkDBIntegrity(self): """17.11.2009 - dgranda - Retrieves tables and columns from database and adds something if missed. New in version 1.7.0 + Retrieves tables and columns from database, checks current ones and adds something if missed. New in version 1.7.0 args: none returns: none""" logging.debug('>>') + logging.info('Checking PyTrainer database') if self.ddbb_type != "sqlite": logging.error('Support for MySQL database is decommissioned, please migrate to SQLite. Exiting check') exit(-2) @@ -239,28 +246,42 @@ "time":"date", "name":"varchar(200)", "sym":"varchar(200)"} - columns = [columnsRecords,columnsSports,columnsWaypoints] tablesList = {"records":columnsRecords,"sports":columnsSports,"waypoints":columnsWaypoints} try: - tablesDB = self.ddbbObject.select("sqlite_master","name", "type IN ('table','view') AND name NOT LIKE 'sqlite_%' ORDER BY name") - logging.debug('Found '+ str(len(tablesDB))+' tables in db: '+ str(tablesDB)) + tablesDBT = self.ddbbObject.select("sqlite_master","name", "type IN ('table','view') AND name NOT LIKE 'sqlite_%' ORDER BY name") except: logging.error('Not able to retrieve which tables are in DB. Printing traceback') traceback.print_exc() exit(-1) - if len(tablesDB) > len(tablesList): - logging.info('Database has more tables than expected, please check duplicity!') - for entry in tablesDB: - if entry[0] in tablesList: - logging.debug('Inspecting '+str(entry[0])+' table') - self.ddbbObject.checkTable(entry[0],tablesList[entry[0]]) # ToDo - del tablesList[entry[0]] - if len(tablesList) > 0: - logging.info('Missing '+str(len(tablesList))+' tables in database, adding them') - for table in tablesList: - logging.info('Adding table '+str(table)) - #self.ddbbObject.createTableDefault(table,columns[tablesList.pos(table)]) # ToDo -> review sqliteUtils.createTables + + tablesDB = [] # Database retrieves a list with tuples ¿? + for entry in tablesDBT: + tablesDB.append(entry[0]) + logging.debug('Found '+ str(len(tablesDB))+' tables in DB: '+ str(tablesDB)) + + # Create a compressed copy of current DB + try: + self.createDatabaseBackup() + except: + logging.error('Not able to make a copy of current DB. Printing traceback and exiting') + traceback.print_exc() + exit(-1) + + for entry in tablesList: + if entry not in tablesDB: + logging.warn('Table '+str(entry)+' does not exist in DB') + self.ddbbObject.createTableDefault(entry,tablesList[entry]) + else: + self.ddbbObject.checkTable(entry,tablesList[entry]) + logging.debug('<<') + + def createDatabaseBackup(self): + logging.debug('>>') + logging.debug('Database path: '+str(self.ddbb_path)) + result = commands.getstatusoutput('gzip -c '+self.ddbb_path+' > '+self.ddbb_path+'_`date +%Y%m%d_%H%M`.gz') + if result[0] != 0: + raise Exception, "Copying current database does not work, error #"+str(result[0]) else: - logging.info('Database has all needed tables') + logging.info('Database backup successfully created') logging.debug('<<') Modified: pytrainer/trunk/pytrainer/lib/sqliteUtils.py =================================================================== --- pytrainer/trunk/pytrainer/lib/sqliteUtils.py 2009-11-22 09:18:26 UTC (rev 395) +++ pytrainer/trunk/pytrainer/lib/sqliteUtils.py 2009-11-22 20:50:22 UTC (rev 396) @@ -102,6 +102,27 @@ self.insert("sports","name",["Mountain Bike"]); self.insert("sports","name",["Bike"]); self.insert("sports","name",["Run"]); + + def createTableDefault(self,tableName,columns): + """22.11.2009 - dgranda + Creates a new table in database given name and column name and data types. New in version 1.7.0 + args: + tableName - string with name of the table + columns - dictionary containing column names and data types coming from definition + returns: none""" + logging.debug('>>') + logging.info('Creating '+str(tableName)+' table with default values') + logging.debug('Columns definition: '+str(columns)) + cur = self.db.cursor() + sql = 'CREATE TABLE %s (' %(tableName) + for entry in columns: + sql += '%s %s,' %(entry,columns[entry]) + # Removing trailing comma + sql = sql.rstrip(',') + sql = sql+");" + logging.debug('SQL sentence: '+str(sql)) + cur.execute(sql) + logging.debug('<<') def addWaipoints2ddbb(self): cur = self.db.cursor() @@ -187,21 +208,48 @@ columns - dictionary containing column names and data types coming from definition returns: none""" logging.debug('>>') + logging.info('Inspecting '+str(tableName)+' table') + logging.debug('Columns definition: '+str(columns)) + + # Retrieving data from DB + tableInfo = self.retrieveTableInfo(tableName) + #logging.debug('Raw data retrieved from DB '+str(tableName)+': '+str(tableInfo)) + + # Comparing data retrieved from DB with what comes from definition + columnsDB = {} + for field in tableInfo: + newField = {field[1]:field[2]} + columnsDB.update(newField) + logging.debug('Useful data retrieved from '+str(tableName)+' in DB: '+str(columnsDB)) + + # http://mail.python.org/pipermail/python-list/2002-May/142854.html + tempDict = dict(zip(columns,columns)) + result = [x for x in columnsDB if x not in tempDict] + logging.debug("Comparison result: "+str(result)) + + if len(result) > 0: # may have also different data type + logging.debug('Found columns missed in DB: '+ str(result)) + for entry in result: + logging.debug('Column '+ str(entry) +' not found in DB') + self.addColumn(tableName,str(entry),columnsDB[entry]) + else: + logging.info('Table '+ str(tableName) +' is OK') + logging.debug('<<') + + def retrieveTableInfo(self,tableName): cur = self.db.cursor() sql = "PRAGMA table_info(%s);" %tableName cur.execute(sql) tableInfo = [] for row in cur: tableInfo.append(row) - logging.debug('Raw data retrieved from table '+str(tableName)+': '+str(tableInfo)) - logging.debug('Table '+str(tableName)+' definition: '+str(columns)) - # Comparing data retrieved from DB and what comes from definition - # Extracting data needed (column names and types) - tableInfoComp = {} - for field in tableInfo: - newField = {field[1]:field[2]} - tableInfoComp.update(newField) - logging.debug('Useful data retrieved from table '+str(tableName)+': '+str(tableInfoComp)) - # Finding out if they differ and what exactly if yes - ToDo - logging.debug('<<') + return tableInfo + def addColumn(self,tableName,columnName,dataType): + sql = "alter table %s add %s %s" %(tableName,columnName,dataType) + try: + self.ddbbObject.freeExec(sql) + except: + logging.error('Not able to add/change column '+columnName+' to table '+tableName) + traceback.print_exc() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-22 09:18:38
|
Revision: 395 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=395&view=rev Author: jblance Date: 2009-11-22 09:18:26 +0000 (Sun, 22 Nov 2009) Log Message: ----------- Added info and combobox to week view, fix for start of week Sun vs Mon Modified Paths: -------------- pytrainer/trunk/glade/pytrainer.glade pytrainer/trunk/pytrainer/gui/drawArea.py pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/lib/date.py pytrainer/trunk/pytrainer/weekgraph.py Modified: pytrainer/trunk/glade/pytrainer.glade =================================================================== --- pytrainer/trunk/glade/pytrainer.glade 2009-11-20 06:48:45 UTC (rev 394) +++ pytrainer/trunk/glade/pytrainer.glade 2009-11-22 09:18:26 UTC (rev 395) @@ -4000,13 +4000,91 @@ <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> + <child> + <widget class="GtkTable" id="weekview_table"> + <property name="visible">True</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> + <child> <!-- weekview_weeklabel --> + <widget class="GtkLabel" id="weekview_weeklabel"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">17</property> + <property name="ypad">7</property> + <property name="use_markup">True</property> + <property name="label" translatable="yes"><b>Week:</b></property> + <property name="single_line_mode">True</property> + <property name="track_visited_links">False</property> + </widget> + <packing> + <property name="x_options">GTK_SHRINK</property> + <property name="y_options">GTK_SHRINK</property> + </packing> + </child> <!-- weekview_weeklabel --> + <child> + <widget class="GtkAlignment" id="weekview_alignment"> + <property name="visible">True</property> + <property name="xalign">0</property> + <child> <!-- weekview_weekinfo --> + <widget class="GtkLabel" id="weekview_weekinfo"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">7</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="use_markup">True</property> + <property name="label" translatable="yes"></property> + <property name="single_line_mode">True</property> + <property name="track_visited_links">False</property> + </widget> + <packing> + </packing> + </child> <!-- weekview_weekinfo --> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options">GTK_FILL</property> + </packing> + </child> <!-- weekview_alignment --> + + <child> <!-- weekview_combovalue --> + <widget class="GtkComboBoxEntry" id="week_combovalue"> + <property name="visible">True</property> + <property name="items" translatable="yes">Distance +Time +</property> + <property name="add_tearoffs">False</property> + <property name="has_frame">True</property> + <property name="focus_on_click">True</property> + <signal name="changed" handler="on_week_combovalue_changed" /> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_SHRINK</property> + <property name="y_options">GTK_SHRINK</property> + </packing> + </child> <!-- weekview_combovalue --> + </widget> + <packing> + <property name="padding">5</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> <!-- weekview_table --> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> - <property name="fill">False</property> + <property name="fill">True</property> </packing> - </child> + </child> <!-- weekview--> <child> <widget class="GtkLabel" id="weekviewlabel"> <property name="visible">True</property> Modified: pytrainer/trunk/pytrainer/gui/drawArea.py =================================================================== --- pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-20 06:48:45 UTC (rev 394) +++ pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-22 09:18:26 UTC (rev 395) @@ -46,8 +46,6 @@ logging.debug("Type: "+type+" | title: "+str(title)+" | col: "+str(color)+" | xlabel: "+str(xlabel)+" | ylabel: "+str(ylabel)) if type == "bars": self.drawBars(xvalues,yvalues,xlabel,ylabel,title,color) - elif type == "stackedbars": - self.drawStackedBars(xvalues,yvalues,xlabel,ylabel,title) elif type == "plot": self.drawPlot(xvalues,yvalues,xlabel,ylabel,title,color,zones) elif type == "pie": @@ -128,6 +126,7 @@ #TODO tidy #Add totals to table? logging.debug('>>') + logging.debug("Title: %s", (title, )) self.removeVboxChildren() keys = yvalues.keys() numRows = len(keys) Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-20 06:48:45 UTC (rev 394) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2009-11-22 09:18:26 UTC (rev 395) @@ -18,6 +18,7 @@ import gobject import sys import logging +import datetime from SimpleGladeApp import * from popupmenu import PopupMenu @@ -113,7 +114,7 @@ self.drawareaheartrate = HeartRateGraph(self.heartrate_vbox, self.window1, self.heartrate_vbox2) #self.drawareaday = DayGraph(self.day_vbox, self.day_combovalue) self.day_vbox.hide() - self.drawareaweek = WeekGraph(self.weekview, self.window1) + self.drawareaweek = WeekGraph(self.weekview, self.window1, self.week_combovalue) self.drawareamonth = MonthGraph(self.month_vbox, self.window1, self.month_combovalue,self.month_combovalue2) self.drawareayear = YearGraph(self.year_vbox, self.window1, self.year_combovalue,self.year_combovalue2) @@ -339,6 +340,9 @@ def actualize_weekview(self, record_list, date_ini, date_end): logging.debug(">>") + date_s = datetime.datetime.strptime(date_ini, "%Y-%m-%d") + date_e = datetime.datetime.strptime(date_end, "%Y-%m-%d") + self.weekview_weekinfo.set_text("%s - %s" % (datetime.datetime.strftime(date_s, "%a %d %b"), datetime.datetime.strftime(date_e, "%a %d %b")) ) self.drawareaweek.drawgraph(record_list, date_ini, date_end) logging.debug("<<") @@ -731,6 +735,10 @@ logging.debug("--") self.parent.refreshGraphView(self.selected_view) + def on_week_combovalue_changed(self,widget): + logging.debug("--") + self.parent.refreshGraphView(self.selected_view) + def on_month_combovalue_changed(self,widget): logging.debug("--") self.parent.refreshGraphView(self.selected_view) Modified: pytrainer/trunk/pytrainer/lib/date.py =================================================================== --- pytrainer/trunk/pytrainer/lib/date.py 2009-11-20 06:48:45 UTC (rev 394) +++ pytrainer/trunk/pytrainer/lib/date.py 2009-11-22 09:18:26 UTC (rev 395) @@ -52,18 +52,23 @@ return "%0.4d-%0.2d-%0.2d" %(int(date[0]),int(date[1]),int(date[2])) def getWeekInterval(self,date, prf_us_system): + ''' Function to provide beginning and ending of the week that a certain day is in + Problems as python date functions do not respect locale (i.e. Sunday is always start of week????) + Note: %w gives weekday as a decimal number [0(Sunday),6(Saturday)]. + ''' if prf_us_system == "True": #Sunday is first day of week weekDate = datetime.datetime.strptime(date, "%Y-%m-%d") dayOfWeek = int(weekDate.strftime("%w")) - date_ini = weekDate + datetime.timedelta(days=0-dayOfWeek) - date_end = weekDate + datetime.timedelta(days=6-dayOfWeek) else: #Monday is first day of week weekDate = datetime.datetime.strptime(date, "%Y-%m-%d") dayOfWeek = int(weekDate.strftime("%w")) - date_ini = weekDate + datetime.timedelta(days=1-dayOfWeek) - date_end = weekDate + datetime.timedelta(days=7-dayOfWeek) + if dayOfWeek == 0: #Sunday, need to adjust + dayOfWeek = 7 + dayOfWeek -= 1 + date_ini = weekDate + datetime.timedelta(days=0-dayOfWeek) + date_end = weekDate + datetime.timedelta(days=6-dayOfWeek) return date_ini.strftime("%Y-%m-%d"), date_end.strftime("%Y-%m-%d") def getMonthInterval(self,date): Modified: pytrainer/trunk/pytrainer/weekgraph.py =================================================================== --- pytrainer/trunk/pytrainer/weekgraph.py 2009-11-20 06:48:45 UTC (rev 394) +++ pytrainer/trunk/pytrainer/weekgraph.py 2009-11-22 09:18:26 UTC (rev 395) @@ -21,12 +21,16 @@ import datetime class WeekGraph: - def __init__(self, vbox = None, window = None): + def __init__(self, vbox = None, window = None, combovalue = None): self.drawarea = DrawArea(vbox, window) + self.combovalue = combovalue def drawgraph(self,values, date_ini, date_end): logging.debug(">>") - #print "Found %d records" % len(values) + value_selected = self.combovalue.get_active() + if value_selected < 0: + self.combovalue.set_active(0) + value_selected = 0 logging.debug(str(values)) #build days list to ensure localised values are used. days = [] @@ -36,6 +40,8 @@ dateToUse = dateTemp + incrementDay days.append( dateToUse.strftime("%a") ) valueDict = {} + + #TODO Need to add time etc (currently distance only) for record in values: day = datetime.datetime.strptime(record[1], "%Y-%m-%d").strftime("%a") # Gives Sun, Mon etc for this record sport = record[0] @@ -48,10 +54,10 @@ else: #New sport valueDict[sport] = {day: distance} - xlab = "Day" - ylab = "kilometers" - tit = "Week View" - self.drawarea.stadistics("stackedbars",days,valueDict,xlab,ylab,tit) + xlabel = "Day" + ylabel = "kilometers" + title = "Week View" + self.drawarea.drawStackedBars(days,valueDict,xlabel,ylabel,title) logging.debug("<<") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-11-20 06:48:53
|
Revision: 394 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=394&view=rev Author: jblance Date: 2009-11-20 06:48:45 +0000 (Fri, 20 Nov 2009) Log Message: ----------- Fix for weekview, remove graph navigation bar Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/drawArea.py Modified: pytrainer/trunk/pytrainer/gui/drawArea.py =================================================================== --- pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-20 06:44:01 UTC (rev 393) +++ pytrainer/trunk/pytrainer/gui/drawArea.py 2009-11-20 06:48:45 UTC (rev 394) @@ -153,7 +153,7 @@ if xvalue in yvalues[key]: height = yvalues[key][xvalue] else: - height = 0.000000000001 + height = 0.0000000000000000001 yheights[index] = height cellText.append([self.fmt(x) for x in yheights]) axis.bar(xvals, yheights, bottom=ybottoms, width=width, color=color, align='edge', label=key) @@ -171,8 +171,8 @@ canvas = FigureCanvasGTK(figure) # a gtk.DrawingArea canvas.show() self.vbox.pack_start(canvas, True, True) - toolbar = NavigationToolbar(canvas, self.window) - self.vbox.pack_start(toolbar, False, False) + #toolbar = NavigationToolbar(canvas, self.window) + #self.vbox.pack_start(toolbar, False, False) for child in self.vbox.get_children(): logging.debug('Child available: '+str(child)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |