[chronojump] Big change: all contacts tests end on first thread. Safer/Easier
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Big change: all contacts tests end on first thread. Safer/Easier
- Date: Fri, 6 Jan 2017 00:25:47 +0000 (UTC)
commit d6d5ea7736b513a4dfb21ea777d70eb86b2a521b
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Jan 6 01:20:16 2017 +0100
Big change: all contacts tests end on first thread. Safer/Easier
src/execute/event.cs | 16 ---------
src/execute/jump.cs | 22 ------------
src/execute/multiChronopic.cs | 11 ------
src/execute/pulse.cs | 9 -----
src/execute/reactionTime.cs | 10 ------
src/execute/run.cs | 25 +-------------
src/gui/chronojump.cs | 72 ++++++++++++++++++++--------------------
src/gui/eventExecute.cs | 3 +-
8 files changed, 39 insertions(+), 129 deletions(-)
---
diff --git a/src/execute/event.cs b/src/execute/event.cs
index 8e65c00..ff614d7 100644
--- a/src/execute/event.cs
+++ b/src/execute/event.cs
@@ -117,8 +117,6 @@ public class EventExecute
//for raise a signal and manage it on chronojump.cs
protected Gtk.Button fakeButtonUpdateGraph;
- protected Gtk.Button fakeButtonFinished;
- protected Gtk.Button fakeButtonEventEnded;
//this should be a safer way, because will be called when thread has dyed, then will be the last
action in the GTK thread.
//suitable for calling sensitiveGuiEventDone without problems
//sensitiveGuiEventDone causes problems on changing (or even reading) properties of gtk stuff outside
of gtk thread
@@ -272,7 +270,6 @@ public class EventExecute
//updateTimeProgressBar();
if(needEndEvent) {
//app1.EventEnded();
- fakeButtonEventEnded.Click();
//needEndEvent = false;
if(needUpdateGraphType == eventType.MULTICHRONOPIC && type ==
Constants.RunAnalysisName && finish)
//app1.RunATouchPlatform();
@@ -481,11 +478,6 @@ public class EventExecute
protected void cancel_event_before_start(object o, EventArgs args)
{
cancel = true;
- //app1.EventEnded();
- fakeButtonEventEnded.Click();
-
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
//event will be raised, and managed in chronojump.cs
//calls sensitiveGuiEventDone()
@@ -513,14 +505,6 @@ public class EventExecute
get { return fakeButtonUpdateGraph; }
}
- public Gtk.Button FakeButtonFinished {
- get { return fakeButtonFinished; }
- }
-
- public Gtk.Button FakeButtonEventEnded {
- get { return fakeButtonEventEnded; }
- }
-
public Gtk.Button FakeButtonThreadDyed {
get { return fakeButtonThreadDyed; }
}
diff --git a/src/execute/jump.cs b/src/execute/jump.cs
index 86070da..584f69b 100644
--- a/src/execute/jump.cs
+++ b/src/execute/jump.cs
@@ -82,8 +82,6 @@ public class JumpExecute : EventExecute
}
fakeButtonUpdateGraph = new Gtk.Button();
- fakeButtonEventEnded = new Gtk.Button();
- fakeButtonFinished = new Gtk.Button();
fakeButtonThreadDyed = new Gtk.Button();
simulated = false;
@@ -430,12 +428,6 @@ public class JumpExecute : EventExecute
} while ( ! success && ! cancel );
LogB.Information("Exited waitEvent main bucle");
-
- if(cancel)
- {
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
- }
}
protected override bool shouldFinishByTime() {
@@ -477,9 +469,6 @@ public class JumpExecute : EventExecute
eventDone = new Jump(uniqueID, personID, sessionID, type, tv, tc, fall,
weight, description, angle, Util.BoolToNegativeInt(simulated));
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
-
PrepareEventGraphJumpSimpleObject = new PrepareEventGraphJumpSimple(tv, tc, sessionID,
personID, table, type);
needUpdateGraphType = eventType.JUMP;
needUpdateGraph = true;
@@ -585,8 +574,6 @@ public class JumpRjExecute : JumpExecute
else { hasFall = false; }
fakeButtonUpdateGraph = new Gtk.Button();
- fakeButtonEventEnded = new Gtk.Button();
- fakeButtonFinished = new Gtk.Button();
fakeButtonThreadDyed = new Gtk.Button();
simulated = false;
@@ -846,11 +833,6 @@ public class JumpRjExecute : JumpExecute
cancel = true;
}
}
- //if(cancel || finish)
- if(cancel) {
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
- }
}
protected override bool shouldFinishByTime() {
@@ -1076,10 +1058,6 @@ public class JumpRjExecute : JumpExecute
feedbackMessage = "";
needShowFeedbackMessage = true;
-
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
-
needEndEvent = true; //used for hiding some buttons on eventWindow, and also for
updateTimeProgressBar here
}
}
diff --git a/src/execute/multiChronopic.cs b/src/execute/multiChronopic.cs
index babc401..57b52a3 100644
--- a/src/execute/multiChronopic.cs
+++ b/src/execute/multiChronopic.cs
@@ -178,8 +178,6 @@ public class MultiChronopicExecute : EventExecute
private void initValues() {
fakeButtonUpdateGraph = new Gtk.Button();
- fakeButtonEventEnded = new Gtk.Button();
- fakeButtonFinished = new Gtk.Button();
fakeButtonThreadDyed = new Gtk.Button();
simulated = false;
@@ -489,15 +487,6 @@ public class MultiChronopicExecute : EventExecute
//call write on gui/chronojump.cs, because if done in execute/MultiChronopic,
//will be called n times if n chronopics are working
//write(false); //tempTable
-
- //event will be raised, and managed in chronojump.cs
- //only one call (that comes from first chronopic)
- if(cpNum == 1)
- fakeButtonFinished.Click();
- }
- if(cancel) {
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
}
}
diff --git a/src/execute/pulse.cs b/src/execute/pulse.cs
index 9ac118a..918ffea 100644
--- a/src/execute/pulse.cs
+++ b/src/execute/pulse.cs
@@ -77,8 +77,6 @@ public class PulseExecute : EventExecute
this.egd = egd;
fakeButtonUpdateGraph = new Gtk.Button();
- fakeButtonEventEnded = new Gtk.Button();
- fakeButtonFinished = new Gtk.Button();
fakeButtonThreadDyed = new Gtk.Button();
simulated = false;
@@ -299,10 +297,6 @@ public class PulseExecute : EventExecute
write();
pulsePhase = pulsePhases.DONE;
}
- if(cancel || finish) {
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
- }
}
//now pulses are not thought for being able to finish by time
@@ -358,9 +352,6 @@ public class PulseExecute : EventExecute
needShowFeedbackMessage = true;
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
-
//app1.PreparePulseGraph(Util.GetLast(timesString), timesString);
PrepareEventGraphPulseObject = new PrepareEventGraphPulse(Util.GetLast(timesString),
timesString);
needUpdateGraphType = eventType.PULSE;
diff --git a/src/execute/reactionTime.cs b/src/execute/reactionTime.cs
index bed08d6..09309a7 100644
--- a/src/execute/reactionTime.cs
+++ b/src/execute/reactionTime.cs
@@ -59,8 +59,6 @@ public class ReactionTimeExecute : EventExecute
this.description = description;
fakeButtonUpdateGraph = new Gtk.Button();
- fakeButtonEventEnded = new Gtk.Button();
- fakeButtonFinished = new Gtk.Button();
fakeButtonThreadDyed = new Gtk.Button();
FakeButtonReactionTimeStart = new Gtk.Button();
@@ -255,11 +253,6 @@ public class ReactionTimeExecute : EventExecute
//Log.WriteLine("PREEXIT");
} while ( ! success && ! cancel );
//Log.WriteLine("EXIT");
-
- if(cancel) {
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
- }
}
protected override bool shouldFinishByTime() {
@@ -299,9 +292,6 @@ public class ReactionTimeExecute : EventExecute
//define the created object
eventDone = new ReactionTime(uniqueID, personID, sessionID, type, time, description,
Util.BoolToNegativeInt(simulated));
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
-
//app1.PrepareJumpSimpleGraph(tv, tc);
PrepareEventGraphReactionTimeObject = new PrepareEventGraphReactionTime(time, sessionID,
personID, table, type);
needUpdateGraphType = eventType.REACTIONTIME;
diff --git a/src/execute/run.cs b/src/execute/run.cs
index d8365e6..1d9325c 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -79,8 +79,6 @@ public class RunExecute : EventExecute
this.speedStartArrival = speedStartArrival;
fakeButtonUpdateGraph = new Gtk.Button();
- fakeButtonEventEnded = new Gtk.Button();
- fakeButtonFinished = new Gtk.Button();
fakeButtonThreadDyed = new Gtk.Button();
simulated = false;
@@ -325,11 +323,6 @@ public class RunExecute : EventExecute
}
}
} while ( ! success && ! cancel );
-
- if(cancel) {
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
- }
}
protected override bool shouldFinishByTime() {
@@ -421,11 +414,7 @@ public class RunExecute : EventExecute
//define the created object
eventDone = new Run(uniqueID, personID, sessionID, type, distance, time, description,
Util.BoolToNegativeInt(simulated), !startIn);
-
-
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
-
+
//app1.PrepareRunSimpleGraph(time, distance/time);
PrepareEventGraphRunSimpleObject = new PrepareEventGraphRunSimple(time, distance/time,
sessionID, personID, table, type);
needUpdateGraphType = eventType.RUN;
@@ -514,8 +503,6 @@ public class RunIntervalExecute : RunExecute
this.speedStartArrival = speedStartArrival;
fakeButtonUpdateGraph = new Gtk.Button();
- fakeButtonEventEnded = new Gtk.Button();
- fakeButtonFinished = new Gtk.Button();
fakeButtonThreadDyed = new Gtk.Button();
simulated = false;
@@ -758,10 +745,6 @@ public class RunIntervalExecute : RunExecute
cancel = true;
}
}
- if(cancel || finish) {
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
- }
}
protected override string countDownMessage() {
@@ -886,8 +869,6 @@ public class RunIntervalExecute : RunExecute
//mark for not having problems with cancelled
cancel = true;
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
//end this piece of code
return;
@@ -964,10 +945,6 @@ public class RunIntervalExecute : RunExecute
feedbackMessage = "";
needShowFeedbackMessage = true;
-
- //event will be raised, and managed in chronojump.cs
- fakeButtonFinished.Click();
-
PrepareEventGraphRunIntervalObject = new PrepareEventGraphRunInterval(
distanceIntervalFixed, Util.GetLast(intervalTimesString),
intervalTimesString, distanceTotal, distancesString, startIn);
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 6fb2135..877520a 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3883,17 +3883,12 @@ public partial class ChronoJumpWindow
thisJumpIsSimple = true; //used by: on_event_execute_update_graph_in_progress_clicked
currentEventExecute.FakeButtonUpdateGraph.Clicked +=
new EventHandler(on_event_execute_update_graph_in_progress_clicked);
- currentEventExecute.FakeButtonEventEnded.Clicked += new
EventHandler(on_event_execute_EventEnded);
-
- currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_jump_finished);
currentEventExecute.FakeButtonThreadDyed.Clicked += new
EventHandler(on_test_finished_can_touch_gtk);
}
- private void on_jump_finished (object o, EventArgs args)
+ private void on_jump_finished ()
{
- currentEventExecute.FakeButtonFinished.Clicked -= new EventHandler(on_jump_finished);
-
//test can be deleted if not cancelled
button_delete_last_test.Sensitive = ! currentEventExecute.Cancel;
@@ -3957,6 +3952,35 @@ public partial class ChronoJumpWindow
private void on_test_finished_can_touch_gtk (object o, EventArgs args)
{
currentEventExecute.FakeButtonThreadDyed.Clicked -= new
EventHandler(on_test_finished_can_touch_gtk);
+
+ on_event_execute_EventEnded();
+
+ LogB.Information(" cantouch 0: calling on_xxx_finished...");
+ switch (currentEventType.Type)
+ {
+ case EventType.Types.JUMP:
+ if(thisJumpIsSimple)
+ on_jump_finished();
+ else
+ on_jump_rj_finished();
+ break;
+ case EventType.Types.RUN:
+ if(thisRunIsSimple)
+ on_run_finished();
+ else
+ on_run_interval_finished();
+ break;
+ case EventType.Types.REACTIONTIME:
+ on_reaction_time_finished();
+ break;
+ case EventType.Types.PULSE:
+ on_pulse_finished();
+ break;
+ case EventType.Types.MULTICHRONOPIC:
+ on_multi_chronopic_finished();
+ break;
+ }
+
LogB.Information(" cantouch1 ");
if(! execute_auto_doing)
sensitiveGuiEventDone();
@@ -4096,17 +4120,13 @@ public partial class ChronoJumpWindow
thisJumpIsSimple = false; //used by: on_event_execute_update_graph_in_progress_clicked
currentEventExecute.FakeButtonUpdateGraph.Clicked +=
new EventHandler(on_event_execute_update_graph_in_progress_clicked);
- currentEventExecute.FakeButtonEventEnded.Clicked += new
EventHandler(on_event_execute_EventEnded);
- currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_jump_rj_finished);
currentEventExecute.FakeButtonThreadDyed.Clicked += new
EventHandler(on_test_finished_can_touch_gtk);
}
- private void on_jump_rj_finished (object o, EventArgs args)
+ private void on_jump_rj_finished ()
{
LogB.Information("ON JUMP RJ FINISHED");
- currentEventExecute.FakeButtonFinished.Clicked -= new EventHandler(on_jump_rj_finished);
-
//test can be deleted if not cancelled
button_delete_last_test.Sensitive = ! currentEventExecute.Cancel;
@@ -4229,15 +4249,11 @@ public partial class ChronoJumpWindow
thisRunIsSimple = true; //used by: on_event_execute_update_graph_in_progress_clicked
currentEventExecute.FakeButtonUpdateGraph.Clicked +=
new EventHandler(on_event_execute_update_graph_in_progress_clicked);
- currentEventExecute.FakeButtonEventEnded.Clicked += new
EventHandler(on_event_execute_EventEnded);
- currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_run_finished);
currentEventExecute.FakeButtonThreadDyed.Clicked += new
EventHandler(on_test_finished_can_touch_gtk);
}
- private void on_run_finished (object o, EventArgs args)
+ private void on_run_finished ()
{
- currentEventExecute.FakeButtonFinished.Clicked -= new EventHandler(on_run_finished);
-
//test can be deleted if not cancelled
button_delete_last_test.Sensitive = ! currentEventExecute.Cancel;
@@ -4357,16 +4373,12 @@ public partial class ChronoJumpWindow
thisRunIsSimple = false; //used by: on_event_execute_update_graph_in_progress_clicked
currentEventExecute.FakeButtonUpdateGraph.Clicked +=
new EventHandler(on_event_execute_update_graph_in_progress_clicked);
- currentEventExecute.FakeButtonEventEnded.Clicked += new
EventHandler(on_event_execute_EventEnded);
- currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_run_interval_finished);
currentEventExecute.FakeButtonThreadDyed.Clicked += new
EventHandler(on_test_finished_can_touch_gtk);
}
- private void on_run_interval_finished (object o, EventArgs args)
+ private void on_run_interval_finished ()
{
- currentEventExecute.FakeButtonFinished.Clicked -= new EventHandler(on_run_interval_finished);
-
//test can be deleted if not cancelled
button_delete_last_test.Sensitive = ! currentEventExecute.Cancel;
@@ -4503,8 +4515,6 @@ public partial class ChronoJumpWindow
currentEventExecute.FakeButtonUpdateGraph.Clicked +=
new EventHandler(on_event_execute_update_graph_in_progress_clicked);
- currentEventExecute.FakeButtonEventEnded.Clicked += new
EventHandler(on_event_execute_EventEnded);
- currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_reaction_time_finished);
currentEventExecute.FakeButtonThreadDyed.Clicked += new
EventHandler(on_test_finished_can_touch_gtk);
}
@@ -4550,10 +4560,8 @@ public partial class ChronoJumpWindow
}
- private void on_reaction_time_finished (object o, EventArgs args)
+ private void on_reaction_time_finished ()
{
- currentEventExecute.FakeButtonFinished.Clicked -= new EventHandler(on_reaction_time_finished);
-
//test can be deleted if not cancelled
button_delete_last_test.Sensitive = ! currentEventExecute.Cancel;
@@ -4651,17 +4659,13 @@ public partial class ChronoJumpWindow
currentEventExecute.FakeButtonUpdateGraph.Clicked +=
new EventHandler(on_event_execute_update_graph_in_progress_clicked);
- currentEventExecute.FakeButtonEventEnded.Clicked += new
EventHandler(on_event_execute_EventEnded);
- currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_pulse_finished);
currentEventExecute.FakeButtonThreadDyed.Clicked += new
EventHandler(on_test_finished_can_touch_gtk);
}
- private void on_pulse_finished (object o, EventArgs args)
+ private void on_pulse_finished ()
{
LogB.Information("pulse finished");
- currentEventExecute.FakeButtonFinished.Clicked -= new EventHandler(on_pulse_finished);
-
//test can be deleted if not cancelled
button_delete_last_test.Sensitive = ! currentEventExecute.Cancel;
@@ -4937,22 +4941,18 @@ public partial class ChronoJumpWindow
currentEventExecute.FakeButtonUpdateGraph.Clicked +=
new EventHandler(on_event_execute_update_graph_in_progress_clicked);
- currentEventExecute.FakeButtonEventEnded.Clicked += new
EventHandler(on_event_execute_EventEnded);
// currentEventExecute.FakeButtonRunATouchPlatform.Clicked += new
EventHandler(on_event_execute_RunATouchPlatform);
- currentEventExecute.FakeButtonFinished.Clicked += new
EventHandler(on_multi_chronopic_finished);
currentEventExecute.FakeButtonThreadDyed.Clicked += new
EventHandler(on_test_finished_can_touch_gtk);
}
bool multiFinishing;
- private void on_multi_chronopic_finished (object o, EventArgs args)
+ private void on_multi_chronopic_finished ()
{
if(multiFinishing)
return;
else
multiFinishing = true;
- currentEventExecute.FakeButtonFinished.Clicked -= new
EventHandler(on_multi_chronopic_finished);
-
//test can be deleted if not cancelled
button_delete_last_test.Sensitive = ! currentEventExecute.Cancel;
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 83fd81e..e6ac755 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -2006,7 +2006,8 @@ public partial class ChronoJumpWindow
}
- private void on_event_execute_EventEnded(object o, EventArgs args) {
+ private void on_event_execute_EventEnded()
+ {
hideButtons();
checkbutton_video.Sensitive = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]