Skip to content

Commit

Permalink
0.10.1 release
Browse files Browse the repository at this point in the history
Fix time string in recent activities, change layout for pausing/saving run, and add ability to pause
  • Loading branch information
cwayne18 committed Nov 17, 2015
1 parent c21c723 commit f503bd1
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 6 deletions.
40 changes: 37 additions & 3 deletions Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ MainView {
screenSaverEnabled: !Qt.application.active
}

function stopwatch(seconds) {
var totalNumberOfSeconds = seconds;
var hours = parseInt( totalNumberOfSeconds / 3600 );
var minutes = parseInt( (totalNumberOfSeconds - (hours * 3600)) / 60 );
var seconds = Math.floor((totalNumberOfSeconds - ((hours * 3600) + (minutes * 60))));
var hours2 = (hours == 0 ? "" : (hours < 10 ? "0" + hours +":" : hours+":"))
var result = hours2 + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds);
return result
}

ListModel {
id: listModel
}
Expand All @@ -70,6 +80,7 @@ MainView {
console.warn("STARTING GPX")
listModel.clear()
call('geepeeex.onetime_db_fix',[])
call('geepeeex.onetime_db_fix_again_cus_im_dumb',[])
get_units(result)
}
addImportPath(Qt.resolvedUrl('py/'))
Expand All @@ -87,16 +98,19 @@ MainView {
// Load the received data into the list model
listModel.clear()
for (var i=0; i<result.length; i++) {
console.warn(runits)
console.warn(runits);
if (runits == "miles"){
console.warn(result[i].distance)
//console.warn(result[i].speed)
var mi
mi = result[i].distance * 0.62137
result[i].distance = "Distance: "+mi.toFixed(2) + "mi"
}
else if (runits == "kilometers"){
result[i].distance = "Distance: "+result[i].distance + "km"
}
var seconds = parseFloat(result[i].speed) * 60
result[i].speed = "Time: " + stopwatch(seconds)
listModel.append(result[i]);
}

Expand Down Expand Up @@ -304,6 +318,8 @@ MainView {
iconName: "back"
onTriggered: {
PopupUtils.open(areyousure)
am_running = false
timer.stop()
console.log("Run custom back action")
}
}
Expand All @@ -329,16 +345,24 @@ MainView {
text: "Yes I'm sure"
color: UbuntuColors.green
onClicked: {
timer.start()
counter = 0
pygpx.format_timer(0)
timer.restart()
timer.stop()
am_running = false
PopupUtils.close(areyousuredialog)
stack.pop()
}
}
Button {
id: noooooooo
id: noooooooodb
text: "No"
color: UbuntuColors.red
onClicked: {
PopupUtils.close(areyousuredialog)
am_running = true
timer.start()
}
}
}
Expand Down Expand Up @@ -444,9 +468,12 @@ MainView {
day = d.toDateString();
}
}
Row {

Button {
text: "Save Activity"
height: units.gu(10)
width: parent.width /2
color: UbuntuColors.green
onClicked: {

Expand Down Expand Up @@ -479,10 +506,17 @@ MainView {
}
Button {
text: "Cancel"
height: units.gu(10)
width: parent.width / 2
color: UbuntuColors.red
onClicked: PopupUtils.close(dialogue)
onClicked: {
PopupUtils.close(dialogue)
am_running = true
timer.start()
}
}
}
}
}//Dialog component

Rectangle {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"desktop": "app.desktop"
}
},
"version": "0.9",
"version": "0.10.1",
"maintainer": "Chris Wayne <[email protected]>",
"framework" : "ubuntu-sdk-15.04"
}
Expand Down
28 changes: 26 additions & 2 deletions py/geepeeex.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def add_run(gpx, name,act_type,filename,polyline):
print(max_speed)
#print('%sStopped distance: %sm' % stopped_distance)
maxspeed = 'Max speed: {:.2f}km/h'.format(max_speed * 60. ** 2 / 1000. if max_speed else 0)
duration = 'Duration: {:.2f}min'.format(gpx.get_duration() / 60)
duration = '{:.2f}'.format(gpx.get_duration() / 60)

print("-------------------------")
print(name)
Expand Down Expand Up @@ -162,6 +162,29 @@ def onetime_db_fix():
else:
print("db already fixed")

def onetime_db_fix_again_cus_im_dumb():
os.makedirs(filebase, exist_ok=True)
filename = "%s/%s" % (filebase,".dbfixed2")
if not os.path.exists(filename):
print("Fixing db again")
conn = sqlite3.connect('%s/activities.db' % filebase)
numonly = re.compile("(\d*\.\d*)")
cursor = conn.cursor()
a=get_runs()
sql="UPDATE activities SET speed=? WHERE id=?"
for i in a:
print(i["speed"])
b=numonly.search(i["speed"])
cursor.execute(sql, (b.group(0), i["id"]))

conn.commit()
conn.close()
dotfile=open(filename, "w")
dotfile.write("db fixed")
dotfile.close
else:
print("db already fixed")

def rm_run(run):
conn = sqlite3.connect('%s/activities.db' % filebase)
cursor = conn.cursor()
Expand Down Expand Up @@ -209,4 +232,5 @@ def stopwatchery(secs):
else:
hr = str(hr)+":"
print(hr + mins+":"+sec)
return hr + mins+":"+sec
return hr + mins+":"+sec

0 comments on commit f503bd1

Please sign in to comment.