From: <jb...@us...> - 2010-11-23 01:51:24
|
Revision: 729 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=729&view=rev Author: jblance Date: 2010-11-23 01:51:18 +0000 (Tue, 23 Nov 2010) Log Message: ----------- Fix summary screens to update correctly with record add and deletes Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/popupmenu.py pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/gui/popupmenu.py =================================================================== --- pytrainer/trunk/pytrainer/gui/popupmenu.py 2010-11-23 01:45:14 UTC (rev 728) +++ pytrainer/trunk/pytrainer/gui/popupmenu.py 2010-11-23 01:51:18 UTC (rev 729) @@ -31,7 +31,7 @@ self.popup.popup( None, None, None, event_button, time) def on_editrecord_activate(self,widget): - self.parent.parent.editRecord(self.id_record, self.parent.selected_view) + self.parent.parent.editRecord(self.id_record, view=self.parent.selected_view) def on_showclassic_activate(self,widget): self.parent.classicview_item.set_active(True) @@ -40,4 +40,4 @@ self.parent.parent.refreshGraphView("record") def on_remove_activate(self,widget): - self.parent.parent.removeRecord(self.id_record) + self.parent.parent.removeRecord(self.id_record, view=self.parent.selected_view) Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2010-11-23 01:45:14 UTC (rev 728) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2010-11-23 01:51:18 UTC (rev 729) @@ -1429,7 +1429,7 @@ #print 'New athlete' self.on_athleteTreeView_edit( None, None) else: - self.parent.newRecord() + self.parent.newRecord(view=self.selected_view) def on_edituser_activate(self,widget): self.parent.editProfile() Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-23 01:45:14 UTC (rev 728) +++ pytrainer/trunk/pytrainer/main.py 2010-11-23 01:51:18 UTC (rev 729) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#728" + self.version ="1.7.2_svn#729" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() @@ -404,13 +404,15 @@ self.windowmain.addExtension(txtbutton) logging.debug('<<') - def newRecord(self,title=None,distance=None,time=None,upositive=None,unegative=None,bpm=None,calories=None,date=None,comment=None): + def newRecord(self,title=None,distance=None,time=None,upositive=None,unegative=None,bpm=None,calories=None,date=None,comment=None,view=None): logging.debug('>>') list_sport = self.profile.getSportList() if date == None: date = self.date.getDate() self.record.newRecord(list_sport, date, title, distance, time, upositive, unegative, bpm, calories, comment) self.refreshListRecords() + if view is not None: + self.refreshGraphView(view) logging.debug('<<') def editRecord(self, id_record, view=None): @@ -423,7 +425,7 @@ self.refreshGraphView(view) logging.debug('<<') - def removeRecord(self, id_record, confirm = False): + def removeRecord(self, id_record, confirm = False, view=None): logging.debug('>>') if confirm: self.record.removeRecord(id_record) @@ -434,6 +436,8 @@ warning.set_text(msg) warning.run() self.refreshListRecords() + if view is not None: + self.refreshGraphView(view) logging.debug('<<') def removeWaypoint(self,id_waypoint, confirm = False): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-11-23 21:12:13
|
Revision: 731 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=731&view=rev Author: jblance Date: 2010-11-23 21:12:07 +0000 (Tue, 23 Nov 2010) Log Message: ----------- Fix athlete view and edit 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 2010-11-23 20:34:28 UTC (rev 730) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2010-11-23 21:12:07 UTC (rev 731) @@ -1462,7 +1462,7 @@ self.selected_view="month" elif page == 4: self.selected_view="year" - elif page == 6: + elif page == 5: self.selected_view="athlete" else: self.selected_view="record" Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-23 20:34:28 UTC (rev 730) +++ pytrainer/trunk/pytrainer/main.py 2010-11-23 21:12:07 UTC (rev 731) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#730" + self.version ="1.7.2_svn#731" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-11-24 02:21:06
|
Revision: 733 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=733&view=rev Author: jblance Date: 2010-11-24 02:21:00 +0000 (Wed, 24 Nov 2010) Log Message: ----------- Grid lines for graph functionality (to match old graphing) Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/drawGraph.py pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/lib/activity.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/gui/drawGraph.py =================================================================== --- pytrainer/trunk/pytrainer/gui/drawGraph.py 2010-11-23 21:56:40 UTC (rev 732) +++ pytrainer/trunk/pytrainer/gui/drawGraph.py 2010-11-24 02:21:00 UTC (rev 733) @@ -35,7 +35,7 @@ self.ax2 = None logging.debug('<<') - def draw(self, datalist = None, box = None, figure = None, title = None, y2 = False): + def draw(self, datalist=None, box=None, figure=None, title=None, y2=False, xgrid=False, ygrid=False): ''' Draw a graph using supplied information into supplied gtk.box @@ -80,6 +80,12 @@ plt.xlabel(datalist.xlabel) if title is not None: plt.title(title) + #Display grid + if y2 and ygrid: + self.ax2.grid(True) + elif self.ax1 and ygrid: + self.ax1.grid(True) + plt.gca().xaxis.grid(xgrid) #Removed as now in legend #plt.ylabel(datalist.ylabel) @@ -190,10 +196,10 @@ for item in activity.distance_data: if activity.distance_data[item].show_on_y1: y1count += 1 - figure = self.draw(activity.distance_data[item], box=box, figure=figure, title=_title) + figure = self.draw(activity.distance_data[item], box=box, figure=figure, title=_title, xgrid=activity.x_grid, ygrid=activity.y1_grid) if activity.distance_data[item].show_on_y2: y2count += 1 - figure = self.draw(activity.distance_data[item], box=box, figure=figure, title=_title, y2=True) + figure = self.draw(activity.distance_data[item], box=box, figure=figure, title=_title, y2=True, xgrid=activity.x_grid, ygrid=activity.y2_grid) #Display lap divisions if required if activity.show_laps: figure = self.draw(activity.lap_distance, box=box, figure=figure) @@ -207,10 +213,10 @@ for item in activity.time_data: if activity.time_data[item].show_on_y1: y1count += 1 - figure = self.draw(activity.time_data[item], box=box, figure=figure, title=_title) + figure = self.draw(activity.time_data[item], box=box, figure=figure, title=_title, xgrid=activity.x_grid, ygrid=activity.y1_grid) if activity.time_data[item].show_on_y2: y2count += 1 - figure = self.draw(activity.time_data[item], box=box, figure=figure, title=_title, y2=True) + figure = self.draw(activity.time_data[item], box=box, figure=figure, title=_title, y2=True, xgrid=activity.x_grid, ygrid=activity.y2_grid) #Display lap divisions if required if activity.show_laps: figure = self.draw(activity.lap_time, box=box, figure=figure) Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2010-11-23 21:56:40 UTC (rev 732) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2010-11-24 02:21:00 UTC (rev 733) @@ -362,6 +362,7 @@ self.hbox30.show() #Hide new graph details self.graph_data_hbox.hide() + self.hboxGraphOptions.hide() #Enable graph self.record_vbox.set_sensitive(1) self.drawarearecord.drawgraph(self.record_list,self.laps) @@ -392,20 +393,32 @@ xdistancebutton = gtk.RadioButton(label=_("Distance")) xtimebutton = gtk.RadioButton(group=xdistancebutton, label=_("Time")) xlapsbutton = gtk.CheckButton(label=_("Laps")) + y1gridbutton = gtk.CheckButton(label=_("Left Axis Grid")) + y2gridbutton = gtk.CheckButton(label=_("Right Axis Grid")) + xgridbutton = gtk.CheckButton(label=_("X Axis Grid")) #Set state of buttons if activity.x_axis == "distance": xdistancebutton.set_active(True) elif activity.x_axis == "time": xtimebutton.set_active(True) xlapsbutton.set_active(activity.show_laps) + y1gridbutton.set_active(activity.y1_grid) + y2gridbutton.set_active(activity.y2_grid) + xgridbutton.set_active(activity.x_grid) #Connect handlers to buttons xdistancebutton.connect("toggled", self.on_xaxischange, "distance", activity) xtimebutton.connect("toggled", self.on_xaxischange, "time", activity) xlapsbutton.connect("toggled", self.on_xlapschange, activity) + y1gridbutton.connect("toggled", self.on_gridchange, "y1", activity) + y2gridbutton.connect("toggled", self.on_gridchange, "y2", activity) + xgridbutton.connect("toggled", self.on_gridchange, "x", activity) #Add buttons to frame xvbox.pack_start(xdistancebutton, expand=False) xvbox.pack_start(xtimebutton, expand=False) xvbox.pack_start(xlapsbutton, expand=False) + xvbox.pack_start(y1gridbutton, expand=False) + xvbox.pack_start(y2gridbutton, expand=False) + xvbox.pack_start(xgridbutton, expand=False) xFrame.add(xvbox) #Populate axis limits frame @@ -521,8 +534,8 @@ self.graph_data_hbox.pack_start(y1Frame, expand=False, fill=False, padding=5) self.graph_data_hbox.pack_start(y2Frame, expand=False, fill=False, padding=5) self.graph_data_hbox.pack_start(limitsFrame, expand=False, fill=True, padding=5) - self.graph_data_hbox.show_all() - self.buttonGraphShowOptions.hide() + #self.graph_data_hbox.show_all() + self.hboxGraphOptions.show_all() act = self.grapher.drawActivityGraph(activity=activity, box=self.record_graph_vbox) if act.x_limits_u[0] is not None: xmin, xmax = act.x_limits_u @@ -546,7 +559,8 @@ if y2min is not None and y2max is not None: y2minlabel.set_text(str(y2min)) y2maxlabel.set_text(str(y2max)) - + + #Default to showing options self.buttonGraphShowOptions.hide() self.scrolledwindowGraphOptions.show() @@ -557,6 +571,7 @@ self.hbox30.show() #Hide new graph details self.graph_data_hbox.hide() + self.hboxGraphOptions.hide() #Remove graph vboxChildren = self.record_graph_vbox.get_children() logging.debug('Vbox has %d children %s' % (len(vboxChildren), str(vboxChildren) )) @@ -1250,6 +1265,16 @@ else: activity.show_laps = False self.actualize_recordgraph(activity) + + def on_gridchange(self, widget, axis=None, activity=None): + '''Handler for record graph grid selection changes''' + if axis == 'y1': + activity.y1_grid = not activity.y1_grid + elif axis == 'y2': + activity.y2_grid = not activity.y2_grid + elif axis == 'x': + activity.x_grid = not activity.x_grid + self.actualize_recordgraph(activity) def on_y1colorchange(self, widget, box, graphdata, activity): '''Hander for changes to y1 color selection''' Modified: pytrainer/trunk/pytrainer/lib/activity.py =================================================================== --- pytrainer/trunk/pytrainer/lib/activity.py 2010-11-23 21:56:40 UTC (rev 732) +++ pytrainer/trunk/pytrainer/lib/activity.py 2010-11-24 02:21:00 UTC (rev 733) @@ -126,6 +126,9 @@ self.x_limits_u = (None, None) self.y1_limits_u = (None, None) self.y2_limits_u = (None, None) + self.y1_grid = False + self.y2_grid = False + self.x_grid = False self.show_laps = False logging.debug("<<") Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-23 21:56:40 UTC (rev 732) +++ pytrainer/trunk/pytrainer/main.py 2010-11-24 02:21:00 UTC (rev 733) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#731" + self.version ="1.7.2_svn#733" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-11-24 02:26:50
|
Revision: 734 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=734&view=rev Author: jblance Date: 2010-11-24 02:26:44 +0000 (Wed, 24 Nov 2010) Log Message: ----------- Display heartrate as integer in day, week, month and year views 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 2010-11-24 02:21:00 UTC (rev 733) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2010-11-24 02:26:44 UTC (rev 734) @@ -607,8 +607,8 @@ self.record_zone5.set_text("%s-%s" %(zones[0][0],zones[0][1])) beats = activity.beats maxbeats = activity.maxbeats - self.record_beats.set_text("%0.2f" %beats) - self.record_maxbeats.set_text("%0.2f" %maxbeats) + self.record_beats.set_text("%0.0f" %beats) + self.record_maxbeats.set_text("%0.0f" %maxbeats) self.record_calories2.set_text("%0.0f" %activity.calories) if is_karvonen_method=="True": self.record_zonesmethod.set_text(_("Karvonen method")) @@ -676,10 +676,10 @@ self.day_minute.set_text("%02d" %min) self.day_second.set_text("%02d" %sec) if tbeats: - self.day_beats.set_text("%0.2f" %tbeats) + self.day_beats.set_text("%0.0f" %tbeats) else: self.day_beats.set_text("") - self.day_maxbeats.set_text("%0.2f" %maxbeats) + self.day_maxbeats.set_text("%0.0f" %maxbeats) if average: self.day_average.set_text("%0.2f" %average) else: @@ -796,8 +796,8 @@ self.weeka_hour.set_text("%d" %hour) 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_maxbeats.set_text("%0.0f" %(maxbeats)) + self.weeka_beats.set_text("%0.0f" %(tbeats)) self.weeka_average.set_text("%0.2f" %average) self.weeka_maxspeed.set_text("%0.2f" %maxspeed) self.weeka_pace.set_text(pace) @@ -874,8 +874,8 @@ self.montha_hour.set_text("%d" %hour) 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_maxbeats.set_text("%0.0f" %(maxbeats)) + self.montha_beats.set_text("%0.0f" %(tbeats)) self.montha_average.set_text("%0.2f" %average) self.montha_maxspeed.set_text("%0.2f" %maxspeed) self.montha_pace.set_text(pace) @@ -937,8 +937,8 @@ self.yeara_hour.set_text("%d" %hour) 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_beats.set_text("%0.0f" %tbeats) + self.yeara_maxbeats.set_text("%0.0f" %(maxbeats)) self.yeara_average.set_text("%0.2f" %average) self.yeara_maxspeed.set_text("%0.2f" %maxspeed) self.yeara_pace.set_text(pace) Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-24 02:21:00 UTC (rev 733) +++ pytrainer/trunk/pytrainer/main.py 2010-11-24 02:26:44 UTC (rev 734) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#733" + self.version ="1.7.2_svn#734" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-11-24 02:31:55
|
Revision: 735 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=735&view=rev Author: jblance Date: 2010-11-24 02:31:49 +0000 (Wed, 24 Nov 2010) Log Message: ----------- Fix sort of listview Modified Paths: -------------- pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/record.py Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-24 02:26:44 UTC (rev 734) +++ pytrainer/trunk/pytrainer/main.py 2010-11-24 02:31:49 UTC (rev 735) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#734" + self.version ="1.7.2_svn#735" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() Modified: pytrainer/trunk/pytrainer/record.py =================================================================== --- pytrainer/trunk/pytrainer/record.py 2010-11-24 02:26:44 UTC (rev 734) +++ pytrainer/trunk/pytrainer/record.py 2010-11-24 02:31:49 UTC (rev 735) @@ -477,7 +477,7 @@ logging.debug("condition: %s" % condition) return self.pytrainer_main.ddbb.select("records,sports", "date,distance,average,title,sports.name,id_record,time,beats,calories", - "sports.id_sports = records.sport and %s" %condition) + "sports.id_sports = records.sport and %s order by date desc" %condition) def getRecordDayList(self,date, id_sport=None): logging.debug('>>') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-11-24 02:51:37
|
Revision: 736 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=736&view=rev Author: jblance Date: 2010-11-24 02:51:29 +0000 (Wed, 24 Nov 2010) Log Message: ----------- Update DB check to ensure time == duration Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/ddbb.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/lib/ddbb.py =================================================================== --- pytrainer/trunk/pytrainer/lib/ddbb.py 2010-11-24 02:31:49 UTC (rev 735) +++ pytrainer/trunk/pytrainer/lib/ddbb.py 2010-11-24 02:51:29 UTC (rev 736) @@ -363,17 +363,20 @@ only for empty durations and where time can be parsed as an int ''' logging.debug('--') - listOfRecords = self.select_dict("records",('id_record','time'), "duration is NULL") - logging.debug("Found %d records in DB without date_time_local field populated" % (len(listOfRecords) ) ) + #listOfRecords = self.select_dict("records",('id_record','time'), "duration is NULL") + #logging.debug("Found %d records in DB without date_time_local field populated" % (len(listOfRecords) ) ) + listOfRecords = self.select_dict("records",('id_record','time', 'duration')) + logging.debug("Found %d records in DB" % (len(listOfRecords) ) ) for record in listOfRecords: try: duration = int(record['time']) except Exception as e: logging.info( "Error parsing time (%s) as int for record_id: %s" % (record['time'], record['id_record'])) continue - logging.debug("setting record %s duration to %d" % (record['id_record'], duration)) - data = {'duration': duration} - self.update_dict("records",data ,"id_record = %d"%record['id_record']) + if duration != record['duration']: + logging.debug("setting record %s duration to %d" % (record['id_record'], duration)) + data = {'duration': duration} + self.update_dict("records",data ,"id_record = %d"%record['id_record']) def populate_date_time_local(self): ''' Populate date_time_local and date from date_time_utc Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-24 02:31:49 UTC (rev 735) +++ pytrainer/trunk/pytrainer/main.py 2010-11-24 02:51:29 UTC (rev 736) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#735" + self.version ="1.7.2_svn#736" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aza...@us...> - 2010-11-24 07:45:15
|
Revision: 738 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=738&view=rev Author: azapletal Date: 2010-11-24 07:45:09 +0000 (Wed, 24 Nov 2010) Log Message: ----------- Re-introduced uc usage in windowrecord. Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/windowrecord.py pytrainer/trunk/pytrainer/lib/uc.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/gui/windowrecord.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowrecord.py 2010-11-24 02:57:23 UTC (rev 737) +++ pytrainer/trunk/pytrainer/gui/windowrecord.py 2010-11-24 07:45:09 UTC (rev 738) @@ -257,18 +257,18 @@ trackSummary = {} list_options["rcd_date"] = self.rcd_date.get_text() list_options["rcd_sport"] = self.rcd_sport.get_active_text() - list_options["rcd_distance"] = self.rcd_distance.get_text() + list_options["rcd_distance"] = self.uc.usr2sys_str('distance', self.rcd_distance.get_text()) list_options["rcd_beats"] = self.rcd_beats.get_text() - list_options["rcd_average"] = self.rcd_average.get_text() + list_options["rcd_average"] = self.uc.usr2sys_str('speed',self.rcd_average.get_text()) list_options["rcd_calories"] = self.rcd_calories.get_text() list_options["rcd_title"] = self.rcd_title.get_text().replace("\"","'") list_options["rcd_gpxfile"] = self.rcd_gpxfile.get_text() - list_options["rcd_upositive"] = self.rcd_upositive.get_text() - list_options["rcd_unegative"] = self.rcd_unegative.get_text() + list_options["rcd_upositive"] = self.uc.usr2sys_str('height',self.rcd_upositive.get_text()) + list_options["rcd_unegative"] = self.uc.usr2sys_str('height',self.rcd_unegative.get_text()) list_options["rcd_maxbeats"] = self.rcd_maxbeats.get_text() list_options["rcd_pace"] = self.rcd_pace.get_text() list_options["rcd_maxpace"] = self.rcd_maxpace.get_text() - list_options["rcd_maxvel"] = self.rcd_maxvel.get_text() + list_options["rcd_maxvel"] = self.uc.usr2sys_str('speed',self.rcd_maxvel.get_text()) list_options["rcd_time"] = [self.rcd_hour.get_value_as_int(),self.rcd_min.get_value_as_int(),self.rcd_second.get_value_as_int()] buffer = self.rcd_comments.get_buffer() start,end = buffer.get_bounds() Modified: pytrainer/trunk/pytrainer/lib/uc.py =================================================================== --- pytrainer/trunk/pytrainer/lib/uc.py 2010-11-24 02:57:23 UTC (rev 737) +++ pytrainer/trunk/pytrainer/lib/uc.py 2010-11-24 07:45:09 UTC (rev 738) @@ -79,6 +79,17 @@ else: return _val + def usr2sys_str(self, quantity, val_str): + """ Similar to usr2sys but I/O is string representing a float""" + if not self.us: + return val_str + else: + try: + _val = float(val_str) + except (ValueError, TypeError): + return "" + return str( self.usr2sys(quantity, _val)) + """ Aliases for sys2usr """ def distance(self, value): return self.sys2usr('distance', value) Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-24 02:57:23 UTC (rev 737) +++ pytrainer/trunk/pytrainer/main.py 2010-11-24 07:45:09 UTC (rev 738) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#737" + self.version ="1.7.2_svn#738" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aza...@us...> - 2010-11-24 14:20:16
|
Revision: 739 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=739&view=rev Author: azapletal Date: 2010-11-24 14:20:10 +0000 (Wed, 24 Nov 2010) Log Message: ----------- See 738; further integration of pace Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/windowrecord.py pytrainer/trunk/pytrainer/lib/uc.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/gui/windowrecord.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowrecord.py 2010-11-24 07:45:09 UTC (rev 738) +++ pytrainer/trunk/pytrainer/gui/windowrecord.py 2010-11-24 14:20:10 UTC (rev 739) @@ -259,16 +259,16 @@ list_options["rcd_sport"] = self.rcd_sport.get_active_text() list_options["rcd_distance"] = self.uc.usr2sys_str('distance', self.rcd_distance.get_text()) list_options["rcd_beats"] = self.rcd_beats.get_text() - list_options["rcd_average"] = self.uc.usr2sys_str('speed',self.rcd_average.get_text()) + list_options["rcd_average"] = self.uc.usr2sys_str('speed', self.rcd_average.get_text()) list_options["rcd_calories"] = self.rcd_calories.get_text() list_options["rcd_title"] = self.rcd_title.get_text().replace("\"","'") list_options["rcd_gpxfile"] = self.rcd_gpxfile.get_text() - list_options["rcd_upositive"] = self.uc.usr2sys_str('height',self.rcd_upositive.get_text()) - list_options["rcd_unegative"] = self.uc.usr2sys_str('height',self.rcd_unegative.get_text()) + list_options["rcd_upositive"] = self.uc.usr2sys_str('height', self.rcd_upositive.get_text()) + list_options["rcd_unegative"] = self.uc.usr2sys_str('height', self.rcd_unegative.get_text()) list_options["rcd_maxbeats"] = self.rcd_maxbeats.get_text() - list_options["rcd_pace"] = self.rcd_pace.get_text() - list_options["rcd_maxpace"] = self.rcd_maxpace.get_text() - list_options["rcd_maxvel"] = self.uc.usr2sys_str('speed',self.rcd_maxvel.get_text()) + list_options["rcd_pace"] = self.uc.usr2sys_str('pace', self.rcd_pace.get_text()) + list_options["rcd_maxpace"] = self.uc.usr2sys_str('pace', self.rcd_maxpace.get_text()) + list_options["rcd_maxvel"] = self.uc.usr2sys_str('speed', self.rcd_maxvel.get_text()) list_options["rcd_time"] = [self.rcd_hour.get_value_as_int(),self.rcd_min.get_value_as_int(),self.rcd_second.get_value_as_int()] buffer = self.rcd_comments.get_buffer() start,end = buffer.get_bounds() Modified: pytrainer/trunk/pytrainer/lib/uc.py =================================================================== --- pytrainer/trunk/pytrainer/lib/uc.py 2010-11-24 07:45:09 UTC (rev 738) +++ pytrainer/trunk/pytrainer/lib/uc.py 2010-11-24 14:20:10 UTC (rev 739) @@ -25,6 +25,31 @@ uc_factors = {'distance' : 0.621371192, 'speed': 0.621371192, 'pace':1.609344, 'height': 3.2808399, 'weight': 2.204624} +def pace2float(pace_str): + if pace_str.count(':') != 1: + return 0.0 + else: + _prts = pace_str.split(':') + try: + _p_min = int(_prts[0]) + _p_sec = int(_prts[1]) + return float( _p_min + (_p_sec/60.0)) + except: + return 0.0 + +def float2pace(pace_flt): + try: + _pace = float(pace_flt) + except: + return "" + _p_int = int(_pace) + _p_frc = round((_pace - _p_int) * 60.0) + if _p_frc == 60: + _p_int += 1 + _p_frc = 0 + _pace_str = "%d:%02d" % (_p_int, _p_frc) + return _pace_str + class UC(Singleton): """ When instantiated first time us is assigned to False. @@ -80,15 +105,24 @@ return _val def usr2sys_str(self, quantity, val_str): - """ Similar to usr2sys but I/O is string representing a float""" + """ Similar to usr2sys but I/O is string representing a float. + Necessary until we have proper input validation in windowrecord. + Escpecially pace fix here should be eliminated asap. + """ if not self.us: return val_str + + if quantity == 'pace': + _pace_dec = pace2float(val_str) + _pace_uc = self.usr2sys('pace', _pace_dec) + return float2pace(_pace_uc) else: try: _val = float(val_str) except (ValueError, TypeError): return "" return str( self.usr2sys(quantity, _val)) + """ Aliases for sys2usr """ def distance(self, value): Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-24 07:45:09 UTC (rev 738) +++ pytrainer/trunk/pytrainer/main.py 2010-11-24 14:20:10 UTC (rev 739) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#738" + self.version ="1.7.2_svn#739" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dg...@us...> - 2010-11-24 15:28:32
|
Revision: 740 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=740&view=rev Author: dgranda Date: 2010-11-24 15:28:25 +0000 (Wed, 24 Nov 2010) Log Message: ----------- Adding authors to credits Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/aboutdialog.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/gui/aboutdialog.py =================================================================== --- pytrainer/trunk/pytrainer/gui/aboutdialog.py 2010-11-24 14:20:10 UTC (rev 739) +++ pytrainer/trunk/pytrainer/gui/aboutdialog.py 2010-11-24 15:28:25 UTC (rev 740) @@ -32,8 +32,8 @@ self.version = version def run(self): - 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...>, Alessio Treglia <qua...@ub...>"] - 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...>, David García Granda <dg...@gm...>" + authors = ["Fiz Vázquez <vu...@si...>\nDavid García Granda <dg...@gm...>\nJohn Blance <joh...@gm...>\nArnd Zapletal <a.z...@gm...>\nNathan Jones <na...@nc...>\n\n-Package maintainers:\n\nRedHat/Fedora: Douglas E. Warner <sil...@si...>\nDebian: Noèl Köthe <no...@de...>\nUbuntu: Kevin Dwyer <ke...@ph...>, Alessio Treglia <qua...@ub...>"] + translator_credits = "Euskara: Jabier Santamaria <men...@gm...>\nCatalà: Eloi Crespillo Itchart <el...@ik...>\nČeština: Lobus Pokorny <sp...@se...>\nFrançais: Dj <dj...@dj...>, Pierre Gaigé <pg...@fr...>\nNorsk: Havard Davidsen <hav...@gm...>\nPolski: Seweryn Kokot <sk...@po...>\nDeutsch: Aleks <al...@sc...>, Noèl Köthe <no...@de...>\nEspañol: Fiz Vázquez <vu...@si...>, David García Granda <dg...@gm...>" license = "PyTrainer - The free sport tracking center\nCopyright (C) 2005-10 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) Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-24 14:20:10 UTC (rev 739) +++ pytrainer/trunk/pytrainer/main.py 2010-11-24 15:28:25 UTC (rev 740) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#739" + self.version ="1.7.2_svn#740" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-11-24 22:03:49
|
Revision: 742 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=742&view=rev Author: jblance Date: 2010-11-24 22:03:43 +0000 (Wed, 24 Nov 2010) Log Message: ----------- fix list view so default sort is not applied on right click 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 2010-11-24 21:38:20 UTC (rev 741) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2010-11-24 22:03:43 UTC (rev 742) @@ -1619,7 +1619,7 @@ selected,iter = treeview.get_selection().get_selected() #Por si hay un registro (malo) sin fecha, pa poder borrarlo try: - date = self.parent.date.setDate(selected.get_value(iter,2)) + date = self.parent.date.getDate(selected.get_value(iter,2)) except: pass self.popup.show(selected.get_value(iter,0), event.button, time) Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-24 21:38:20 UTC (rev 741) +++ pytrainer/trunk/pytrainer/main.py 2010-11-24 22:03:43 UTC (rev 742) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#740" + self.version ="1.7.2_svn#742" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-11-25 22:17:20
|
Revision: 745 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=745&view=rev Author: jblance Date: 2010-11-25 22:17:14 +0000 (Thu, 25 Nov 2010) Log Message: ----------- Fix 'show in classic view' function in list view Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/popupmenu.py pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/gui/windowrecord.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/gui/popupmenu.py =================================================================== --- pytrainer/trunk/pytrainer/gui/popupmenu.py 2010-11-25 09:41:28 UTC (rev 744) +++ pytrainer/trunk/pytrainer/gui/popupmenu.py 2010-11-25 22:17:14 UTC (rev 745) @@ -19,25 +19,32 @@ from SimpleGladeApp import SimpleGladeApp class PopupMenu(SimpleGladeApp): - def __init__(self, data_path = None, parent = None): - self.parent = parent - glade_path="glade/pytrainer.glade" - root = "popup" - domain = None - SimpleGladeApp.__init__(self, data_path+glade_path, root, domain) - - def show(self,id_record,event_button, time): - self.id_record = id_record - self.popup.popup( None, None, None, event_button, time) + def __init__(self, data_path = None, parent = None): + self.parent = parent + glade_path="glade/pytrainer.glade" + root = "popup" + domain = None + SimpleGladeApp.__init__(self, data_path+glade_path, root, domain) + + def show(self,id_record,event_button, time, date=None): + self.id_record = id_record + self.date = date + self.iter = iter + self.popup.popup( None, None, None, event_button, time) - def on_editrecord_activate(self,widget): - self.parent.parent.editRecord(self.id_record, view=self.parent.selected_view) + def on_editrecord_activate(self,widget): + self.parent.parent.editRecord(self.id_record, view=self.parent.selected_view) - def on_showclassic_activate(self,widget): - self.parent.classicview_item.set_active(True) - #self.parent.on_calendar_selected(None) - self.parent.notebook.set_current_page(0) - self.parent.parent.refreshGraphView("record") + def on_showclassic_activate(self,widget): + #Set date in classic view + if self.date is not None: + self.parent.parent.date.setDate(self.date) + self.parent.classicview_item.set_active(True) + #self.parent.on_calendar_selected(None) + self.parent.notebook.set_current_page(0) + #self.parent.parent.refreshGraphView("record") + self.parent.recordview.set_current_page(0) + self.parent.parent.refreshRecordGraphView("info", id_record=self.id_record) - def on_remove_activate(self,widget): - self.parent.parent.removeRecord(self.id_record, view=self.parent.selected_view) + def on_remove_activate(self,widget): + self.parent.parent.removeRecord(self.id_record, view=self.parent.selected_view) Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2010-11-25 09:41:28 UTC (rev 744) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2010-11-25 22:17:14 UTC (rev 745) @@ -1622,7 +1622,7 @@ date = self.parent.date.getDate(selected.get_value(iter,2)) except: pass - self.popup.show(selected.get_value(iter,0), event.button, time) + self.popup.show(selected.get_value(iter,0), event.button, time, selected.get_value(iter,2)) elif event.button == 1: self.notebook.set_current_page(0) self.parent.refreshGraphView("record") Modified: pytrainer/trunk/pytrainer/gui/windowrecord.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowrecord.py 2010-11-25 09:41:28 UTC (rev 744) +++ pytrainer/trunk/pytrainer/gui/windowrecord.py 2010-11-25 22:17:14 UTC (rev 745) @@ -642,15 +642,20 @@ sec = self.rcd_second.get_value_as_int() hour += float(min)/60.0 + float(sec)/(60.0*60.0) weight = self.pytrainer_main.profile.getValue("pytraining","prf_weight") - if weight is None or weight == "" or weight == "None": + try: + weight = float(weight) + except: weight = 0.0 - weight = float(weight) - met = float(self.parent.getSportMet(sport)) - extraweight = self.parent.getSportWeight(sport) - if extraweight is None or extraweight == "" or extraweight == "None": + try: + met = float(self.parent.getSportMet(sport)) + except: + met = None + try: + extraweight = self.parent.getSportWeight(sport) + extraweight = float(extraweight) + except: extraweight = 0.0 - extraweight = float(extraweight) - if met: + if met is not None: calories = met*(weight+extraweight)*hour self.rcd_calories.set_text(str(calories)) Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-25 09:41:28 UTC (rev 744) +++ pytrainer/trunk/pytrainer/main.py 2010-11-25 22:17:14 UTC (rev 745) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#742" + self.version ="1.7.2_svn#745" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() @@ -274,15 +274,24 @@ print "Unknown view %s" % view logging.debug('<<') - def refreshRecordGraphView(self, view): + def refreshRecordGraphView(self, view, id_record=None): logging.debug('>>') logging.info('Working on '+view+' graph') - selected,iter = self.windowmain.recordTreeView.get_selection().get_selected() - if iter: - id_record = selected.get_value(iter,0) + if id_record is not None: + #Refresh called for a specific record + #Select correct record in treeview + model = self.windowmain.recordTreeView.get_model() + #Loop through all records in treeview looking for the correct one to highlight + for i,row in enumerate(model): + if row[0] == id_record: + self.windowmain.recordTreeView.set_cursor(i) else: - id_record = None - view="info" + selected,iter = self.windowmain.recordTreeView.get_selection().get_selected() + if iter: + id_record = selected.get_value(iter,0) + else: + id_record = None + view="info" activity = self.activitypool.get_activity(id_record) if view=="info": self.windowmain.actualize_recordview(activity) @@ -412,7 +421,7 @@ self.record.newRecord(list_sport, date, title, distance, time, upositive, unegative, bpm, calories, comment) self.refreshListRecords() if view is not None: - self.refreshGraphView(view) + self.refreshGraphView(view) logging.debug('<<') def editRecord(self, id_record, view=None): @@ -422,7 +431,7 @@ self.record.editRecord(id_record,list_sport) self.refreshListRecords() if view is not None: - self.refreshGraphView(view) + self.refreshGraphView(view) logging.debug('<<') def removeRecord(self, id_record, confirm = False, view=None): @@ -437,7 +446,7 @@ warning.run() self.refreshListRecords() if view is not None: - self.refreshGraphView(view) + self.refreshGraphView(view) logging.debug('<<') def removeWaypoint(self,id_waypoint, confirm = False): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-11-25 22:46:03
|
Revision: 748 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=748&view=rev Author: jblance Date: 2010-11-25 22:45:55 +0000 (Thu, 25 Nov 2010) Log Message: ----------- Remove informational print statements Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/date.py pytrainer/trunk/pytrainer/lib/ddbb.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/pytrainer/lib/date.py =================================================================== --- pytrainer/trunk/pytrainer/lib/date.py 2010-11-25 22:41:20 UTC (rev 747) +++ pytrainer/trunk/pytrainer/lib/date.py 2010-11-25 22:45:55 UTC (rev 748) @@ -91,7 +91,7 @@ day_delta = datetime.timedelta(days=int(results[0]) - 1) base_date = dateutil.parser.parse(results[1]) first_day = base_date + day_delta - print "First day of week based on locale is:", first_day.strftime("%A") + logging.debug("First day of week based on locale is:", first_day.strftime("%A")) return first_day except Exception as e: print type(e) Modified: pytrainer/trunk/pytrainer/lib/ddbb.py =================================================================== --- pytrainer/trunk/pytrainer/lib/ddbb.py 2010-11-25 22:41:20 UTC (rev 747) +++ pytrainer/trunk/pytrainer/lib/ddbb.py 2010-11-25 22:45:55 UTC (rev 748) @@ -160,7 +160,7 @@ if table.find(',') != -1: #multiple tables in select #TODO fix so works.... - print 'TODO fix select_dict to work with multiple tables' + logging.info('TODO fix select_dict to work with multiple tables') cellString = ','.join(cells) #create cell list string results = self.ddbbObject.select(table,cellString,condition,mod) for result in results: Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-25 22:41:20 UTC (rev 747) +++ pytrainer/trunk/pytrainer/main.py 2010-11-25 22:45:55 UTC (rev 748) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#747" + self.version ="1.7.2_svn#748" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aza...@us...> - 2010-11-27 14:22:01
|
Revision: 750 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=750&view=rev Author: azapletal Date: 2010-11-27 14:21:55 +0000 (Sat, 27 Nov 2010) Log Message: ----------- Tidying needless code fragments 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 2010-11-26 02:20:36 UTC (rev 749) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2010-11-27 14:21:55 UTC (rev 750) @@ -1011,13 +1011,7 @@ hour,min,sec = date.second2time(int(i[6])) except (ValueError, TypeError): hour,min,sec = (0,0,0) - _time = "%2d:%02d:%02d" %(hour,min,sec) #original - # experimental only - if hour >0: - _hh = "%2d:%02d:%02d" %(hour, min, sec) - else: - _hh = "___%2d:%02d" %(min, sec) - #_time =_hh + _time = "%2d:%02d:%02d" %(hour,min,sec) try: _id = int(i[5]) except (ValueError, TypeError) as e: Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-26 02:20:36 UTC (rev 749) +++ pytrainer/trunk/pytrainer/main.py 2010-11-27 14:21:55 UTC (rev 750) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.7.2_svn#748" + self.version ="1.7.2_svn#750" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2010-12-01 00:48:45
|
Revision: 753 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=753&view=rev Author: jblance Date: 2010-12-01 00:48:36 +0000 (Wed, 01 Dec 2010) Log Message: ----------- Fix so only once instance of preferences dialog can be open at a time - ticket #74 Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/aboutdialog.py pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/gui/windowprofile.py pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/profile.py Modified: pytrainer/trunk/pytrainer/gui/aboutdialog.py =================================================================== --- pytrainer/trunk/pytrainer/gui/aboutdialog.py 2010-11-29 22:55:45 UTC (rev 752) +++ pytrainer/trunk/pytrainer/gui/aboutdialog.py 2010-12-01 00:48:36 UTC (rev 753) @@ -23,42 +23,46 @@ import pytrainer.lib.webUtils class About: - def __init__(self,data_path = None, version = None): - def url_hook(dialog, url): - pytrainer.lib.webUtils.open_url_in_browser(url) - # Available in PyGTK 2.6 and above - gtk.about_dialog_set_url_hook(url_hook) - self.data_path = data_path - self.version = version + def __init__(self,data_path = None, version = None): + def url_hook(dialog, url): + pytrainer.lib.webUtils.open_url_in_browser(url) + # Available in PyGTK 2.6 and above + gtk.about_dialog_set_url_hook(url_hook) + self.data_path = data_path + self.version = version - def run(self): - authors = ["Fiz Vázquez <vu...@si...>\nDavid García Granda <dg...@gm...>\nJohn Blance <joh...@gm...>\nArnd Zapletal <a.z...@gm...>\nNathan Jones <na...@nc...>\n\n-Package maintainers:\n\nRedHat/Fedora: Douglas E. Warner <sil...@si...>\nDebian: Noèl Köthe <no...@de...>\nUbuntu: Kevin Dwyer <ke...@ph...>, Alessio Treglia <qua...@ub...>"] - translator_credits = "Euskara: Jabier Santamaria <men...@gm...>\nCatalà: Eloi Crespillo Itchart <el...@ik...>\nČesky: Lobus Pokorny <sp...@se...>\nFrançais: Dj <dj...@dj...>, Pierre Gaigé <pg...@fr...>\nNorsk: Havard Davidsen <hav...@gm...>\nPolski: Seweryn Kokot <sk...@po...>\nDeutsch: Aleks <al...@sc...>, Noèl Köthe <no...@de...>\nEspañol: Fiz Vázquez <vu...@si...>, David García Granda <dg...@gm...>" - 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) - about_dialog.set_name("pyTrainer") - about_dialog.set_version(self.version) - about_dialog.set_copyright("Copyright \xc2\xa9 2005-09 Fiz Vázquez") - about_dialog.set_website("http://sourceforge.net/projects/pytrainer") - about_dialog.set_website_label("http://sourceforge.net/projects/pytrainer") - about_dialog.set_comments("The free sport tracking center") - about_dialog.set_license(license) - - about_dialog.set_authors(authors) - about_dialog.set_translator_credits(translator_credits) - about_dialog.set_logo(gtk.gdk.pixbuf_new_from_file(self.data_path+"glade/pytrainer_mini.png")) + def run(self): + authors = ["Fiz Vázquez <vu...@si...>\nDavid García Granda <dg...@gm...>\nJohn Blance <joh...@gm...>\nArnd Zapletal <a.z...@gm...>\nNathan Jones <na...@nc...>\n\n-Package maintainers:\n\nRedHat/Fedora: Douglas E. Warner <sil...@si...>\nDebian: Noèl Köthe <no...@de...>\nUbuntu: Kevin Dwyer <ke...@ph...>, Alessio Treglia <qua...@ub...>"] + translator_credits = "Euskara: Jabier Santamaria <men...@gm...>\nCatalà: Eloi Crespillo Itchart <el...@ik...>\nČesky: Lobus Pokorny <sp...@se...>\nFrançais: Dj <dj...@dj...>, Pierre Gaigé <pg...@fr...>\nNorsk: Havard Davidsen <hav...@gm...>\nPolski: Seweryn Kokot <sk...@po...>\nDeutsch: Aleks <al...@sc...>, Noèl Köthe <no...@de...>\nEspañol: Fiz Vázquez <vu...@si...>, David García Granda <dg...@gm...>" + 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) + about_dialog.set_name("pyTrainer") + about_dialog.set_version(self.version) + about_dialog.set_copyright("Copyright \xc2\xa9 2005-09 Fiz Vázquez") + about_dialog.set_website("http://sourceforge.net/projects/pytrainer") + about_dialog.set_website_label("http://sourceforge.net/projects/pytrainer") + about_dialog.set_comments("The free sport tracking center") + about_dialog.set_license(license) + + about_dialog.set_authors(authors) + about_dialog.set_translator_credits(translator_credits) + about_dialog.set_logo(gtk.gdk.pixbuf_new_from_file(self.data_path+"glade/pytrainer_mini.png")) - # callbacks for destroying the dialog - def close(dialog, response, editor): - editor.about_dialog = None - dialog.destroy() - def delete_event(dialog, event, editor): - editor.about_dialog = None - return True - - about_dialog.connect("response", close, self) - about_dialog.connect("delete-event", delete_event, self) - self.about_dialog = about_dialog - about_dialog.show() - + # callbacks for destroying the dialog + def close(dialog, response, editor): + editor.about_dialog = None + dialog.destroy() + def delete_event(dialog, event, editor): + editor.about_dialog = None + return True + + about_dialog.connect("response", close, self) + about_dialog.connect("delete-event", delete_event, self) + self.about_dialog = about_dialog + about_dialog.show() + + def present(self): + if self.about_dialog is None: + self.run() + self.about_dialog.present() Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2010-11-29 22:55:45 UTC (rev 752) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2010-12-01 00:48:36 UTC (rev 753) @@ -84,6 +84,8 @@ self.y1_linewidth = 1 # setup Search ListView self.listsearch = ListSearch(self, self.pytrainer_main) + + self.aboutwindow = None def new(self): self.menublocking = 0 @@ -1730,8 +1732,11 @@ logging.debug("<<") def on_about_activate(self,widget): - aboutwindow = About(self.data_path, self.version) - aboutwindow.run() + if self.aboutwindow is None: + self.aboutwindow = About(self.data_path, self.version) + self.aboutwindow.run() + else: + self.aboutwindow.present() def getSportSelected(self): sport = self.sportlist.get_active() Modified: pytrainer/trunk/pytrainer/gui/windowprofile.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowprofile.py 2010-11-29 22:55:45 UTC (rev 752) +++ pytrainer/trunk/pytrainer/gui/windowprofile.py 2010-12-01 00:48:36 UTC (rev 753) @@ -67,6 +67,9 @@ equipment_ui = EquipmentUi(self.data_path + "/glade", equipment_service) self.equipment_container.add(equipment_ui) + def present(self): + self.newprofile.present() + def setValues(self,list_options): for i in self.conf_options.keys(): if not list_options.has_key(i): Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2010-11-29 22:55:45 UTC (rev 752) +++ pytrainer/trunk/pytrainer/main.py 2010-12-01 00:48:36 UTC (rev 753) @@ -53,7 +53,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.8.0" + self.version ="1.8.0-svn#753" self.DB_version = 6 #Process command line options self.startup_options = self.get_options() Modified: pytrainer/trunk/pytrainer/profile.py =================================================================== --- pytrainer/trunk/pytrainer/profile.py 2010-11-29 22:55:45 UTC (rev 752) +++ pytrainer/trunk/pytrainer/profile.py 2010-12-01 00:48:36 UTC (rev 753) @@ -39,6 +39,7 @@ self.extensiondir = environment.extension_dir self.plugindir = environment.plugin_dir self.uc = UC() + self.profilewindow = None environment.clear_temp_dir() @@ -271,10 +272,15 @@ logging.debug("retrieving configuration data") #Refresh configuration self.configuration = self._parse_config_file(self.config_file) - profilewindow = WindowProfile(self.data_path, self, pytrainer_main=self.pytrainer_main) - logging.debug("setting data values") - profilewindow.setValues(self.configuration) - profilewindow.run() + if self.profilewindow is None: + self.profilewindow = WindowProfile(self.data_path, self, pytrainer_main=self.pytrainer_main) + logging.debug("setting data values") + self.profilewindow.setValues(self.configuration) + self.profilewindow.run() + self.profilewindow = None + else: + self.profilewindow.setValues(self.configuration) + self.profilewindow.present() self.configuration = self._parse_config_file(self.config_file) logging.debug("<<") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dg...@us...> - 2011-03-19 18:52:26
|
Revision: 774 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=774&view=rev Author: dgranda Date: 2011-03-19 18:52:20 +0000 (Sat, 19 Mar 2011) Log Message: ----------- Replacing empty description with whitespace to avoid problems with localizations. Updating version number according to svn revision 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 2011-03-19 18:49:00 UTC (rev 773) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2011-03-19 18:52:20 UTC (rev 774) @@ -147,7 +147,7 @@ #create the columns for the laps treeview columns=[ {'name':_("Lap")}, - {'name':_(""), 'xalign':0, 'pixbuf':True}, + {'name':_(" "), 'xalign':0, 'pixbuf':True}, {'name':_("Distance"), 'xalign':1.0, 'format_float':'%.2f', 'quantity':'distance'}, {'name':_("Time"), 'xalign':1.0, 'format_duration':True}, {'name':_("Avg speed"), 'format_float':'%.2f', 'quantity':'speed'}, Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2011-03-19 18:49:00 UTC (rev 773) +++ pytrainer/trunk/pytrainer/main.py 2011-03-19 18:52:20 UTC (rev 774) @@ -54,7 +54,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.8.0-svn#753" + self.version ="1.8.0-svn#774" self.DB_version = 7 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dg...@us...> - 2011-05-03 22:35:39
|
Revision: 784 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=784&view=rev Author: dgranda Date: 2011-05-03 22:35:33 +0000 (Tue, 03 May 2011) Log Message: ----------- #120 - Changed the way OS is checked to allow pytrainer run on other POSIX in addition to GNU/LINUX Modified Paths: -------------- pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/platform.py Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2011-05-02 08:42:10 UTC (rev 783) +++ pytrainer/trunk/pytrainer/main.py 2011-05-03 22:35:33 UTC (rev 784) @@ -54,7 +54,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.8.0-svn#781" + self.version ="1.8.0-svn#784" self.DB_version = 8 #Process command line options self.startup_options = self.get_options() Modified: pytrainer/trunk/pytrainer/platform.py =================================================================== --- pytrainer/trunk/pytrainer/platform.py 2011-05-02 08:42:10 UTC (rev 783) +++ pytrainer/trunk/pytrainer/platform.py 2011-05-03 22:35:33 UTC (rev 784) @@ -1,6 +1,7 @@ # -*- coding: iso-8859-1 -*- #Copyright (C) Nathan Jones nc...@us... +#modified by dgranda on behalf of Debian bug #587997 (trac ticket #120) #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License @@ -20,12 +21,12 @@ import sys def get_platform(): - if sys.platform == "linux2": - return _Linux() - elif sys.platform == "win32": + if os.name == "posix": + return _Linux() #although not true, not changing original return name to avoid side effects + elif os.name == "nt": return _Windows() else: - print "Unsupported sys.platform: %s." % sys.platform + print "Unsupported os.name: %s." % os.name sys.exit(1) class _Platform(object): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dg...@us...> - 2011-05-05 10:35:49
|
Revision: 786 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=786&view=rev Author: dgranda Date: 2011-05-05 10:35:43 +0000 (Thu, 05 May 2011) Log Message: ----------- #118 - Preventing pytrainer to fail when time tag in gox file has no value 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 2011-05-05 01:28:51 UTC (rev 785) +++ pytrainer/trunk/pytrainer/lib/gpx.py 2011-05-05 10:35:43 UTC (rev 786) @@ -234,9 +234,12 @@ logging.debug("%d trkpoints in file" % len(trkpoints)) date_ = tree.find(timeTag).text - #mk_time = self.getDateTime(date_)[0] #UTC Date - mk_time = self.getDateTime(date_)[1] #Local Date - self.date = mk_time.strftime("%Y-%m-%d") + if date_ is None: + logging.info("time tag is blank") + self.date = None + else: + mk_time = self.getDateTime(date_)[1] #Local Date + self.date = mk_time.strftime("%Y-%m-%d") waiting_points = [] Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2011-05-05 01:28:51 UTC (rev 785) +++ pytrainer/trunk/pytrainer/main.py 2011-05-05 10:35:43 UTC (rev 786) @@ -54,7 +54,7 @@ class pyTrainer: def __init__(self,filename = None, data_path = None): #Version constants - self.version ="1.8.0-svn#784" + self.version ="1.8.0-svn#786" self.DB_version = 8 #Process command line options self.startup_options = self.get_options() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sig...@us...> - 2011-05-17 22:32:31
|
Revision: 800 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=800&view=rev Author: siggipals Date: 2011-05-17 22:32:25 +0000 (Tue, 17 May 2011) Log Message: ----------- Added 'Avg HR' to totals table. Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/stats.py Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2011-05-17 00:06:27 UTC (rev 799) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2011-05-17 22:32:25 UTC (rev 800) @@ -136,8 +136,9 @@ {'name':_("Sport")}, {'name':_("Total duration"), 'xalign':1.0, 'format_duration':True}, {'name':_("Total distance"), 'xalign':1.0, 'format_float':'%.1f', 'quantity':'distance'}, - {'name':_("Avg speed"), 'format_float':'%.2f', 'quantity':'maxspeed'}, - {'name':_("Max speed"), 'format_float':'%.2f', 'quantity':'maxspeed'}, + {'name':_("Avg speed"), 'format_float':'%.2f', 'quantity':'maxspeed', 'xalign':1.0}, + {'name':_("Max speed"), 'format_float':'%.2f', 'quantity':'maxspeed', 'xalign':1.0}, + {'name':_("Avg HR"), 'xalign':1.0}, {'name':_("Max HR"), 'xalign':1.0}, {'name':_("Max duration"), 'xalign':1.0, 'format_duration':True}, {'name':_("Max distance"), 'xalign':1.0, 'format_float':'%.1f', 'quantity':'distance'}, @@ -1299,6 +1300,7 @@ gobject.TYPE_FLOAT, gobject.TYPE_INT, gobject.TYPE_INT, + gobject.TYPE_INT, gobject.TYPE_FLOAT ) for s in data['sports'].values(): @@ -1308,15 +1310,15 @@ store.set (iter, c, c) c += 1 store.set (iter, c, s['name']) - for f in data['fields'][2:]: + for f in data['fields'][3:]: c += 1 store.set (iter, c, s['total_'+f]) c += 1 if s['total_duration']!=0: # Avoid division by zero if 0 length sport activity exists in DB - store.set (iter, c, s['total_distance'] / s['total_duration'] * 3600.) - for f in data['fields']: - c += 1 - store.set (iter, c, s[f]) + store.set (iter, c, s['total_distance'] / s['total_duration'] * 3600.) + for f in data['fields']: + c += 1 + store.set (iter, c, s[f]) self.statsTreeView.set_model(store) self.statsTreeView.set_rules_hint(True) Modified: pytrainer/trunk/pytrainer/stats.py =================================================================== --- pytrainer/trunk/pytrainer/stats.py 2011-05-17 00:06:27 UTC (rev 799) +++ pytrainer/trunk/pytrainer/stats.py 2011-05-17 22:32:25 UTC (rev 800) @@ -48,14 +48,14 @@ 'total_distance' : 0, } - fields = ['maxspeed', 'maxbeats', 'duration', 'distance'] + fields = ['maxspeed', 'beats', 'maxbeats', 'duration', 'distance'] data['fields'] = fields for f in fields: data[f] = 0 sports = dict([(s['id_sports'], s['name']) for s in self.pytrainer_main.ddbb.select_dict("sports", ('id_sports', 'name'))]) - results = self.pytrainer_main.ddbb.select_dict("records", ('id_record', 'date', 'sport', 'distance', 'duration', 'maxbeats', 'maxspeed', 'maxpace', 'average')) + results = self.pytrainer_main.ddbb.select_dict("records", ('id_record', 'date', 'sport', 'distance', 'duration', 'maxbeats', 'maxspeed', 'maxpace', 'average','pace','beats')) for r in results: # r['duration'] /= 3600 if r['sport'] not in data['sports']: @@ -70,8 +70,13 @@ data[f] = max(data[f], r[f]) else: logging.info('Skipping null values') + + if 'avg_hr' not in data['sports'][r['sport']]: + data['sports'][r['sport']]['avg_hr'] = [0, 0] + if r['beats']: + data['sports'][r['sport']]['avg_hr'][0] += 1 + data['sports'][r['sport']]['avg_hr'][1] += r['beats'] - data['total_duration'] += r['duration'] data['total_distance'] += r['distance'] @@ -80,6 +85,12 @@ if not 'end_date' in data: data['end_date'] = r['date'] data['end_date'] = max(data['end_date'], r['date']) + for s in data['sports']: + if data['sports'][s]['avg_hr'][0]: + data['sports'][s]['avg_hr'] = int(data['sports'][s]['avg_hr'][1] / data['sports'][s]['avg_hr'][0]) + else: + data['sports'][s]['avg_hr'] = None + logging.debug('<<') return data This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sig...@us...> - 2011-05-20 08:49:57
|
Revision: 803 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=803&view=rev Author: siggipals Date: 2011-05-20 08:49:50 +0000 (Fri, 20 May 2011) Log Message: ----------- Added record count for each sport to totals table. Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/stats.py Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2011-05-18 00:25:33 UTC (rev 802) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2011-05-20 08:49:50 UTC (rev 803) @@ -134,6 +134,7 @@ #create the columns for the stats treeview columns=[ {'name':_("id"), 'visible':False}, {'name':_("Sport")}, + {'name':_("Records"), 'xalign':1.0}, {'name':_("Total duration"), 'xalign':1.0, 'format_duration':True}, {'name':_("Total distance"), 'xalign':1.0, 'format_float':'%.1f', 'quantity':'distance'}, {'name':_("Avg speed"), 'format_float':'%.2f', 'quantity':'maxspeed', 'xalign':1.0}, @@ -1300,6 +1301,7 @@ gobject.TYPE_INT, gobject.TYPE_STRING, gobject.TYPE_INT, + gobject.TYPE_INT, gobject.TYPE_FLOAT, gobject.TYPE_FLOAT, gobject.TYPE_FLOAT, @@ -1315,6 +1317,8 @@ store.set (iter, c, c) c += 1 store.set (iter, c, s['name']) + c += 1 + store.set (iter, c, s['count']) for f in data['fields'][3:]: c += 1 store.set (iter, c, s['total_'+f]) @@ -1328,7 +1332,7 @@ self.statsTreeView.set_model(store) self.statsTreeView.set_rules_hint(True) - store.set_sort_column_id(2, gtk.SORT_DESCENDING) + store.set_sort_column_id(3, gtk.SORT_DESCENDING) self.drawareatotal.drawgraph(record_list) Modified: pytrainer/trunk/pytrainer/stats.py =================================================================== --- pytrainer/trunk/pytrainer/stats.py 2011-05-18 00:25:33 UTC (rev 802) +++ pytrainer/trunk/pytrainer/stats.py 2011-05-20 08:49:50 UTC (rev 803) @@ -59,10 +59,11 @@ for r in results: # r['duration'] /= 3600 if r['sport'] not in data['sports']: - data['sports'][r['sport']] = {'name': sports[r['sport']]} + data['sports'][r['sport']] = {'name': sports[r['sport']], 'count': 0} for f in fields: data['sports'][r['sport']][f] = 0 data['sports'][r['sport']]['total_'+f] = 0 + data['sports'][r['sport']]['count'] += 1 for f in fields: data['sports'][r['sport']][f] = max(data['sports'][r['sport']][f], r[f]) if r[f] is not None: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dg...@us...> - 2011-06-10 18:11:26
|
Revision: 807 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=807&view=rev Author: dgranda Date: 2011-06-10 18:11:20 +0000 (Fri, 10 Jun 2011) Log Message: ----------- Fixed bug #127 which prevents changing start time in manually entered activities Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/windowrecord.py pytrainer/trunk/pytrainer/record.py Modified: pytrainer/trunk/pytrainer/gui/windowrecord.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowrecord.py 2011-06-08 23:45:08 UTC (rev 806) +++ pytrainer/trunk/pytrainer/gui/windowrecord.py 2011-06-10 18:11:20 UTC (rev 807) @@ -275,6 +275,15 @@ comment = buffer.get_text(start,end, True) list_options["rcd_comments"] = comment.replace("\"","'") selected_equipment_ids = self._get_selected_equipment_ids() + # Added to change start time, only activities without GPX+ source file - dgranda 2011/06/10 + record_time = self.rcd_starttime.get_text() + record_date = self.rcd_date.get_text() + localtz = Date().getLocalTZ() + date = dateutil.parser.parse(record_date+" "+record_time+" "+localtz) + local_date = str(date) + utc_date = date.astimezone(tzutc()).strftime("%Y-%m-%dT%H:%M:%SZ") + list_options["date_time_utc"] = utc_date + list_options["date_time_local"] = local_date if self.mode == "newrecord": logging.debug('Track data: '+str(list_options)) Modified: pytrainer/trunk/pytrainer/record.py =================================================================== --- pytrainer/trunk/pytrainer/record.py 2011-06-08 23:45:08 UTC (rev 806) +++ pytrainer/trunk/pytrainer/record.py 2011-06-10 18:11:20 UTC (rev 807) @@ -311,9 +311,9 @@ shutil.copy2(gpxOrig, gpxfile) else: if (list_options["rcd_gpxfile"]==""): - logging.debug('removing gpxfile') # ein? - logging.debug('updating bbdd') #ein? - cells,values = self._formatRecord(list_options) + logging.debug('Activity not based in GPX file') # ein? + logging.debug('Updating bbdd') + cells,values = self._formatRecordNew(list_options) self.pytrainer_main.ddbb.update("records",cells,values," id_record=%d" %int(id_record)) if equipment is not None: self._update_record_equipment(id_record, equipment) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sig...@us...> - 2011-07-18 00:47:49
|
Revision: 810 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=810&view=rev Author: siggipals Date: 2011-07-18 00:47:43 +0000 (Mon, 18 Jul 2011) Log Message: ----------- #130 Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/ddbb.py pytrainer/trunk/pytrainer/record.py Modified: pytrainer/trunk/pytrainer/lib/ddbb.py =================================================================== --- pytrainer/trunk/pytrainer/lib/ddbb.py 2011-06-29 11:57:25 UTC (rev 809) +++ pytrainer/trunk/pytrainer/lib/ddbb.py 2011-07-18 00:47:43 UTC (rev 810) @@ -457,12 +457,12 @@ record_ids = set([r[0] for r in self.select("laps","record")]) for record in record_ids: try: - laps = self.select("laps","id_lap, intensity, avg_hr, max_hr, max_speed, trigger", "record = %s" % record) + laps = self.select("laps","id_lap, intensity, avg_hr, max_hr, max_speed, `trigger`", "record = %s" % record) gpxfile = self.configuration.gpxdir+"/%s.gpx"%(record) if not laps[0][1] and os.path.isfile(gpxfile) : #GPX file exists for this record - probably not a manual record gpxrecord = gpx.Gpx(filename=gpxfile) for lap, gpxlap in zip(laps, gpxrecord.getLaps()): - self.ddbbObject.update("laps", "intensity, avg_hr, max_hr, max_speed, trigger", (gpxlap[7], gpxlap[8], gpxlap[9], gpxlap[10], "%s" % gpxlap[11]), "id_lap = %d" % lap[0]) + self.ddbbObject.update("laps", "intensity, avg_hr, max_hr, max_speed, `trigger`", (gpxlap[7], gpxlap[8], gpxlap[9], gpxlap[10], "%s" % gpxlap[11]), "id_lap = %d" % lap[0]) except Exception as e: print "Error updating record: " + str(record) print e Modified: pytrainer/trunk/pytrainer/record.py =================================================================== --- pytrainer/trunk/pytrainer/record.py 2011-06-29 11:57:25 UTC (rev 809) +++ pytrainer/trunk/pytrainer/record.py 2011-07-18 00:47:43 UTC (rev 810) @@ -352,7 +352,7 @@ def getLaps(self, id_record): logging.debug('--') laps = self.pytrainer_main.ddbb.select("laps", - "id_lap, record, elapsed_time, distance, start_lat, start_lon, end_lat, end_lon, calories, lap_number, intensity, max_speed, avg_hr, max_hr, trigger, comments", + "id_lap, record, elapsed_time, distance, start_lat, start_lon, end_lat, end_lon, calories, lap_number, intensity, max_speed, avg_hr, max_hr, `trigger`, comments", "record=\"%s\"" % id_record) if laps is None or laps == []: #No laps stored - update DB logging.debug("No laps in DB for record %d" % id_record) @@ -369,7 +369,7 @@ self.insertLaps(lap_keys,lap.values()) #Try to get lap info again #TODO? refactor laps = self.pytrainer_main.ddbb.select("laps", - "id_lap, record, elapsed_time, distance, start_lat, start_lon, end_lat, end_lon, calories, lap_number, intensity, max_speed, avg_hr, max_hr, trigger, comments", + "id_lap, record, elapsed_time, distance, start_lat, start_lon, end_lat, end_lon, calories, lap_number, intensity, max_speed, avg_hr, max_hr, `trigger`, comments", "record=\"%s\"" % id_record) return laps This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sig...@us...> - 2011-07-22 00:38:09
|
Revision: 817 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=817&view=rev Author: siggipals Date: 2011-07-22 00:38:03 +0000 (Fri, 22 Jul 2011) Log Message: ----------- #130 Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/lib/activity.py pytrainer/trunk/pytrainer/lib/ddbb.py pytrainer/trunk/pytrainer/record.py Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2011-07-18 10:30:56 UTC (rev 816) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2011-07-22 00:38:03 UTC (rev 817) @@ -459,7 +459,7 @@ 'rest' : '#808080', } - pic = gtk.gdk.pixbuf_new_from_file(self.data_path+"glade/trigger_%s.png" % lap['trigger']) + pic = gtk.gdk.pixbuf_new_from_file(self.data_path+"glade/trigger_%s.png" % lap['laptrigger']) iter = store.append() store.set(iter, Modified: pytrainer/trunk/pytrainer/lib/activity.py =================================================================== --- pytrainer/trunk/pytrainer/lib/activity.py 2011-07-18 10:30:56 UTC (rev 816) +++ pytrainer/trunk/pytrainer/lib/activity.py 2011-07-22 00:38:03 UTC (rev 817) @@ -285,7 +285,7 @@ raise Exception( "Error - multiple results from DB for id: %s" % self.id ) #Get lap information laps = self.pytrainer_main.ddbb.select_dict("laps", - ("id_lap", "record", "elapsed_time", "distance", "start_lat", "start_lon", "end_lat", "end_lon", "calories", "lap_number", "intensity", "avg_hr", "max_hr", "max_speed", "trigger", "comments"), + ("id_lap", "record", "elapsed_time", "distance", "start_lat", "start_lon", "end_lat", "end_lon", "calories", "lap_number", "intensity", "avg_hr", "max_hr", "max_speed", "laptrigger", "comments"), "record=\"%s\"" % self.id) if laps is None or laps == [] or len(laps) < 1: #No laps found logging.debug("No laps in DB for record %d" % self.id) @@ -674,3 +674,4 @@ except ValueError: _value = str(value) return _value.replace('.',':') + Modified: pytrainer/trunk/pytrainer/lib/ddbb.py =================================================================== --- pytrainer/trunk/pytrainer/lib/ddbb.py 2011-07-18 10:30:56 UTC (rev 816) +++ pytrainer/trunk/pytrainer/lib/ddbb.py 2011-07-22 00:38:03 UTC (rev 817) @@ -76,7 +76,7 @@ "end_lon": "float", "calories": "int", "intensity": "varchar(7)", - "trigger": "varchar(9)", + "laptrigger": "varchar(9)", "max_speed": "float", "avg_hr": "int", "max_hr": "int", @@ -457,12 +457,12 @@ record_ids = set([r[0] for r in self.select("laps","record")]) for record in record_ids: try: - laps = self.select("laps","id_lap, intensity, avg_hr, max_hr, max_speed, `trigger`", "record = %s" % record) + laps = self.select("laps","id_lap, intensity, avg_hr, max_hr, max_speed, laptrigger", "record = %s" % record) gpxfile = self.configuration.gpxdir+"/%s.gpx"%(record) if not laps[0][1] and os.path.isfile(gpxfile) : #GPX file exists for this record - probably not a manual record gpxrecord = gpx.Gpx(filename=gpxfile) for lap, gpxlap in zip(laps, gpxrecord.getLaps()): - self.ddbbObject.update("laps", "intensity, avg_hr, max_hr, max_speed, `trigger`", (gpxlap[7], gpxlap[8], gpxlap[9], gpxlap[10], "%s" % gpxlap[11]), "id_lap = %d" % lap[0]) + self.ddbbObject.update("laps", "intensity, avg_hr, max_hr, max_speed, laptrigger", (gpxlap[7], gpxlap[8], gpxlap[9], gpxlap[10], "%s" % gpxlap[11]), "id_lap = %d" % lap[0]) except Exception as e: print "Error updating record: " + str(record) print e Modified: pytrainer/trunk/pytrainer/record.py =================================================================== --- pytrainer/trunk/pytrainer/record.py 2011-07-18 10:30:56 UTC (rev 816) +++ pytrainer/trunk/pytrainer/record.py 2011-07-22 00:38:03 UTC (rev 817) @@ -352,7 +352,7 @@ def getLaps(self, id_record): logging.debug('--') laps = self.pytrainer_main.ddbb.select("laps", - "id_lap, record, elapsed_time, distance, start_lat, start_lon, end_lat, end_lon, calories, lap_number, intensity, max_speed, avg_hr, max_hr, `trigger`, comments", + "id_lap, record, elapsed_time, distance, start_lat, start_lon, end_lat, end_lon, calories, lap_number, intensity, max_speed, avg_hr, max_hr, laptrigger, comments", "record=\"%s\"" % id_record) if laps is None or laps == []: #No laps stored - update DB logging.debug("No laps in DB for record %d" % id_record) @@ -369,7 +369,7 @@ self.insertLaps(lap_keys,lap.values()) #Try to get lap info again #TODO? refactor laps = self.pytrainer_main.ddbb.select("laps", - "id_lap, record, elapsed_time, distance, start_lat, start_lon, end_lat, end_lon, calories, lap_number, intensity, max_speed, avg_hr, max_hr, `trigger`, comments", + "id_lap, record, elapsed_time, distance, start_lat, start_lon, end_lat, end_lon, calories, lap_number, intensity, max_speed, avg_hr, max_hr, laptrigger, comments", "record=\"%s\"" % id_record) return laps This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nc...@us...> - 2011-07-27 12:39:57
|
Revision: 820 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=820&view=rev Author: ncjones Date: 2011-07-27 12:39:50 +0000 (Wed, 27 Jul 2011) Log Message: ----------- Move migrate repository to avoid import errors. ticket:132 Added Paths: ----------- pytrainer/trunk/pytrainer/upgrade/ pytrainer/trunk/pytrainer/upgrade/README pytrainer/trunk/pytrainer/upgrade/__init__.py pytrainer/trunk/pytrainer/upgrade/migrate.cfg pytrainer/trunk/pytrainer/upgrade/versions/ pytrainer/trunk/pytrainer/upgrade/versions/001_mysql_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/001_sqlite_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/002_mysql_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/002_sqlite_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/003_default_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/004_default_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/005_mysql_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/005_sqlite_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/006_default_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/007_mysql_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/007_sqlite_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/008_mysql_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/008_sqlite_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/009_default_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/010_default_upgrade.sql pytrainer/trunk/pytrainer/upgrade/versions/__init__.py Removed Paths: ------------- pytrainer/trunk/pytrainer/migrate/README pytrainer/trunk/pytrainer/migrate/__init__.py pytrainer/trunk/pytrainer/migrate/migrate.cfg pytrainer/trunk/pytrainer/migrate/versions/001_mysql_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/001_sqlite_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/002_mysql_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/002_sqlite_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/003_default_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/004_default_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/005_mysql_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/005_sqlite_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/006_default_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/007_mysql_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/007_sqlite_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/008_mysql_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/008_sqlite_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/009_default_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/010_default_upgrade.sql pytrainer/trunk/pytrainer/migrate/versions/__init__.py Deleted: pytrainer/trunk/pytrainer/migrate/README =================================================================== --- pytrainer/trunk/pytrainer/migrate/README 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/README 2011-07-27 12:39:50 UTC (rev 820) @@ -1,4 +0,0 @@ -This is a database migration repository. - -More information at -http://code.google.com/p/sqlalchemy-migrate/ Deleted: pytrainer/trunk/pytrainer/migrate/__init__.py =================================================================== --- pytrainer/trunk/pytrainer/migrate/__init__.py 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/__init__.py 2011-07-27 12:39:50 UTC (rev 820) @@ -1 +0,0 @@ -# template repository default module Deleted: pytrainer/trunk/pytrainer/migrate/migrate.cfg =================================================================== --- pytrainer/trunk/pytrainer/migrate/migrate.cfg 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/migrate.cfg 2011-07-27 12:39:50 UTC (rev 820) @@ -1,20 +0,0 @@ -[db_settings] -# Used to identify which repository this database is versioned under. -# You can use the name of your project. -repository_id=pytrainer - -# The name of the database table used to track the schema version. -# This name shouldn't already be used by your project. -# If this is changed once a database is under version control, you'll need to -# change the table name in each database too. -version_table=migrate_version - -# When committing a change script, Migrate will attempt to generate the -# sql for all supported databases; normally, if one of them fails - probably -# because you don't have that database installed - it is ignored and the -# commit continues, perhaps ending successfully. -# Databases in this list MUST compile successfully during a commit, or the -# entire commit will fail. List the databases your application will actually -# be using to ensure your updates to that database work properly. -# This must be a list; example: ['postgres','sqlite'] -required_dbs=[] Deleted: pytrainer/trunk/pytrainer/migrate/versions/001_mysql_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/001_mysql_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/001_mysql_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,41 +0,0 @@ --- initial schema as of version 1.7.0 - -create table sports ( - id_sports integer primary key auto_increment, - name varchar(100), - weight float, - met float -); - -create table records ( - id_record integer primary key auto_increment, - date date, - sport integer, - distance float, - time varchar(200), - beats float, - average float, - calories int, - comments text, - gpslog varchar(200), - title varchar(200), - upositive float, - unegative float, - maxspeed float, - maxpace float, - pace float, - maxbeats float, - date_time_local varchar(20), - date_time_utc varchar(20) -); - -create table waypoints ( - id_waypoint integer primary key auto_increment, - lat float, - lon float, - ele float, - comment varchar(240), - time date, - name varchar(200), - sym varchar(200) -); Deleted: pytrainer/trunk/pytrainer/migrate/versions/001_sqlite_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/001_sqlite_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/001_sqlite_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,41 +0,0 @@ --- initial schema as of version 1.7.0 - -create table sports ( - id_sports integer primary key autoincrement, - name varchar(100), - weight float, - met float -); - -create table records ( - id_record integer primary key autoincrement, - date date, - sport integer, - distance float, - time varchar(200), - beats float, - average float, - calories int, - comments text, - gpslog varchar(200), - title varchar(200), - upositive float, - unegative float, - maxspeed float, - maxpace float, - pace float, - maxbeats float, - date_time_local varchar(20), - date_time_utc varchar(20) -); - -create table waypoints ( - id_waypoint integer primary key autoincrement, - lat float, - lon float, - ele float, - comment varchar(240), - time date, - name varchar(200), - sym varchar(200) -); Deleted: pytrainer/trunk/pytrainer/migrate/versions/002_mysql_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/002_mysql_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/002_mysql_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,12 +0,0 @@ --- laps added in version 1.7.1 -create table laps ( - id_lap integer primary key auto_increment, - record integer, - elapsed_time varchar(20), - distance float, - start_lat float, - start_lon float, - end_lat float, - end_lon float, - calories integer -); Deleted: pytrainer/trunk/pytrainer/migrate/versions/002_sqlite_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/002_sqlite_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/002_sqlite_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,12 +0,0 @@ --- laps added in version 1.7.1 -create table laps ( - id_lap integer primary key autoincrement, - record integer, - elapsed_time varchar(20), - distance float, - start_lat float, - start_lon float, - end_lat float, - end_lon float, - calories integer -); Deleted: pytrainer/trunk/pytrainer/migrate/versions/003_default_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/003_default_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/003_default_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,2 +0,0 @@ --- lap number added in version 1.7.1 -alter table laps add lap_number integer; \ No newline at end of file Deleted: pytrainer/trunk/pytrainer/migrate/versions/004_default_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/004_default_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/004_default_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,2 +0,0 @@ --- sport max pace added in version 1.7.2 -alter table sports add max_pace integer; \ No newline at end of file Deleted: pytrainer/trunk/pytrainer/migrate/versions/005_mysql_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/005_mysql_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/005_mysql_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,9 +0,0 @@ --- athlete stats added in version 1.7.2 -create table athletestats ( - id_athletestat integer primary key auto_increment, - date date, - weight float, - bodyfat float, - restinghr integer, - maxhr integer -); \ No newline at end of file Deleted: pytrainer/trunk/pytrainer/migrate/versions/005_sqlite_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/005_sqlite_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/005_sqlite_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,9 +0,0 @@ --- athlete stats added in version 1.7.2 -create table athletestats ( - id_athletestat integer primary key autoincrement, - date date, - weight float, - bodyfat float, - restinghr integer, - maxhr integer -); Deleted: pytrainer/trunk/pytrainer/migrate/versions/006_default_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/006_default_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/006_default_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,2 +0,0 @@ --- record duration added in version 1.7.2 -alter table records add duration integer; \ No newline at end of file Deleted: pytrainer/trunk/pytrainer/migrate/versions/007_mysql_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/007_mysql_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/007_mysql_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,4 +0,0 @@ --- record date_time data type changed in version 1.7.2 -alter table records - modify date_time_local varchar(40), - modify date_time_utc varchar(40); \ No newline at end of file Deleted: pytrainer/trunk/pytrainer/migrate/versions/007_sqlite_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/007_sqlite_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/007_sqlite_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1 +0,0 @@ --- data type change does not affect sqlite schema \ No newline at end of file Deleted: pytrainer/trunk/pytrainer/migrate/versions/008_mysql_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/008_mysql_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/008_mysql_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,16 +0,0 @@ --- equipment management added in version 1.8.0 - -create table equipment ( - id integer primary key auto_increment , - description varchar(200), - active boolean, - life_expectancy int, - prior_usage int, - notes text -); - -create table record_equipment ( - id integer primary key auto_increment, - record_id int, - equipment_id int -); Deleted: pytrainer/trunk/pytrainer/migrate/versions/008_sqlite_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/008_sqlite_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/008_sqlite_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,16 +0,0 @@ --- equipment management added in version 1.8.0 - -create table equipment ( - id integer primary key autoincrement , - description varchar(200), - active boolean, - life_expectancy int, - prior_usage int, - notes text -); - -create table record_equipment ( - id integer primary key autoincrement, - record_id int, - equipment_id int -); Deleted: pytrainer/trunk/pytrainer/migrate/versions/009_default_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/009_default_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/009_default_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,7 +0,0 @@ --- lap info added in version 1.9.0 -alter table laps add intensity varchar(7); -alter table laps add laptrigger(9); -alter table laps add max_speed float; -alter table laps add avg_hr int; -alter table laps add max_hr int; -alter table laps add comments text; \ No newline at end of file Deleted: pytrainer/trunk/pytrainer/migrate/versions/010_default_upgrade.sql =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/010_default_upgrade.sql 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/010_default_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -1,2 +0,0 @@ --- sport color added in version 1.9.0 -alter table sports add color char(6); \ No newline at end of file Deleted: pytrainer/trunk/pytrainer/migrate/versions/__init__.py =================================================================== --- pytrainer/trunk/pytrainer/migrate/versions/__init__.py 2011-07-27 12:34:35 UTC (rev 819) +++ pytrainer/trunk/pytrainer/migrate/versions/__init__.py 2011-07-27 12:39:50 UTC (rev 820) @@ -1 +0,0 @@ -# template repository default versions module Copied: pytrainer/trunk/pytrainer/upgrade/README (from rev 819, pytrainer/trunk/pytrainer/migrate/README) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/README (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/README 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,4 @@ +This is a database migration repository. + +More information at +http://code.google.com/p/sqlalchemy-migrate/ Copied: pytrainer/trunk/pytrainer/upgrade/__init__.py (from rev 819, pytrainer/trunk/pytrainer/migrate/__init__.py) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/__init__.py (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/__init__.py 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1 @@ +# template repository default module Copied: pytrainer/trunk/pytrainer/upgrade/migrate.cfg (from rev 819, pytrainer/trunk/pytrainer/migrate/migrate.cfg) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/migrate.cfg (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/migrate.cfg 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,20 @@ +[db_settings] +# Used to identify which repository this database is versioned under. +# You can use the name of your project. +repository_id=pytrainer + +# The name of the database table used to track the schema version. +# This name shouldn't already be used by your project. +# If this is changed once a database is under version control, you'll need to +# change the table name in each database too. +version_table=migrate_version + +# When committing a change script, Migrate will attempt to generate the +# sql for all supported databases; normally, if one of them fails - probably +# because you don't have that database installed - it is ignored and the +# commit continues, perhaps ending successfully. +# Databases in this list MUST compile successfully during a commit, or the +# entire commit will fail. List the databases your application will actually +# be using to ensure your updates to that database work properly. +# This must be a list; example: ['postgres','sqlite'] +required_dbs=[] Copied: pytrainer/trunk/pytrainer/upgrade/versions/001_mysql_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/001_mysql_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/001_mysql_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/001_mysql_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,41 @@ +-- initial schema as of version 1.7.0 + +create table sports ( + id_sports integer primary key auto_increment, + name varchar(100), + weight float, + met float +); + +create table records ( + id_record integer primary key auto_increment, + date date, + sport integer, + distance float, + time varchar(200), + beats float, + average float, + calories int, + comments text, + gpslog varchar(200), + title varchar(200), + upositive float, + unegative float, + maxspeed float, + maxpace float, + pace float, + maxbeats float, + date_time_local varchar(20), + date_time_utc varchar(20) +); + +create table waypoints ( + id_waypoint integer primary key auto_increment, + lat float, + lon float, + ele float, + comment varchar(240), + time date, + name varchar(200), + sym varchar(200) +); Copied: pytrainer/trunk/pytrainer/upgrade/versions/001_sqlite_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/001_sqlite_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/001_sqlite_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/001_sqlite_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,41 @@ +-- initial schema as of version 1.7.0 + +create table sports ( + id_sports integer primary key autoincrement, + name varchar(100), + weight float, + met float +); + +create table records ( + id_record integer primary key autoincrement, + date date, + sport integer, + distance float, + time varchar(200), + beats float, + average float, + calories int, + comments text, + gpslog varchar(200), + title varchar(200), + upositive float, + unegative float, + maxspeed float, + maxpace float, + pace float, + maxbeats float, + date_time_local varchar(20), + date_time_utc varchar(20) +); + +create table waypoints ( + id_waypoint integer primary key autoincrement, + lat float, + lon float, + ele float, + comment varchar(240), + time date, + name varchar(200), + sym varchar(200) +); Copied: pytrainer/trunk/pytrainer/upgrade/versions/002_mysql_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/002_mysql_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/002_mysql_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/002_mysql_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,12 @@ +-- laps added in version 1.7.1 +create table laps ( + id_lap integer primary key auto_increment, + record integer, + elapsed_time varchar(20), + distance float, + start_lat float, + start_lon float, + end_lat float, + end_lon float, + calories integer +); Copied: pytrainer/trunk/pytrainer/upgrade/versions/002_sqlite_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/002_sqlite_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/002_sqlite_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/002_sqlite_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,12 @@ +-- laps added in version 1.7.1 +create table laps ( + id_lap integer primary key autoincrement, + record integer, + elapsed_time varchar(20), + distance float, + start_lat float, + start_lon float, + end_lat float, + end_lon float, + calories integer +); Copied: pytrainer/trunk/pytrainer/upgrade/versions/003_default_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/003_default_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/003_default_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/003_default_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,2 @@ +-- lap number added in version 1.7.1 +alter table laps add lap_number integer; \ No newline at end of file Copied: pytrainer/trunk/pytrainer/upgrade/versions/004_default_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/004_default_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/004_default_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/004_default_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,2 @@ +-- sport max pace added in version 1.7.2 +alter table sports add max_pace integer; \ No newline at end of file Copied: pytrainer/trunk/pytrainer/upgrade/versions/005_mysql_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/005_mysql_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/005_mysql_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/005_mysql_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,9 @@ +-- athlete stats added in version 1.7.2 +create table athletestats ( + id_athletestat integer primary key auto_increment, + date date, + weight float, + bodyfat float, + restinghr integer, + maxhr integer +); \ No newline at end of file Copied: pytrainer/trunk/pytrainer/upgrade/versions/005_sqlite_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/005_sqlite_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/005_sqlite_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/005_sqlite_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,9 @@ +-- athlete stats added in version 1.7.2 +create table athletestats ( + id_athletestat integer primary key autoincrement, + date date, + weight float, + bodyfat float, + restinghr integer, + maxhr integer +); Copied: pytrainer/trunk/pytrainer/upgrade/versions/006_default_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/006_default_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/006_default_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/006_default_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,2 @@ +-- record duration added in version 1.7.2 +alter table records add duration integer; \ No newline at end of file Copied: pytrainer/trunk/pytrainer/upgrade/versions/007_mysql_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/007_mysql_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/007_mysql_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/007_mysql_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,4 @@ +-- record date_time data type changed in version 1.7.2 +alter table records + modify date_time_local varchar(40), + modify date_time_utc varchar(40); \ No newline at end of file Copied: pytrainer/trunk/pytrainer/upgrade/versions/007_sqlite_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/007_sqlite_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/007_sqlite_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/007_sqlite_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1 @@ +-- data type change does not affect sqlite schema \ No newline at end of file Copied: pytrainer/trunk/pytrainer/upgrade/versions/008_mysql_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/008_mysql_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/008_mysql_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/008_mysql_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,16 @@ +-- equipment management added in version 1.8.0 + +create table equipment ( + id integer primary key auto_increment , + description varchar(200), + active boolean, + life_expectancy int, + prior_usage int, + notes text +); + +create table record_equipment ( + id integer primary key auto_increment, + record_id int, + equipment_id int +); Copied: pytrainer/trunk/pytrainer/upgrade/versions/008_sqlite_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/008_sqlite_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/008_sqlite_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/008_sqlite_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,16 @@ +-- equipment management added in version 1.8.0 + +create table equipment ( + id integer primary key autoincrement , + description varchar(200), + active boolean, + life_expectancy int, + prior_usage int, + notes text +); + +create table record_equipment ( + id integer primary key autoincrement, + record_id int, + equipment_id int +); Copied: pytrainer/trunk/pytrainer/upgrade/versions/009_default_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/009_default_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/009_default_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/009_default_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,7 @@ +-- lap info added in version 1.9.0 +alter table laps add intensity varchar(7); +alter table laps add laptrigger(9); +alter table laps add max_speed float; +alter table laps add avg_hr int; +alter table laps add max_hr int; +alter table laps add comments text; \ No newline at end of file Copied: pytrainer/trunk/pytrainer/upgrade/versions/010_default_upgrade.sql (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/010_default_upgrade.sql) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/010_default_upgrade.sql (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/010_default_upgrade.sql 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1,2 @@ +-- sport color added in version 1.9.0 +alter table sports add color char(6); \ No newline at end of file Copied: pytrainer/trunk/pytrainer/upgrade/versions/__init__.py (from rev 819, pytrainer/trunk/pytrainer/migrate/versions/__init__.py) =================================================================== --- pytrainer/trunk/pytrainer/upgrade/versions/__init__.py (rev 0) +++ pytrainer/trunk/pytrainer/upgrade/versions/__init__.py 2011-07-27 12:39:50 UTC (rev 820) @@ -0,0 +1 @@ +# template repository default versions module This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nc...@us...> - 2011-07-29 09:59:51
|
Revision: 822 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=822&view=rev Author: ncjones Date: 2011-07-29 09:59:45 +0000 (Fri, 29 Jul 2011) Log Message: ----------- Initialise empty DB from version checker. Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/ddbb.py pytrainer/trunk/pytrainer/lib/mysqlUtils.py pytrainer/trunk/pytrainer/lib/sqliteUtils.py pytrainer/trunk/pytrainer/upgrade/data.py Modified: pytrainer/trunk/pytrainer/lib/ddbb.py =================================================================== --- pytrainer/trunk/pytrainer/lib/ddbb.py 2011-07-29 09:59:10 UTC (rev 821) +++ pytrainer/trunk/pytrainer/lib/ddbb.py 2011-07-29 09:59:45 UTC (rev 822) @@ -125,6 +125,9 @@ ddbb_user = self.configuration.getValue("pytraining","prf_ddbbuser") ddbb_pass = self.configuration.getValue("pytraining","prf_ddbbpass") self.ddbbObject = Sql(ddbb_host,ddbb,ddbb_user,ddbb_pass,self.configuration) + + def get_connection_url(self): + return self.ddbbObject.get_connection_url() def connect(self): connection_ok, connection_msg = self.ddbbObject.connect() @@ -309,12 +312,8 @@ if entry not in tablesDB: return False return True - - def checkDBIntegrity(self): - '''17.11.2009 - dgranda - Retrieves tables and columns from database, checks current ones and adds something if missed. New in version 1.7.0 - args: none - returns: none''' + + def create_tables(self): global tablesList global tablesDefaultData logging.debug('>>') @@ -352,6 +351,13 @@ else: self.ddbbObject.checkTable(entry,tablesList[entry]) + def checkDBIntegrity(self): + '''17.11.2009 - dgranda + Retrieves tables and columns from database, checks current ones and adds something if missed. New in version 1.7.0 + args: none + returns: none''' + self.create_tables() + #Run any functions to update or correct data #These functions _must_ be safe to run at any time (i.e. not be version specfic or only safe to run once) self.populate_date_time_local() Modified: pytrainer/trunk/pytrainer/lib/mysqlUtils.py =================================================================== --- pytrainer/trunk/pytrainer/lib/mysqlUtils.py 2011-07-29 09:59:10 UTC (rev 821) +++ pytrainer/trunk/pytrainer/lib/mysqlUtils.py 2011-07-29 09:59:45 UTC (rev 822) @@ -30,6 +30,9 @@ self.ddbb_host = host self.ddbb = ddbb self.db = None + + def get_connection_url(self): + return "mysql://{user}:{passwd}@{host}/{db}".format(user=self.ddbb_user, passwd=self.ddbb_pass, host=self.ddbb_host, db=self.ddbb) def connect(self): #si devolvemos 1 ha ido todo con exito Modified: pytrainer/trunk/pytrainer/lib/sqliteUtils.py =================================================================== --- pytrainer/trunk/pytrainer/lib/sqliteUtils.py 2011-07-29 09:59:10 UTC (rev 821) +++ pytrainer/trunk/pytrainer/lib/sqliteUtils.py 2011-07-29 09:59:45 UTC (rev 822) @@ -32,6 +32,9 @@ self.db = None confdir = configuration.confdir self.ddbb = "%s/pytrainer.ddbb" %confdir + + def get_connection_url(self): + return "sqlite:///" + self.ddbb def connect(self): #si devolvemos 1 ha ido todo con exito Modified: pytrainer/trunk/pytrainer/upgrade/data.py =================================================================== --- pytrainer/trunk/pytrainer/upgrade/data.py 2011-07-29 09:59:10 UTC (rev 821) +++ pytrainer/trunk/pytrainer/upgrade/data.py 2011-07-29 09:59:45 UTC (rev 822) @@ -27,8 +27,9 @@ """Encapsulates an installation's existing data and provides means to check version state and upgrade.""" - def __init__(self, migratable_db, profile): + def __init__(self, migratable_db, ddbb, profile): self._migratable_db = migratable_db + self._ddbb = ddbb self._profile = profile def update_to_current(self): @@ -100,6 +101,9 @@ """Initialize the version metadata.""" self._migratable_db.version(initial_version) + def initialize(self): + self._ddbb.create_tables() + def upgrade(self): self._migratable_db.upgrade() @@ -119,7 +123,7 @@ self._update_function(installed_data) def _update_fresh(data): - # TODO create empty DB + data.initialize() data.initialize_version(data.get_available_version()) def _update_stale(data): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nc...@us...> - 2011-07-29 10:00:33
|
Revision: 823 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=823&view=rev Author: ncjones Date: 2011-07-29 10:00:27 +0000 (Fri, 29 Jul 2011) Log Message: ----------- Use data module for startup version check and initial table creation. Modified Paths: -------------- pytrainer/trunk/pytrainer/lib/ddbb.py pytrainer/trunk/pytrainer/main.py pytrainer/trunk/pytrainer/upgrade/data.py Modified: pytrainer/trunk/pytrainer/lib/ddbb.py =================================================================== --- pytrainer/trunk/pytrainer/lib/ddbb.py 2011-07-29 09:59:45 UTC (rev 822) +++ pytrainer/trunk/pytrainer/lib/ddbb.py 2011-07-29 10:00:27 UTC (rev 823) @@ -135,10 +135,6 @@ print "ERROR: Unable to connect to database" print connection_msg sys.exit(connection_ok) - #Do a quick check to ensure all tables are present in DB - if not self.checkDBTables(): - #Some tables missing - do DB check - self.checkDBIntegrity() def disconnect(self): self.ddbbObject.disconnect() @@ -298,21 +294,6 @@ ret_val = self.ddbbObject.freeExec(sql) return ret_val[0][0] - def checkDBTables(self): - '''Quick check that all expected tables existing in DB - return True if OK, False if any tables are missing - ''' - global tablesList - logging.debug('>>') - tablesDB = self.ddbbObject.getTableList() - logging.debug('Tables in DB: '+str(tablesDB)); - #Check Tables - for entry in tablesList: - logging.debug("Entry: "+entry) - if entry not in tablesDB: - return False - return True - def create_tables(self): global tablesList global tablesDefaultData Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2011-07-29 09:59:45 UTC (rev 822) +++ pytrainer/trunk/pytrainer/main.py 2011-07-29 10:00:27 UTC (rev 823) @@ -33,6 +33,7 @@ from os import path from pytrainer import platform +from upgrade.data import initialize_data from environment import Environment from record import Record from waypoint import Waypoint @@ -75,22 +76,12 @@ self.ddbb = DDBB(self.profile, self) logging.debug('connecting to DDBB') self.ddbb.connect() - - #Get user's DB version - currentDB_version = self.profile.getValue("pytraining","DB_version") - logging.debug("Current DB version: "+str(currentDB_version)) - # DB check can be triggered either via new version (mandatory) or as runtime parameter (--check) + + initialize_data(self.ddbb, self.profile) if self.startup_options.check: logging.debug("Checking DB as per user's request") self.sanityCheck() - elif currentDB_version is None: - logging.debug("No stored DB version. Checking DB") - self.sanityCheck() - elif self.DB_version > int(currentDB_version): - logging.debug("DB version newer than user's version") - self.sanityCheck() - else: - logging.info('No sanity check requested') + self.record = Record(data_path,self) self.athlete = Athlete(data_path,self) self.stats = Stats(data_path,self) @@ -511,6 +502,4 @@ logging.debug('>>') logging.info('Checking database integrity') self.ddbb.checkDBIntegrity() - logging.info('Setting DB version to: ' + str(self.DB_version)) - self.profile.setValue("pytraining","DB_version", str(self.DB_version)) logging.debug('<<') Modified: pytrainer/trunk/pytrainer/upgrade/data.py =================================================================== --- pytrainer/trunk/pytrainer/upgrade/data.py 2011-07-29 09:59:45 UTC (rev 822) +++ pytrainer/trunk/pytrainer/upgrade/data.py 2011-07-29 10:00:27 UTC (rev 823) @@ -21,6 +21,12 @@ from pytrainer.upgrade.migratedb import MigratableDb MIGRATE_REPOSITORY_PATH = "pytrainer/upgrade" + +def initialize_data(ddbb, profile): + """Initializes the installation's data.""" + db_url = ddbb.get_connection_url() + migratable_db = MigratableDb(MIGRATE_REPOSITORY_PATH, db_url) + InstalledData(migratable_db, ddbb, profile).update_to_current() class InstalledData(object): @@ -52,6 +58,7 @@ """ data_state = self.get_state() + #TODO logging data_state.update_to_current(self) def get_state(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |