|
From: <jb...@us...> - 2010-09-21 11:35:39
|
Revision: 616
http://pytrainer.svn.sourceforge.net/pytrainer/?rev=616&view=rev
Author: jblance
Date: 2010-09-21 11:35:28 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
Some additional (disabled) code for new graphing approach
Modified Paths:
--------------
pytrainer/trunk/glade/pytrainer.glade
pytrainer/trunk/pytrainer/gui/windowmain.py
pytrainer/trunk/pytrainer/lib/activity.py
pytrainer/trunk/pytrainer/main.py
Modified: pytrainer/trunk/glade/pytrainer.glade
===================================================================
--- pytrainer/trunk/glade/pytrainer.glade 2010-09-21 10:22:04 UTC (rev 615)
+++ pytrainer/trunk/glade/pytrainer.glade 2010-09-21 11:35:28 UTC (rev 616)
@@ -1187,6 +1187,25 @@
</packing>
</child>
<child>
+ <widget class="GtkHBox" id="graph_data_hbox">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHPaned" id="hpaned1">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -1892,7 +1911,7 @@
</child>
</widget>
<packing>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
Modified: pytrainer/trunk/pytrainer/gui/windowmain.py
===================================================================
--- pytrainer/trunk/pytrainer/gui/windowmain.py 2010-09-21 10:22:04 UTC (rev 615)
+++ pytrainer/trunk/pytrainer/gui/windowmain.py 2010-09-21 11:35:28 UTC (rev 616)
@@ -275,6 +275,38 @@
logging.debug("Activity has GPX data")
self.record_vbox.set_sensitive(1)
self.drawarearecord.drawgraph(self.record_list,self.laps)
+ #Create a frame showing data available for graphing
+ if False: #Still just test code
+ #Build frames and vboxs to hold checkbuttons
+ xFrame = gtk.Frame(label="Show on X Axis")
+ y1Frame = gtk.Frame(label="Show on Y1 Axis")
+ y2Frame = gtk.Frame(label="Show on Y2 Axis")
+ xvbox = gtk.VBox()
+ y1vbox = gtk.VBox()
+ y2vbox = gtk.VBox()
+ #Populate X axis data
+ xdistancebutton = gtk.RadioButton(label="Distance")
+ xdistancebutton.connect("toggled", self.on_xaxischange, "distance")
+ xdistancebutton.set_active(True)
+ xvbox.add(xdistancebutton)
+ xtimebutton = gtk.RadioButton(group=xdistancebutton, label="Time")
+ xtimebutton.connect("toggled", self.on_xaxischange, "time")
+ xvbox.add(xtimebutton)
+ xFrame.add(xvbox)
+ #Populate Y axis data
+ for graphdata in activity.distance_data:
+ y1checkbutton = gtk.CheckButton(label=activity.distance_data[graphdata].title)
+ y1checkbutton.connect("toggled", self.on_y1change, y1vbox)
+ y2checkbutton = gtk.CheckButton(label=activity.distance_data[graphdata].title)
+ y2checkbutton.connect("toggled", self.on_y2change, y2vbox)
+ y1vbox.add(y1checkbutton)
+ y2vbox.add(y2checkbutton)
+ y1Frame.add(y1vbox)
+ y2Frame.add(y2vbox)
+ self.graph_data_hbox.pack_start(xFrame, expand=False, fill=True, padding=0)
+ self.graph_data_hbox.pack_start(y1Frame, expand=False, fill=True, padding=0)
+ self.graph_data_hbox.pack_start(y2Frame, expand=False, fill=True, padding=0)
+ self.graph_data_hbox.show_all()
else:
logging.debug("Activity has no GPX data")
#Remove graph
@@ -913,6 +945,27 @@
## Lista de eventos ##
######################
+ def on_xaxischange(self, widget, data=None):
+ '''Handler for record graph axis selection changes'''
+ if widget.get_active():
+ print data
+
+ def on_y1change(self, widget, box):
+ '''Hander for changes to y1 selection'''
+ print "Y1 selected: ",
+ for child in box.get_children():
+ if child.get_active():
+ print child.get_label(),
+ print
+
+ def on_y2change(self, widget, box):
+ '''Hander for changes to y2 selection'''
+ print "Y2 selected: ",
+ for child in box.get_children():
+ if child.get_active():
+ print child.get_label(),
+ print
+
def on_athleteTreeView_button_press_event(self, treeview, event):
x = int(event.x)
y = int(event.y)
Modified: pytrainer/trunk/pytrainer/lib/activity.py
===================================================================
--- pytrainer/trunk/pytrainer/lib/activity.py 2010-09-21 10:22:04 UTC (rev 615)
+++ pytrainer/trunk/pytrainer/lib/activity.py 2010-09-21 11:35:28 UTC (rev 616)
@@ -38,6 +38,8 @@
us_system - (bool) True: imperial measurement False: metric measurement
distance_unit - (string) unit to use for distance
speed_unit - (string) unit to use for speed
+ distance_data - (dict of graphdata classes) contains the graph data with x axis distance
+ time_data - (dict of graphdata classes) contains the graph data with x axis time
height_unit - (string) unit to use for height
pace_unit - (string) unit to use for pace
gpx_file - (string) gpx file name
@@ -220,30 +222,30 @@
logging.debug("<<")
return
#Profile
- title=_("Elevation v Distance")
+ title=_("Elevation")
xlabel="%s (%s)" % (_('Distance'), self.distance_unit)
ylabel="%s (%s)" % (_('Elevation'), self.height_unit)
self.distance_data['elevation'] = GraphData(title=title, xlabel=xlabel, ylabel=ylabel)
- title=_("Elevation v Time")
+ title=_("Elevation")
xlabel=_("Time (hours)")
self.time_data['elevation'] = GraphData(title=title,xlabel=xlabel, ylabel=ylabel)
#Speed
- title=_("Speed v Distance")
+ title=_("Speed")
xlabel="%s (%s)" % (_('Distance'), self.distance_unit)
ylabel="%s (%s)" % (_('Speed'), self.speed_unit)
self.distance_data['speed'] = GraphData(title=title, xlabel=xlabel, ylabel=ylabel)
#Pace
- title=_("Pace v Distance")
+ title=_("Pace")
xlabel="%s (%s)" % (_('Distance'), self.distance_unit)
ylabel="%s (%s)" % (_('Pace'), self.pace_unit)
self.distance_data['pace'] = GraphData(title=title, xlabel=xlabel, ylabel=ylabel)
#Heartrate
- title=_("Heart Rate v Distance")
+ title=_("Heart Rate")
xlabel="%s (%s)" % (_('Distance'), self.distance_unit)
ylabel="%s (%s)" % (_('Heart Rate'), _('bpm'))
self.distance_data['hr'] = GraphData(title=title, xlabel=xlabel, ylabel=ylabel)
#Cadence
- title=_("Cadence v Distance")
+ title=_("Cadence")
xlabel="%s (%s)" % (_('Distance'), self.distance_unit)
ylabel="%s (%s)" % (_('Cadence'), _('rpm'))
self.distance_data['cadence'] = GraphData(title=title, xlabel=xlabel, ylabel=ylabel)
@@ -270,11 +272,11 @@
#Remove data with no values
for item in self.distance_data.keys():
if len(self.distance_data[item]) == 0:
- print "No values for %s. Removing...." % item
+ logging.debug( "No values for %s. Removing...." % item )
del self.distance_data[item]
for item in self.time_data.keys():
if len(self.time_data[item]) == 0:
- print "No values for %s. Removing...." % item
+ logging.debug( "No values for %s. Removing...." % item )
del self.time_data[item]
logging.debug("<<")
Modified: pytrainer/trunk/pytrainer/main.py
===================================================================
--- pytrainer/trunk/pytrainer/main.py 2010-09-21 10:22:04 UTC (rev 615)
+++ pytrainer/trunk/pytrainer/main.py 2010-09-21 11:35:28 UTC (rev 616)
@@ -49,7 +49,7 @@
class pyTrainer:
def __init__(self,filename = None, data_path = None):
#Version constants
- self.version ="1.7.2_svn#615"
+ self.version ="1.7.2_svn#616"
self.DB_version = 3
#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.
|