From: <jb...@us...> - 2009-12-27 22:12:30
|
Revision: 448 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=448&view=rev Author: jblance Date: 2009-12-27 22:12:14 +0000 (Sun, 27 Dec 2009) Log Message: ----------- Add time (time-of-day) to recordtreeview, change Time to Duration Modified Paths: -------------- pytrainer/trunk/glade/newrecord.glade pytrainer/trunk/glade/pytrainer.glade pytrainer/trunk/pytrainer/gui/windowmain.py pytrainer/trunk/pytrainer/lib/gpx.py pytrainer/trunk/pytrainer/main.py Modified: pytrainer/trunk/glade/newrecord.glade =================================================================== --- pytrainer/trunk/glade/newrecord.glade 2009-12-27 06:29:53 UTC (rev 447) +++ pytrainer/trunk/glade/newrecord.glade 2009-12-27 22:12:14 UTC (rev 448) @@ -376,7 +376,7 @@ <child> <widget class="GtkLabel" id="label9"> <property name="visible">True</property> - <property name="label" translatable="yes">Time:</property> + <property name="label" translatable="yes">Duration:</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> Modified: pytrainer/trunk/glade/pytrainer.glade =================================================================== --- pytrainer/trunk/glade/pytrainer.glade 2009-12-27 06:29:53 UTC (rev 447) +++ pytrainer/trunk/glade/pytrainer.glade 2009-12-27 22:12:14 UTC (rev 448) @@ -580,7 +580,7 @@ <child> <widget class="GtkLabel" id="label11124"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Time:</b></property> + <property name="label" translatable="yes"><b>Duration:</b></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -3190,7 +3190,7 @@ <child> <widget class="GtkLabel" id="label38"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Time:</b></property> + <property name="label" translatable="yes"><b>Duration:</b></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -4318,7 +4318,7 @@ <child> <widget class="GtkLabel" id="label100"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Time:</b></property> + <property name="label" translatable="yes"><b>Duration:</b></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -5460,7 +5460,7 @@ <child> <widget class="GtkLabel" id="label100"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Time:</b></property> + <property name="label" translatable="yes"><b>Duration:</b></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -6755,7 +6755,7 @@ <child> <widget class="GtkLabel" id="label118"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Time:</b></property> + <property name="label" translatable="yes"><b>Duration:</b></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2009-12-27 06:29:53 UTC (rev 447) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2009-12-27 22:12:14 UTC (rev 448) @@ -58,7 +58,7 @@ self.window1.set_title ("pyTrainer %s" % self.version) self.record_list = [] #create the columns for the listdayrecord - column_names=[_("id"),_("Sport"),_("Kilometer")] + column_names=[_("id"),_("Time"), _("Sport"),_("Kilometer")] self.create_treeview(self.recordTreeView,column_names) #create the columns for the listarea column_names=[_("id"),_("Title"),_("Date"),_("Distance"),_("Sport"),_("Time"),_("Beats"),_("Average"),("Calories")] @@ -914,7 +914,7 @@ #hasta aqui revisado def on_allRecordTreeView_button_press(self, treeview, event): logging.debug(">>") - print "on_allRecordTreeView_" + #print "on_allRecordTreeView_" x = int(event.x) y = int(event.y) time = event.time @@ -944,16 +944,23 @@ gobject.TYPE_INT, gobject.TYPE_STRING, gobject.TYPE_STRING, + gobject.TYPE_STRING, object) for i in record_list: iter = store.append() if not iterOne: iterOne = iter + dateTime = i[12] + if dateTime is not None: + localTime = dateutil.parser.parse(dateTime).strftime("%H:%M") + else: + localTime = "" store.set ( iter, 0, int(i[8]), - 1, str(i[0]), - 2, str(i[2]) + 1, str(localTime), + 2, str(i[0]), + 3, str(i[2]) ) self.recordTreeView.set_model(store) if iterOne: Modified: pytrainer/trunk/pytrainer/lib/gpx.py =================================================================== --- pytrainer/trunk/pytrainer/lib/gpx.py 2009-12-27 06:29:53 UTC (rev 447) +++ pytrainer/trunk/pytrainer/lib/gpx.py 2009-12-27 22:12:14 UTC (rev 448) @@ -95,7 +95,7 @@ if timeResult is not None: time_ = timeResult.text # check timezone mk_time = self.getDateTime(time_)[0] - time_ = time.strftime("%Y-%m-%d", mk_time) + time_ = mk_time.strftime("%Y-%m-%d") else: time_ = _("No Data") logging.debug("name: "+name+" | time: "+time_) @@ -211,14 +211,18 @@ #chequeamos que la altura sea correcta / check that the height is correct if ele is not None: if len(ele)<15: - tmp_alt = int(float(ele)) + tmp_alt = int(float(ele)) #Why convert to int? ele are like "156.3515625" + else: + print "ele len >= 15" + ele else: tmp_alt= 0 + print "tmp_alt:" + tmp_alt #evitamos los puntos blancos / we avoid the white points if (float(lat) < -0.000001) or (float(lat) > 0.0000001): - tmp_lat = float(lat)*0.01745329252 - tmp_lon = float(lon)*0.01745329252 + #Convert lat and lon from degrees to radians + tmp_lat = float(lat)*0.01745329252 #0.01745329252 = number of radians in a degree + tmp_lon = float(lon)*0.01745329252 #57.29577951 = 1/0.01745329252 or degrees per radian tmp_time = int(time_) #Para las vueltas diferentes a la primera / For the returns different from first @@ -228,8 +232,9 @@ #Caqlculate diference betwen last and new point #tempnum=(math.sin(last_lat)*math.sin(tmp_lat))+(math.cos(last_lat)*math.cos(tmp_lat)*math.cos(tmp_lon-last_lon)) #try: - #Pasamos la distancia de radianes a metros.. creo - #David no me mates que esto lo escribi hace anhos + #Pasamos la distancia de radianes a metros.. creo / We convert the distance from radians to meters + #David no me mates que esto lo escribi hace anhos / Do not kill me this was written ages ago + #http://faculty.washington.edu/blewis/ocn499/EXER04.htm equation for the distance between 2 points on a spherical earth try: #dist=math.acos(tempnum)*111.302*57.29577951 dist=math.acos((math.sin(last_lat)*math.sin(tmp_lat))+(math.cos(last_lat)*math.cos(tmp_lat)*math.cos(tmp_lon-last_lon)))*111.302*57.29577951 Modified: pytrainer/trunk/pytrainer/main.py =================================================================== --- pytrainer/trunk/pytrainer/main.py 2009-12-27 06:29:53 UTC (rev 447) +++ pytrainer/trunk/pytrainer/main.py 2009-12-27 22:12:14 UTC (rev 448) @@ -97,13 +97,10 @@ def __init__(self,filename = None, data_path = None): logging.debug('>>') self.data_path = data_path - self.version ="1.7.0_svn#447" + self.version ="1.7.0_svn#448" self.date = Date() - main_dir = os.path.realpath(os.path.dirname(__file__)) #why? - sys.path.insert(0, main_dir) #why? # Checking profile self.profile = Profile(self.data_path,self) - #self.profile.setVersion("0.0") self.profile.isProfileConfigured() self.log_level = log_level self.validate = validate This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |