[Pkg-running-devel] [SCM] Debian package for pytrainer branch, upstream, updated. upstream/1.8.0-3-g7bb2413
Christian PERRIER
bubulle at debian.org
Sun Nov 13 12:59:14 UTC 2011
The following commit has been merged in the upstream branch:
commit 7bb24135097402fbb2dde763a38db39360d0242b
Author: Christian PERRIER <bubulle at debian.org>
Date: Sun Nov 13 13:59:09 2011 +0100
Merge upstream 1.8.0 (deleted files)
diff --git a/extensions/wordpress/googlemaps.py b/extensions/wordpress/googlemaps.py
deleted file mode 100644
index 8f43766..0000000
--- a/extensions/wordpress/googlemaps.py
+++ /dev/null
@@ -1,98 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-
-#Copyright (C) Fiz Vazquez vud1 at sindominio.net
-
-#This program is free software; you can redistribute it and/or
-#modify it under the terms of the GNU General Public License
-#as published by the Free Software Foundation; either version 2
-#of the License, or (at your option) any later version.
-
-#This program is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import os
-import re
-import sys
-import fileinput
-import shutil
-
-import pytrainer.lib.points as Points
-from pytrainer.lib.gpx import Gpx
-from pytrainer.lib.fileUtils import fileUtils
-
-
-def drawMap(gpxfile,key,htmlpath):
- #Not sure why need to process gpx file
- cachefile = "/tmp/gpx.txt"
- #trackdistance = 100
- #os.system("gpsbabel -t -i gpx -f %s -x position,distance=%sm -o gpx -F %s" %(gpxfile,trackdistance,cachefile))
- shutil.copy2(gpxfile, cachefile)
-
- # Test if file already contains gpxdata attribute
- found = False
- for line in fileinput.FileInput(cachefile,inplace=1):
- if "xmlns:gpxdata" in line:
- found = True
- print line.rstrip('\n');
- # If file don't has gpxdata attribute: add namespace
- if not found:
- for line in fileinput.FileInput(cachefile,inplace=1):
- if "xmlns:xsi" in line:
- line=line.replace('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"','xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gpxdata="http://www.cluetrust.com/XML/GPXDATA/1/0"')
- print line.rstrip('\n');
- gpx = Gpx("",cachefile)
- list_values = gpx.getTrackList()
- pointlist = []
- for i in list_values:
- pointlist.append((i[4],i[5]))
- points,levels = Points.encodePoints(pointlist)
- points = points.replace("\\","\\\\")
-
- createHtml(points,levels,pointlist[0],htmlpath,key)
-
-def createHtml(points,levels,init_point,htmlpath,key):
- 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 += " <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>\n"
- content += " <title>Google Maps JavaScript API Example</title>\n"
- content += " <script id=\"googleapiimport\" src=\"http://maps.google.com/maps?file=api&v=2&key=%s\"\n" %key
- content += " type=\"text/javascript\"></script>\n"
- content += " <script type=\"text/javascript\">\n"
- content += " //<![CDATA[\n"
- content += " function load() {\n"
- content += " if (GBrowserIsCompatible()) {\n"
- content += " var map = new GMap2(document.getElementById(\"map\"));\n"
- content += " map.addControl(new GLargeMapControl());\n"
- content += " map.addControl(new GMapTypeControl());\n"
- content += " map.setCenter(new GLatLng(%s,%s), 11);\n" %(init_point[0],init_point[1])
- content += " // Add an encoded polyline.\n"
- content += " var encodedPolyline = new GPolyline.fromEncoded({\n"
- content += " color: \"#3333cc\",\n"
- content += " weight: 10,\n"
- content += " points: \"%s\",\n" %points
- content += " levels: \"%s\",\n" %levels
- content += " zoomFactor: 32,\n"
- content += " numLevels: 4\n"
- content += " });\n"
- content += " map.addOverlay(encodedPolyline);\n"
- content += " }\n"
- content += " }\n "
- content += " //]]>\n"
- content += " </script>\n"
- content += " </head>\n"
- content += " <body onload=\"load()\" onunload=\"GUnload()\">\n"
- content += " <div id=\"map\" style=\"width: 460px; height: 460px\"></div>\n"
- content += " </body>\n"
- content += "</html>\n"
- file = fileUtils(htmlpath,content)
- file.run()
-
-
diff --git a/pytrainer/lib/heartrate.py b/pytrainer/lib/heartrate.py
deleted file mode 100644
index 91d1865..0000000
--- a/pytrainer/lib/heartrate.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-
-#Copyright (C) Fiz Vazquez vud1 at sindominio.net
-
-#This program is free software; you can redistribute it and/or
-#modify it under the terms of the GNU General Public License
-#as published by the Free Software Foundation; either version 2
-#of the License, or (at your option) any later version.
-
-#This program is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from system import checkConf
-from xmlUtils import XMLParser
-
-def getZones():
- conf = checkConf()
- filename = conf.getValue("conffile")
- configuration = XMLParser(filename)
- maxhr = int(configuration.getValue("pytraining","prf_maxhr"))
- resthr = int(configuration.getValue("pytraining","prf_minhr"))
-
- if configuration.getValue("pytraining","prf_hrzones_karvonen")=="True":
- #if karvonen method
- targethr1 = ((maxhr - resthr) * 0.50) + resthr
- targethr2 = ((maxhr - resthr) * 0.60) + resthr
- targethr3 = ((maxhr - resthr) * 0.70) + resthr
- targethr4 = ((maxhr - resthr) * 0.80) + resthr
- targethr5 = ((maxhr - resthr) * 0.90) + resthr
- targethr6 = maxhr
- else:
- #if not karvonen method
- targethr1 = maxhr * 0.50
- targethr2 = maxhr * 0.60
- targethr3 = maxhr * 0.70
- targethr4 = maxhr * 0.80
- targethr5 = maxhr * 0.90
- targethr6 = maxhr
-
- zone1 = (targethr1,targethr2,"#ffff99",_("Moderate activity"))
- zone2 = (targethr2,targethr3,"#ffcc00",_("Weight Control"))
- zone3 = (targethr3,targethr4,"#ff9900",_("Aerobic"))
- zone4 = (targethr4,targethr5,"#ff6600",_("Anaerobic"))
- zone5 = (targethr5,targethr6,"#ff0000",_("VO2 MAX"))
-
- return zone5,zone4,zone3,zone2,zone1
-
diff --git a/pytrainer/lib/soapUtils.py b/pytrainer/lib/soapUtils.py
deleted file mode 100644
index f461540..0000000
--- a/pytrainer/lib/soapUtils.py
+++ /dev/null
@@ -1,149 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-
-#Copyright (C) Fiz Vazquez vud1 at sindominio.net
-# vud1 at grupoikusnet.com
-# Jakinbidea & Grupo Ikusnet Developer
-
-#This program is free software; you can redistribute it and/or
-#modify it under the terms of the GNU General Public License
-#as published by the Free Software Foundation; either version 2
-#of the License, or (at your option) any later version.
-
-#This program is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import SOAPpy
-from pytrainer.lib.ddbb import DDBB
-from pytrainer.lib.xmlUtils import XMLParser
-from pytrainer.lib.system import checkConf
-
-from threading import Thread
-
-class webService(Thread):
- def __init__(self,data_path=None,onchangeAction = None,insertNewRecord=None):
- system = checkConf()
- self.data_path = data_path
- self.conffile = "%s/conf.xml" %system.getValue("confdir")
- self.server = SOAPpy.ThreadingSOAPServer(("localhost", 8081))
- #self.server = SOAPpy.server.InsecureServer(("localhost", 8081))
- self.server.registerFunction(self.getRecordInfo)
- self.server.registerFunction(self.addWaypoint)
- self.server.registerFunction(self.updateWaypoint)
- self.server.registerFunction(self.getWaypoints)
- self.server.registerFunction(self.test)
- self.server.registerFunction(self.newRecord)
- self.onchangeAction = onchangeAction
- self.insertNewRecord = insertNewRecord
- Thread.__init__ ( self )
-
- def getRecordInfo(self,id_record):
- configuration = XMLParser(self.conffile)
- ddbb = DDBB(configuration)
- ddbb.connect()
- recordinfo = ddbb.select("records,sports",
- "sports.name,date,distance,time,beats,comments,average,calories,id_record,title,upositive,unegative,maxspeed,maxpace,pace,maxbeats",
- "id_record=\"%s\" and records.sport=sports.id_sports" %id_record)
- record = recordinfo[0]
- info = {}
- info["sport"] = record[0]
- info["date"] = record[1]
- info["distance"] = record[2]
- info["time"] = record[3]
- info["beats"] = record[4]
- info["comments"] = record[5]
- info["average"] = record[6]
- info["calories"] = record[7]
- info["title"] = record[9]
- info["upositive"] = record[10]
- info["unegative"] = record[11]
- info["maxspeed"] = record[12]
- info["maxpace"] = record[13]
- info["pace"] = record[14]
- info["maxbeats"] = record[15]
- return info
-
- def newRecord(self,title=None,distance=None,time=None,upositive=None, unegative=None, bpm=None,calories=None, date=None, comment=None):
- #self.insertNewRecord(title,distance,time,upositive,unegative,bpm,calories,date,comment)
- #Pasar de la ventana.
- #meter el registro en la bbdd y reiniciar la interfaz
- from pytrainer.lib.ddbb import DDBB
- from pytrainer.lib.xmlUtils import XMLParser
- from pytrainer.lib.system import checkConf
- conf = checkConf()
- filename = conf.getValue("conffile")
- configuration = XMLParser(filename)
- ddbb = DDBB(configuration)
- ddbb.connect()
- cells= "date,sport,distance,time,beats,comments,average,calories,title,upositive,unegative"
- values=[date,1,distance,time,bpm,comment,float(distance)/(float(time)/3600),calories,title,upositive,unegative]
- ddbb.insert("records",cells,values)
- return ddbb.lastRecord("records")
-
- def addWaypoint(self,lon=None,lat=None,name=None,comment=None,sym=None):
- configuration = XMLParser(self.conffile)
- ddbb = DDBB(configuration)
- ddbb.connect()
- cells = "lat,lon,comment,name,sym"
- values = (lat,lon,comment,name,sym)
- ddbb.insert("waypoints",cells,values)
- self.onchangeAction(False,0)
- return ddbb.lastRecord("waypoints")
-
- def getWaypoints(self):
- configuration = XMLParser(self.conffile)
- ddbb = DDBB(configuration)
- ddbb.connect()
- cells = "lat,lon,comment,name,sym"
- return ddbb.select("waypoints","lat,lon,ele,comment,time,name,sym","1=1 order by name")
-
- def updateWaypoint(self,lon=None,lat=None,name=None,comment=None,sym=None,id_waypoint=None):
- if id_waypoint==None:
- return "NACK"
- c = []
- v = []
- values = []
- if lat:
- c.append("lat")
- values.append(lat)
- if lon:
- c.append("lon")
- values.append(lon)
- if comment:
- c.append("comment")
- values.append(comment)
- if sym:
- c.append("sym")
- values.append("sym")
- cells = ""
- count=0
- for i in c:
- if count==1:
- cells +=","
- cells += "%s"%i
- count=1
-
- configuration = XMLParser(self.conffile)
- ddbb = DDBB(configuration)
- ddbb.connect()
- ddbb.update("waypoints",cells,values," id_waypoint=%d" %int(id_waypoint))
- self.onchangeAction(False,0)
- return "ACK"
-
- def test(self,lon=None,lat=None):
- print "Llamando al soap"
- return "Hello world!"
-
- def run(self):
- self.server.serve_forever()
-
- def stop(self):
- self._Thread__stop()
- self.server.server_close()
-
-
diff --git a/pytrainer/lib/system.py b/pytrainer/lib/system.py
deleted file mode 100644
index c88a48c..0000000
--- a/pytrainer/lib/system.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-
-#Copyright (C) Fiz Vazquez vud1 at sindominio.net
-
-#This program is free software; you can redistribute it and/or
-#modify it under the terms of the GNU General Public License
-#as published by the Free Software Foundation; either version 2
-#of the License, or (at your option) any later version.
-
-#This program is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with this program; if not, write to the Free Software
-#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import os
-import sys
-
-class checkConf:
- def __init__(self):
- self.home = None
- self.tmpdir = None
- self.confdir = None
- self.conffile = None
- self.gpxdir = None
- self.extensiondir = None
- self.plugindir = None
-
- self._setHome()
- self._setConfFiles()
- self._setTempDir()
- self._setExtensionDir()
- self._setPluginDir()
- self._setGpxDir()
-
- def _setHome(self):
- if sys.platform == "linux2":
- variable = 'HOME'
- elif sys.platform == "win32":
- variable = 'USERPROFILE'
- else:
- print "Unsupported sys.platform: %s." % sys.platform
- sys.exit(1)
- self.home = os.environ[variable]
-
- def _setTempDir(self):
- self.tmpdir = self.confdir+"/tmp"
- if not os.path.isdir(self.tmpdir):
- os.mkdir(self.tmpdir)
-
- def clearTempDir(self):
- """Function to clear out the tmp directory that pytrainer uses
- will only remove files
- """
- if not os.path.isdir(self.tmpdir):
- return
- else:
- files = os.listdir(self.tmpdir)
- for name in files:
- fullname = (os.path.join(self.tmpdir, name))
- if os.path.isfile(fullname):
- os.remove(os.path.join(self.tmpdir, name))
-
- def _setConfFiles(self):
- if sys.platform == "win32":
- self.confdir = self.home+"/pytrainer"
- elif sys.platform == "linux2":
- self.confdir = self.home+"/.pytrainer"
- else:
- print "Unsupported sys.platform: %s." % sys.platform
- sys.exit(1)
- self.conffile = self.confdir+"/conf.xml"
- if not os.path.isdir(self.confdir):
- os.mkdir(self.confdir)
-
- def _setGpxDir(self):
- self.gpxdir = self.confdir+"/gpx"
- if not os.path.isdir(self.gpxdir):
- os.mkdir(self.gpxdir)
-
- def _setExtensionDir(self):
- self.extensiondir = self.confdir+"/extensions"
- if not os.path.isdir(self.extensiondir):
- os.mkdir(self.extensiondir)
-
- def _setPluginDir(self):
- self.plugindir = self.confdir+"/plugins"
- if not os.path.isdir(self.plugindir):
- os.mkdir(self.plugindir)
-
- def getConfFile(self):
- if not os.path.isfile(self.conffile):
- return False
- else:
- return self.conffile
-
- def getValue(self,variable):
- method = getattr(self, variable)
- return method
--
Debian package for pytrainer
More information about the Pkg-running-devel
mailing list