[chronojump] Compujump don't autologout while capturing. Autologout checkbox on rfid id. NEED TESTS!
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Compujump don't autologout while capturing. Autologout checkbox on rfid id. NEED TESTS!
- Date: Tue, 27 Mar 2018 22:34:44 +0000 (UTC)
commit 1b6ffb0d47d9f552ba8a04cdaf082d2ff8596cd8
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Mar 28 00:33:22 2018 +0200
Compujump don't autologout while capturing. Autologout checkbox on rfid id. NEED TESTS!
glade/dialog_person_popup.glade | 38 +++++++++++++++++++++++++++-----------
src/gui/chronojump.cs | 23 +++++++++++++++++++++--
src/gui/dialogPersonPopup.cs | 13 +++++++++++++
src/gui/networks.cs | 11 +++++++++++
4 files changed, 72 insertions(+), 13 deletions(-)
---
diff --git a/glade/dialog_person_popup.glade b/glade/dialog_person_popup.glade
index 5fec012..644e9bf 100644
--- a/glade/dialog_person_popup.glade
+++ b/glade/dialog_person_popup.glade
@@ -50,6 +50,17 @@
<property name="can_focus">False</property>
<property name="spacing">20</property>
<child>
+ <widget class="GtkLabel" id="label_rfid">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">label</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -235,6 +246,22 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_autologout">
+ <property name="label" translatable="yes">Logout
automatically</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_checkbutton_autologout_toggled"
swapped="no"/>
+ </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>
@@ -256,17 +283,6 @@
<property name="position">0</property>
</packing>
</child>
- <child>
- <widget class="GtkLabel" id="label_rfid">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">label</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
</widget>
<packing>
<property name="expand">True</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index d998f80..95b97cb 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -681,6 +681,7 @@ public partial class ChronoJumpWindow
restTime = new RestTime();
updatingRestTimes = true;
GLib.Timeout.Add(1000, new GLib.TimeoutHandler(updateRestTimes)); //each s, better than 5s
for don't have problems sorting data on treeview
+ timeMarginAfterCapture = DateTime.Now;
// ------ Starting main window ------
@@ -4276,16 +4277,34 @@ public partial class ChronoJumpWindow
}
//called each second and after a test
+ DateTime timeMarginAfterCapture;
bool updateRestTimes()
{
if(! updatingRestTimes)
return false;
- if( configChronojump.Compujump && currentPerson != null &&
+ //Compujump manage autologout
+ if( configChronojump.Compujump && compujumpAutologout && currentPerson != null &&
DateTime.Now.Subtract(currentPersonCompujumpLoginTime).TotalMinutes >= 3 &&
//login time minimum 3'
restTime.CompujumpPersonNeedLogout(currentPerson.UniqueID) )
//3' since last executed test
{
- compujumpPersonLogoutDo();
+ //if capturing runInterval or encoder, don't autologout
+ if( ! networksRunIntervalCanChangePersonSQLReady ||
+ (eCapture != null && capturingCsharp ==
encoderCaptureProcess.CAPTURING) )
+ {
+ /*
+ * and set timeMarginAfterCapture variable to have a delay between
+ * encoderCaptureProcess != CAPTURING and restTime is updated (after capture).
+ * This will not allow to autologout just at end of capture, because it will
be a margin of 10 seconds
+ * and then also the restTime.CompujumpPersonNeedLogout will add 3 extra
minutes
+ */
+ timeMarginAfterCapture = DateTime.Now;
+ }
+ else {
+ TimeSpan span = DateTime.Now - timeMarginAfterCapture;
+ if(span.TotalSeconds > 10)
+ compujumpPersonLogoutDo();
+ }
}
if( ! configChronojump.PersonWinHide)
diff --git a/src/gui/dialogPersonPopup.cs b/src/gui/dialogPersonPopup.cs
index 42257bc..3a83c99 100644
--- a/src/gui/dialogPersonPopup.cs
+++ b/src/gui/dialogPersonPopup.cs
@@ -31,6 +31,7 @@ public class DialogPersonPopup
[Widget] Gtk.Label label_name;
[Widget] Gtk.Image image_person;
[Widget] Gtk.Image image_person_logout;
+ [Widget] Gtk.CheckButton checkbutton_autologout;
[Widget] Gtk.Image image_close;
[Widget] Gtk.Label label_rfid;
[Widget] Gtk.VBox vbox_tasks_parametrized;
@@ -49,7 +50,9 @@ public class DialogPersonPopup
private Task taskActive;
public Button Fake_button_start_task;
public Button Fake_button_person_logout;
+ public Button Fake_button_person_autologout_changed;
public bool Visible;
+ public bool Autologout;
public DialogPersonPopup (int personID, string name, string rfid,
List<Task> tasks, List<StationCount> stationsCount, bool serverConnected)
@@ -108,6 +111,9 @@ public class DialogPersonPopup
}
}
+ //set autologout by default is true
+ Autologout = true;
+ checkbutton_autologout.Active = true;
//2) Show tasks stuff
list_tasks_fixed = new List<Task>();
@@ -118,6 +124,7 @@ public class DialogPersonPopup
taskActive = new Task();
Fake_button_start_task = new Gtk.Button();
Fake_button_person_logout = new Gtk.Button();
+ Fake_button_person_autologout_changed = new Gtk.Button();
bool task_parametrized_exist = false;
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_capture_big.png");
@@ -265,6 +272,12 @@ public class DialogPersonPopup
Fake_button_person_logout.Click();
}
+ private void on_checkbutton_autologout_toggled (object o, EventArgs args)
+ {
+ Autologout = checkbutton_autologout.Active;
+ Fake_button_person_autologout_changed.Click();
+ }
+
public void on_button_close_clicked (object obj, EventArgs args)
{
Visible = false;
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index dc51024..1db3c8c 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -97,6 +97,7 @@ public partial class ChronoJumpWindow
private bool rfidProcessCancel;
private bool rfidIsDifferent;
private DateTime currentPersonCompujumpLoginTime;
+ private bool compujumpAutologout;
DialogPersonPopup dialogPersonPopup;
@@ -720,6 +721,8 @@ public partial class ChronoJumpWindow
//3) get other stationsCount
List<StationCount> stationsCount =
json.GetOtherStationsWithPendingTasks(currentPerson.UniqueID, configChronojump.CompujumpStationID);
+ compujumpAutologout = true;
+
//4) show dialog
showDialogPersonPopup(tasks, stationsCount, json.Connected);
}
@@ -740,6 +743,9 @@ public partial class ChronoJumpWindow
dialogPersonPopup.Fake_button_person_logout.Clicked -= new
EventHandler(compujumpPersonLogout);
dialogPersonPopup.Fake_button_person_logout.Clicked += new
EventHandler(compujumpPersonLogout);
+
+ dialogPersonPopup.Fake_button_person_autologout_changed.Clicked -= new
EventHandler(compujumpPersonAutoLogoutChanged);
+ dialogPersonPopup.Fake_button_person_autologout_changed.Clicked += new
EventHandler(compujumpPersonAutoLogoutChanged);
}
private void compujumpTaskStart(object o, EventArgs args)
@@ -842,6 +848,11 @@ public partial class ChronoJumpWindow
sensitiveGuiNoPerson ();
}
+ private void compujumpPersonAutoLogoutChanged(object o, EventArgs args)
+ {
+ compujumpAutologout = dialogPersonPopup.Autologout;
+ }
+
/*
*
* This code uses a watcher to see changes on a filename
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]