Commit 7a008fe5 authored by Xavier de Blas's avatar Xavier de Blas

Exhibition session selector. Upload jumps to exhibition.

parent 0dde7800
This diff is collapsed.
......@@ -22,6 +22,7 @@ SOURCES = \
gui/eventGraphConfigure.cs\
gui/event.cs\
gui/executeAuto.cs\
gui/exhibition.cs\
gui/forceSensor.cs\
gui/forceSensorAnalyze.cs\
gui/guiTests.cs\
......
......@@ -47,8 +47,11 @@ public class Config
public bool PlaySoundsFromFile;
public bool Exhibition; //like YOMO. does not have rfid capture, user autologout management, and automatic configuration of gui
public string ExhibitionServerURL = "";
public int ExhibitionStationID = -1;
/*
* unused because the default serverURL chronojump.org is ok:
* public string ExhibitionServerURL = "";
* public int ExhibitionStationID = -1;
*/
public Config()
{
......@@ -108,10 +111,12 @@ public class Config
PlaySoundsFromFile = true;
else if(parts[0] == "Exhibition" && Util.StringToBool(parts[1]))
Exhibition = true;
/*
else if(parts[0] == "ExhibitionServerURL" && parts[1] != "")
ExhibitionServerURL = parts[1];
else if(parts[0] == "ExhibitionStationID" && parts[1] != "" && Util.IsNumber(parts[1], false))
ExhibitionStationID = Convert.ToInt32(parts[1]);
*/
} while(true);
}
}
......
......@@ -696,6 +696,8 @@ public partial class ChronoJumpWindow
LogB.Information("Calling configInitRead from gui / ChronojumpWindow");
configInitRead();
if(configChronojump.Exhibition)
exhibitionGuiAtStart();
//presentationInit();
......@@ -4504,6 +4506,10 @@ public partial class ChronoJumpWindow
//unhide buttons for delete last jump
if(! execute_auto_doing)
sensitiveGuiYesEvent();
if(configChronojump.Exhibition)
uploadExhibitionTest(ExhibitionTest.testTypes.JUMP, Convert.ToDouble(Util.GetHeightInCentimeters(currentJump.Tv.ToString())));
}
else if( currentEventExecute.ChronopicDisconnected )
chronopicDisconnectedWhileExecuting();
......@@ -7516,7 +7522,10 @@ LogB.Debug("mc finished 5");
private void sensitiveGuiNoSession ()
{
notebook_session_person.CurrentPage = 0;
if(configChronojump.Exhibition)
notebook_session_person.CurrentPage = 1;
else
notebook_session_person.CurrentPage = 0;
treeview_persons.Sensitive = false;
......
/*
* This file is part of ChronoJump
*
* Chronojump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Chronojump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Copyright (C) 2019 Xavier de Blas <xaviblas@gmail.com>
*/
using System;
using Gtk;
using Glade;
public partial class ChronoJumpWindow
{
[Widget] Gtk.Frame frame_exhibition;
[Widget] Gtk.SpinButton spin_exhibition_school;
[Widget] Gtk.SpinButton spin_exhibition_group;
[Widget] Gtk.Label label_exhibition_4;
[Widget] Gtk.Label label_persons; //persons text show the top of manage persons. Hidden on exhibition to be more clear (1,2,3,4)
private void exhibitionGuiAtStart()
{
notebook_session_person.CurrentPage = 1;
frame_persons.Sensitive = true;
spin_exhibition_school.Value = 0; //need to assign an inital value (if not it shows blank value)
spin_exhibition_group.Value = 0;
label_exhibition_4.Visible = true;
label_persons.Visible = false;
button_persons_up.SetSizeRequest (45,10);
button_persons_down.SetSizeRequest (45,10);
}
//---- spin_exhibition_school stuff
private void on_button_exhibition_school_left10_clicked (object o, EventArgs args)
{
exhibitionSchoolChange(-10);
}
private void on_button_exhibition_school_left_clicked (object o, EventArgs args)
{
exhibitionSchoolChange(-1);
}
private void on_button_exhibition_school_right10_clicked (object o, EventArgs args)
{
exhibitionSchoolChange(+10);
}
private void on_button_exhibition_school_right_clicked (object o, EventArgs args)
{
exhibitionSchoolChange(+1);
}
void exhibitionSchoolChange(int change)
{
double newValue = spin_exhibition_school.Value + change;
double min, max;
spin_exhibition_school.GetRange(out min, out max);
if(newValue < min)
spin_exhibition_school.Value = min;
else if(newValue > max)
spin_exhibition_school.Value = max;
else
spin_exhibition_school.Value = newValue;
}
//---- end of spin_exhibition_school stuff
//---- spin_exhibition_group stuff
private void on_button_exhibition_group_left10_clicked (object o, EventArgs args)
{
exhibitionGroupChange(-10);
}
private void on_button_exhibition_group_left_clicked (object o, EventArgs args)
{
exhibitionGroupChange(-1);
}
private void on_button_exhibition_group_right10_clicked (object o, EventArgs args)
{
exhibitionGroupChange(+10);
}
private void on_button_exhibition_group_right_clicked (object o, EventArgs args)
{
exhibitionGroupChange(+1);
}
void exhibitionGroupChange(int change)
{
double newValue = spin_exhibition_group.Value + change;
double min, max;
spin_exhibition_group.GetRange(out min, out max);
if(newValue < min)
spin_exhibition_group.Value = min;
else if(newValue > max)
spin_exhibition_group.Value = max;
else
spin_exhibition_group.Value = newValue;
}
//---- end of spin_exhibition_group stuff
private void on_button_exhibition_session_load_clicked (object o, EventArgs args)
{
currentSession = SqliteSession.SelectByName(string.Format("{0}-{1}", spin_exhibition_school.Value, spin_exhibition_group.Value));
on_load_session_accepted();
sensitiveGuiYesSession();
}
//---- json upload
private void uploadExhibitionTest(ExhibitionTest.testTypes tt, double result)
{
Json js = new Json();
ExhibitionTest et = new ExhibitionTest(currentSession.UniqueID, currentPerson.UniqueID, tt, result);
if( ! js.UploadExhibitionTest (et))
{
LogB.Error(js.ResultMessage);
//TODO
//SqliteJson.InsertTempExhibitionTest(false, et); //insert only if could'nt be uploaded
}
}
}
......@@ -198,6 +198,9 @@ public partial class ChronoJumpWindow
button_encoder_analyze_image_compujump_send_email.Visible = true;
}
if(configChronojump.Exhibition)
frame_exhibition.Visible = true;
configDo();
}
private void RFIDStart()
......
......@@ -932,6 +932,8 @@ public class Json
return true;
}
//table created with:
//CREATE TABLE exhibitionTest(dt TIMESTAMP DEFAULT CURRENT_TIMESTAMP, sessionID INT NOT NULL, personID INT NOT NULL, testType CHAR(10), result DOUBLE);
public bool UploadExhibitionTest(ExhibitionTest et)
{
// Create a request using a URL that can receive a post.
......@@ -950,8 +952,8 @@ public class Json
json.Add("sessionID", et.sessionID);
json.Add("personID", et.personID);
json.Add("testType", et.testType.ToString()); //todo: check how this enum is uploaded
json.Add("result", et.result);
json.Add("testType", et.testType.ToString());
json.Add("result", et.resultToJson);
// Converts it to a String
String js = json.ToString();
......@@ -1398,7 +1400,7 @@ public class ExhibitionTest
public int personID;
public enum testTypes { JUMP, RUN, FORCE_ROPE, FORCE_SHOT, INERTIAL }; //run will be a an intervallic run
public testTypes testType;
public float result;
public double result;
/* result is:
* on jumps is height
* on runs is maximum speed ?
......@@ -1407,7 +1409,7 @@ public class ExhibitionTest
* on inertial is mean power of the maximum repetiton
*/
public ExhibitionTest(int sessionID, int personID, testTypes testType, float result)
public ExhibitionTest(int sessionID, int personID, testTypes testType, double result)
{
this.sessionID = sessionID;
this.personID = personID;
......@@ -1415,6 +1417,10 @@ public class ExhibitionTest
this.result = result;
}
~ExhibitionTest() {}
//convert to decimal point and str
public string resultToJson {
get { return Util.ConvertToPoint(result); }
}
~ExhibitionTest() {}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment