From: <jb...@us...> - 2010-01-17 05:47:49
|
Revision: 485 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=485&view=rev Author: jblance Date: 2010-01-17 05:47:42 +0000 (Sun, 17 Jan 2010) Log Message: ----------- More comments and disabling of unused code Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/ddbb.py pytrainer/trunk/pytrainer/lib/sqliteUtils.py pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/record.py Modified: pytrainer/trunk/pytrainer/lib/ddbb.py =================================================================== --- pytrainer/trunk/pytrainer/lib/ddbb.py 2010-01-17 04:50:44 UTC (rev 484) +++ pytrainer/trunk/pytrainer/lib/ddbb.py 2010-01-17 05:47:42 UTC (rev 485) @@ -28,7 +28,7 @@ class DDBB: def __init__(self, configuration): self.ddbb_type = configuration.getValue("pytraining","prf_ddbb") - if self.ddbb_type == "mysql": + if self.ddbb_type == "mysql": #TODO no longer supported? from mysqlUtils import Sql else: from sqliteUtils import Sql @@ -44,9 +44,9 @@ self.ddbbObject = Sql(ddbb_host,ddbb,ddbb_user,ddbb_pass) def connect(self): - #si devolvemos 1 ha ido todo con exito - #con 0 es que no estaba la bbdd creada - #con -1 imposible conectar a la maquina. + #si devolvemos 1 ha ido todo con exito : return 1 if all successful + #con 0 es que no estaba la bbdd creada : 0 is DB not created + #con -1 imposible conectar a la maquina. : -1 is impossible to connect to the host var = self.ddbbObject.connect() if var == 0: self.ddbbObject.createDDBB() @@ -202,12 +202,12 @@ logging.error('Column date_time_utc already exists in DB. Printing traceback and continuing') traceback.print_exc()''' - def shortFromLocal(self, getSport=True): # Check LEFT and RIGHT JOINS for people with multiple sports - if getSport is True: + #def shortFromLocal(self, getSport=True): # Check LEFT and RIGHT JOINS for people with multiple sports + '''if getSport is True: sql = "select sports.name,records.date_time_utc from sports INNER JOIN records ON sports.id_sports = records.sport" else: sql = "select records.date_time_utc from sports INNER JOIN records ON sports.id_sports = records.sport" - return self.ddbbObject.freeExec(sql) + return self.ddbbObject.freeExec(sql)''' def checkDBIntegrity(self): """17.11.2009 - dgranda Modified: pytrainer/trunk/pytrainer/lib/sqliteUtils.py =================================================================== --- pytrainer/trunk/pytrainer/lib/sqliteUtils.py 2010-01-17 04:50:44 UTC (rev 484) +++ pytrainer/trunk/pytrainer/lib/sqliteUtils.py 2010-01-17 05:47:42 UTC (rev 485) @@ -19,7 +19,7 @@ #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import logging -import sys +import sys, traceback try: from sqlite3 import dbapi2 as sqlite except ImportError: @@ -269,5 +269,5 @@ self.freeExec(sql) except: logging.error('Not able to add/change column '+columnName+' to table '+tableName) - #traceback.print_exc() + traceback.print_exc() Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-01-17 04:50:44 UTC (rev 484) +++ pytrainer/trunk/pytrainer/main.py 2010-01-17 05:47:42 UTC (rev 485) @@ -101,7 +101,7 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.7.0_svn#484" + self.version ="1.7.0_svn#485" self.DB_version = 1 self.date = Date() # Checking profile @@ -117,17 +117,17 @@ self.windowmain = None logging.debug('checking configuration...') - self.conf = checkConf() + self.conf = checkConf() #TODO set this up so other modules can reference this and not have to duplicate this logging.debug("clearing tmp directory %s" % self.conf.getValue("tmpdir")) self.conf.clearTempDir() self.filename = self.conf.getValue("conffile") logging.debug('retrieving data from '+ self.filename) - self.configuration = XMLParser(self.filename) + self.configuration = XMLParser(self.filename) #TODO set this up so other modules can reference this and not have to duplicate this 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) + self.ddbb = DDBB(self.configuration) #TODO set this up so other modules can reference this and not have to duplicate this logging.debug('connecting to DDBB') self.ddbb.connect() @@ -151,6 +151,7 @@ self.date = Date(self.windowmain.calendar) #Preparamos el webservice + #TODO check reason for webservice - remove / change to optional start if not needed gtk.gdk.threads_init() self.webservice = webService(data_path,self.refreshWaypointView,self.newRecord) self.webservice.start() @@ -465,7 +466,7 @@ self.configuration.setValue("pytraining","DB_version", str(self.DB_version)) logging.debug('<<') - #def addDateTimeUTC(self): + #def addDateTimeUTC(self): #TODO remove """12.07.2008 - dgranda Adds date_time (UTC format) for each record (new column date_time_utc in table records). New in version 1.6.0.1 args: none @@ -494,7 +495,7 @@ logging.info('Updated '+str(num)+' entries') logging.debug('<<')''' - #def checkPacesDB(self): + #def checkPacesDB(self): #TODO remove """19.07.2008 - dgranda Updates paces in DB (maxspeed<->maxpace | average<->pace). New in version 1.6.0.2 args: none Modified: pytrainer/trunk/pytrainer/record.py =================================================================== --- pytrainer/trunk/pytrainer/record.py 2010-01-17 04:50:44 UTC (rev 484) +++ pytrainer/trunk/pytrainer/record.py 2010-01-17 05:47:42 UTC (rev 485) @@ -38,13 +38,13 @@ logging.debug('setting date...') self.date = Date() logging.debug('Checking current configuration...') - self.conf = checkConf() - self.filename = self.conf.getValue("conffile") - logging.debug('Retrieving data from '+ self.filename) - self.configuration = XMLParser(self.filename) - self.ddbb = DDBB(self.configuration) - logging.debug('connecting to DDBB') - self.ddbb.connect() + self.conf = checkConf() #TODO change to reference main versions of these + self.filename = self.conf.getValue("conffile") # + logging.debug('Retrieving data from '+ self.filename) # + self.configuration = XMLParser(self.filename) # + self.ddbb = DDBB(self.configuration) # + logging.debug('connecting to DDBB') # + self.ddbb.connect() # logging.debug('<<') def newRecord(self, list_sport, date, title=None, distance=None, time=None, upositive=None, unegative=None, bpm=None, calories=None, comment=None): @@ -67,7 +67,7 @@ self.recordwindow.run() logging.debug('<<') - def removeRecord(self,id_record): + def removeRecord(self,id_record): #TODO remember to update once laps are in DB logging.debug('>>') record = self.ddbb.delete("records", "id_record=\"%s\"" %id_record) logging.debug('removed record '+str(id_record)+' from bbdd') @@ -164,7 +164,7 @@ logging.debug('<<') return self.ddbb.lastRecord("records") - def insertNewRecord(self, gpxOrig, entry): + def insertNewRecord(self, gpxOrig, entry): #TODO consolidate with insertRecord """29.03.2008 - dgranda Moves GPX file to store destination and updates database args: path to source GPX file""" @@ -299,7 +299,7 @@ sport_id = self.ddbb.select("sports","id_sports","name=\"%s\"" %(sport))[0][0] except: logging.error('Error retrieving id_sports from '+ str(sport)) - #traceback.print_last() + traceback.print_last() if add is None: logging.debug('Sport '+str(sport)+' will not be added to DB') else: @@ -355,7 +355,7 @@ logging.debug('<<') return day_list - def actualize_fromgpx(self,gpxfile): + def actualize_fromgpx(self,gpxfile): #TODO remove? - should never have multiple tracks per GPX file logging.debug('>>') logging.debug('loading file: '+gpxfile) gpx = Gpx(self.data_path,gpxfile) @@ -404,7 +404,7 @@ self._actualize_fromgpx(gpx) logging.debug('<<') - def _select_trkfromgpx(self,gpxfile,tracks): + def _select_trkfromgpx(self,gpxfile,tracks): #TODO remove? - should never have multiple tracks per GPX file logging.debug('>>') logging.debug('Track dialog '+ self.data_path +'|'+ gpxfile) selectrckdialog = DialogSelectTrack(self.data_path, tracks,self.__actualize_fromgpx, gpxfile) @@ -412,7 +412,7 @@ selectrckdialog.run() logging.debug('<<') - def newGpxRecord(self,gpxfile,list_sport): + def newGpxRecord(self,gpxfile,list_sport): #TODO Not used? logging.debug('>>') logging.debug("opening a new window record "+self.data_path+'|'+gpxfile+'|'+str(list_sport)) self.recordwindow = WindowRecord(self.data_path, list_sport,self, None) @@ -440,7 +440,7 @@ logging.info("Entry %d has been added" % entry_id) logging.debug('<<') - #def importFromGTRNCTR(self,gtrnctrFile): + #def importFromGTRNCTR(self,gtrnctrFile): #TODO remove """22.03.2008 - dgranda Retrieves sport, date and start time from each entry coming from GPS and compares with what is stored locally, just to import new entries @@ -472,7 +472,7 @@ logging.debug('<<') """ - #def shortFromLocal(self): + #def shortFromLocal(self): #TODO remove """25.03.2008 - dgranda Retrieves sport, date and start time from each entry stored locally 12.07.2008 - dgranda - Added id_record for each one @@ -497,7 +497,7 @@ logging.debug('<<') return listTracksGPX''' - #def shortFromLocalDB(self, getSport=True): + #def shortFromLocalDB(self, getSport=True): #TODO remove """12.07.2008 - dgranda Retrieves sport, date and start time from local database returns: list with lists: SPORT|DATE_START_TIME""" @@ -518,19 +518,19 @@ logging.debug('<<') return listTracksGPX''' - #def removeSportFromList(self, list1): + #def removeSportFromList(self, list1): #TODO remove '''resultList = [] for entry in list1: resultList.append(entry[1]) return resultList''' - #def compareLists(self,list1,list2): + #def compareLists(self,list1,list2): #TODO remove '''# Optimizing comparison - 26042008 # http://mail.python.org/pipermail/python-list/2002-May/141458.html tempDict = dict(zip(list1,list1)) return [x for x in list2 if x not in tempDict]''' - #def compareTracks(self,listTracksGPS,listTracksLocal,checkSport=True): + #def compareTracks(self,listTracksGPS,listTracksLocal,checkSport=True): #TODO remove """22.03.2008 - dgranda Compares tracks retrieved from GPS with already locally stored args: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |