[chronojump] Exhibition session selector. Upload jumps to exhibition.
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Exhibition session selector. Upload jumps to exhibition.
- Date: Sun, 24 Feb 2019 23:07:03 +0000 (UTC)
commit 7a008fe53eb3212fb70eaec87f6d760188e2786a
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Feb 25 00:05:29 2019 +0100
Exhibition session selector. Upload jumps to exhibition.
glade/app1.glade | 572 ++++++++++++++++++++++++++++++++++++++++++++++++--
src/Makefile.am | 1 +
src/config.cs | 9 +-
src/gui/chronojump.cs | 11 +-
src/gui/exhibition.cs | 137 ++++++++++++
src/gui/networks.cs | 3 +
src/json.cs | 16 +-
7 files changed, 722 insertions(+), 27 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 374bc26a..56a45bf3 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1842,6 +1842,12 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkLabel"
id="label_start_selector_jumps">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -2611,6 +2617,523 @@ EncoderInertialCapture</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
+ <child>
+ <widget class="GtkFrame" id="frame_exhibition">
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">1</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment44">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">4</property>
+ <property name="bottom_padding">4</property>
+ <child>
+ <widget class="GtkVBox" id="vbox33">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">4</property>
+ <property name="spacing">16</property>
+ <child>
+ <widget class="GtkVBox" id="vbox135">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="hbox307">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel" id="label383">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">(1)</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label385">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">Escola</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton"
id="spin_exhibition_school">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property
name="primary_icon_activatable">False</property>
+ <property
name="secondary_icon_activatable">False</property>
+ <property
name="primary_icon_sensitive">True</property>
+ <property
name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">0 0 199 1 10
0</property>
+ <property name="numeric">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox299">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkButton"
id="button_exhibition_school_left10">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="relief">half</property>
+ <signal name="clicked"
handler="on_button_exhibition_school_left10_clicked" swapped="no"/>
+ <accelerator key="Down" signal="clicked"
modifiers="GDK_CONTROL_MASK"/>
+ <child>
+ <widget class="GtkHBox" id="hbox306">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkArrow" id="arrow2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="arrow_type">left</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkArrow" id="arrow3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="arrow_type">left</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_exhibition_school_left">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="relief">half</property>
+ <signal name="clicked"
handler="on_button_exhibition_school_left_clicked" swapped="no"/>
+ <accelerator key="Down" signal="clicked"
modifiers="GDK_CONTROL_MASK"/>
+ <child>
+ <widget class="GtkArrow" id="arrow1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="arrow_type">left</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_exhibition_school_right">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="relief">half</property>
+ <signal name="clicked"
handler="on_button_exhibition_school_right_clicked" swapped="no"/>
+ <accelerator key="Down" signal="clicked"
modifiers="GDK_CONTROL_MASK"/>
+ <child>
+ <widget class="GtkArrow" id="arrow4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_exhibition_school_right10">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="relief">half</property>
+ <signal name="clicked"
handler="on_button_exhibition_school_right10_clicked" swapped="no"/>
+ <accelerator key="Down" signal="clicked"
modifiers="GDK_CONTROL_MASK"/>
+ <child>
+ <widget class="GtkHBox" id="hbox309">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkArrow" id="arrow5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkArrow" id="arrow6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox136">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkHBox" id="hbox310">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel" id="label387">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">(2)</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label386">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">Grup-classe</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton"
id="spin_exhibition_group">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property
name="primary_icon_activatable">False</property>
+ <property
name="secondary_icon_activatable">False</property>
+ <property
name="primary_icon_sensitive">True</property>
+ <property
name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">0 0 9 1 10
0</property>
+ <property name="numeric">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox311">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkButton"
id="button_exhibition_group_left10">
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="relief">half</property>
+ <signal name="clicked"
handler="on_button_exhibition_group_left10_clicked" swapped="no"/>
+ <accelerator key="Down" signal="clicked"
modifiers="GDK_CONTROL_MASK"/>
+ <child>
+ <widget class="GtkHBox" id="hbox312">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkArrow" id="arrow7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="arrow_type">left</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkArrow" id="arrow8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="arrow_type">left</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_exhibition_group_left">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="relief">half</property>
+ <signal name="clicked"
handler="on_button_exhibition_group_left_clicked" swapped="no"/>
+ <accelerator key="Down" signal="clicked"
modifiers="GDK_CONTROL_MASK"/>
+ <child>
+ <widget class="GtkArrow" id="arrow9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="arrow_type">left</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_exhibition_group_right">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="relief">half</property>
+ <signal name="clicked"
handler="on_button_exhibition_group_right_clicked" swapped="no"/>
+ <accelerator key="Down" signal="clicked"
modifiers="GDK_CONTROL_MASK"/>
+ <child>
+ <widget class="GtkArrow" id="arrow10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_exhibition_group_right10">
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="relief">half</property>
+ <signal name="clicked"
handler="on_button_exhibition_group_right10_clicked" swapped="no"/>
+ <accelerator key="Down" signal="clicked"
modifiers="GDK_CONTROL_MASK"/>
+ <child>
+ <widget class="GtkHBox" id="hbox313">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkArrow" id="arrow11">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkArrow" id="arrow12">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox314">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">20</property>
+ <child>
+ <widget class="GtkLabel" id="label388">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">(3)</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_exhibition_session_load">
+ <property name="label">Selecciona</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_exhibition_session_load_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <placeholder/>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<widget class="GtkFrame" id="frame_persons_top">
<property name="visible">True</property>
@@ -2635,6 +3158,17 @@ EncoderInertialCapture</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
+ <widget class="GtkLabel" id="label_exhibition_4">
+ <property name="can_focus">False</property>
+ <property name="label">(4)</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkButton"
id="button_manage_persons">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -2656,11 +3190,11 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label197">
+ <widget class="GtkLabel" id="label_persons">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
@@ -2670,7 +3204,7 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -2734,7 +3268,7 @@ EncoderInertialCapture</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
@@ -3034,7 +3568,7 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -3057,7 +3591,7 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -3493,7 +4027,7 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
@@ -19673,18 +20207,6 @@ Concentric</property>
<placeholder/>
</child>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkCheckButton"
id="checkbutton_force_sensor_ai_b">
<property name="width_request">30</property>
<property name="visible">True</property>
@@ -19821,6 +20343,12 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -28146,6 +28674,12 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index 404b53a8..9e33400a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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\
diff --git a/src/config.cs b/src/config.cs
index 707a86f2..bcc196c8 100644
--- a/src/config.cs
+++ b/src/config.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);
}
}
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index b419c04b..bedaaa90 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -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;
diff --git a/src/gui/exhibition.cs b/src/gui/exhibition.cs
new file mode 100644
index 00000000..4ef60348
--- /dev/null
+++ b/src/gui/exhibition.cs
@@ -0,0 +1,137 @@
+/*
+ * 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
+ }
+ }
+
+}
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index 75f559b1..a5f14c70 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -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()
diff --git a/src/json.cs b/src/json.cs
index ce045210..449ca603 100644
--- a/src/json.cs
+++ b/src/json.cs
@@ -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() {}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]