[chronojump] On jumps/runs if USB cable is disconnected, process can be aborted
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] On jumps/runs if USB cable is disconnected, process can be aborted
- Date: Tue, 10 Mar 2015 16:23:00 +0000 (UTC)
commit 1ab96374aebc6588304fb8682da7e156cdeadf6c
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Mar 10 17:22:16 2015 +0100
On jumps/runs if USB cable is disconnected, process can be aborted
glade/chronojump.glade | 106 ++++++++++++++++++++++++++++++++++++++++++++++-
src/execute/event.cs | 4 ++
src/gui/chronojump.cs | 30 +++++++++++++-
src/gui/error.cs | 17 ++++++++
4 files changed, 152 insertions(+), 5 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index d7818e8..9c300d5 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -6598,6 +6598,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -7445,6 +7448,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
<child>
@@ -8544,6 +8550,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">2</property>
@@ -9284,6 +9293,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">4</property>
@@ -19741,6 +19753,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -20389,6 +20404,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -21529,6 +21547,9 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -21726,6 +21747,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -25734,6 +25758,49 @@ comments</property>
<property name="can_focus">False</property>
<property name="layout_style">spread</property>
<child>
+ <widget class="GtkButton" id="button_abort">
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <signal name="clicked" handler="on_button_abort_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-quit</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="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Abort</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </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_open_database_folder">
<property name="label">Open database folder</property>
<property name="can_focus">True</property>
@@ -25744,7 +25811,7 @@ comments</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>
@@ -25758,7 +25825,7 @@ comments</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -25775,7 +25842,7 @@ comments</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>
@@ -31510,6 +31577,24 @@ options</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -33538,6 +33623,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -34224,6 +34312,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -36876,6 +36967,9 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -37188,6 +37282,9 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -37515,6 +37612,9 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/execute/event.cs b/src/execute/event.cs
index f7f48a3..b90c8a8 100644
--- a/src/execute/event.cs
+++ b/src/execute/event.cs
@@ -246,6 +246,10 @@ public class EventExecute
return true;
}
+ public void ThreadAbort() {
+ thread.Abort();
+ }
+
protected void initializeTimer () {
//put onTimer count to 0 for moving the time progressBar (activiy mode)
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 368838a..a678e5a 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3271,8 +3271,14 @@ public partial class ChronoJumpWindow
LogB.Information("totallyCancelled");
else {
LogB.Information("NOT-totallyCancelled ");
- errorWin = ErrorWindow.Show(Catalog.GetString("Please, touch the contact platform for
full cancelling.\nThen press button\n"));
+ errorWin = ErrorWindow.Show(Catalog.GetString("Please, touch the contact platform for
full cancelling.") + "\n" +
+ Catalog.GetString("Then press Accept") + "\n");
+ errorWin.Button_accept.Clicked -= new EventHandler(checkCancelTotally);
errorWin.Button_accept.Clicked += new EventHandler(checkCancelTotally);
+
+ //abort test when there are problems with USB disconnected
+ errorWin.Show_button_abort();
+ errorWin.Button_abort.Clicked += new EventHandler(abortTest);
}
}
@@ -3369,10 +3375,30 @@ public partial class ChronoJumpWindow
LogB.Information("totallyFinished");
else {
LogB.Information("NOT-totallyFinished ");
- errorWin = ErrorWindow.Show(Catalog.GetString("Please, touch the contact platform for
full finishing.\nThen press this button:\n"));
+ errorWin = ErrorWindow.Show(Catalog.GetString("Please, touch the contact platform for
full finishing.") + "\n" +
+ Catalog.GetString("Then press Accept") + "\n");
+ errorWin.Button_accept.Clicked -= new EventHandler(checkFinishTotally);
errorWin.Button_accept.Clicked += new EventHandler(checkFinishTotally);
+
+ //abort test when there are problems with USB disconnected
+ errorWin.Show_button_abort();
+ errorWin.Button_abort.Clicked += new EventHandler(abortTest);
}
}
+
+ private void abortTest (object o, EventArgs args) {
+ errorWin.Button_abort.Clicked -= new EventHandler(abortTest);
+
+ LogB.Warning("Destroying error window");
+ errorWin.HideAndNull();
+
+ LogB.Warning("Going to abort thread");
+ currentEventExecute.ThreadAbort();
+ LogB.Warning("Aborted");
+
+ sensitiveGuiEventDone();
+ LogB.Warning("Sensitivity restored");
+ }
//runA is not called for this, because it ends different
//and there's a message on gui/eventExecute.cs for runA
diff --git a/src/gui/error.cs b/src/gui/error.cs
index 7b9d09b..b44864d 100644
--- a/src/gui/error.cs
+++ b/src/gui/error.cs
@@ -32,6 +32,7 @@ public class ErrorWindow
{
[Widget] Gtk.Window error_window;
[Widget] Gtk.Label label1;
+ [Widget] Gtk.Button button_abort; //used only when there are problems because USB has been removed on
the middle of the test
[Widget] Gtk.Button button_accept;
[Widget] Gtk.Box hbox_send_log;
[Widget] Gtk.Button button_open_database_folder;
@@ -168,6 +169,13 @@ public class ErrorWindow
);
}
}
+
+ public void Show_button_abort () {
+ button_abort.Show();
+ }
+ private void on_button_abort_clicked (object o, EventArgs args) {
+
+ }
public void Button_accept_label (string str) {
button_accept.Label = str;
@@ -183,6 +191,15 @@ public class ErrorWindow
get { return button_accept; }
}
+ public Button Button_abort {
+ get { return button_abort; }
+ }
+
+ public void HideAndNull() {
+ ErrorWindowBox.error_window.Hide();
+ ErrorWindowBox = null;
+ }
+
~ErrorWindow() {}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]