[chronojump] On change person by rfid shjow dialogPersonPopup



commit 27ab3c3a58ca73e76bc9a9eebe0980db5e87842a
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri May 26 08:15:42 2017 +0200

    On change person by rfid shjow dialogPersonPopup

 chronojump.csproj            |    3 +-
 src/Makefile.am              |    2 +
 src/gui/dialogPersonPopup.cs |   85 ++++++++++++++++++++++++++++++++++++++++++
 src/gui/networks.cs          |   12 +++++-
 4 files changed, 99 insertions(+), 3 deletions(-)
---
diff --git a/chronojump.csproj b/chronojump.csproj
index e70ad50..99e4fef 100644
--- a/chronojump.csproj
+++ b/chronojump.csproj
@@ -1175,6 +1175,7 @@
     <Compile Include="src\sqlite\forceSensor.cs" />
     <Compile Include="src\gui\trigger.cs" />
     <Compile Include="src\rfid.cs" />
+    <Compile Include="src\gui\dialogPersonPopup.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="src\" />
@@ -2221,4 +2222,4 @@
       </Properties>
     </MonoDevelop>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Makefile.am b/src/Makefile.am
index 37870f3..6f142a0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -43,6 +43,7 @@ SOURCES = \
        gui/dialogMessage.cs\
        gui/dialogCalendar.cs\
        gui/dialogImageTest.cs\
+       gui/dialogPersonPopup.cs\
        gui/dialogThreshold.cs\
        gui/repetitiveConditions.cs\
        gui/convertWeight.cs\
@@ -217,6 +218,7 @@ RESOURCES = \
        ../glade/dialog_help_ports.glade \
        ../glade/dialog_image_test.glade \
        ../glade/dialog_message.glade \
+       ../glade/dialog_person_popup.glade \
        ../glade/dialog_server_stats.glade \
        ../glade/dialog_threshold.glade \
        ../glade/edit_event.glade \
diff --git a/src/gui/dialogPersonPopup.cs b/src/gui/dialogPersonPopup.cs
new file mode 100644
index 0000000..f4ad1c1
--- /dev/null
+++ b/src/gui/dialogPersonPopup.cs
@@ -0,0 +1,85 @@
+/*
+ * 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) 2016-2017   Xavier de Blas <xaviblas gmail com> 
+ */
+
+using System;
+using System.IO; 
+using Gtk;
+using Gdk;
+using Glade;
+
+public class DialogPersonPopup
+{
+       [Widget] Gtk.Dialog dialog_person_popup;
+       [Widget] Gtk.Label label_name;
+       [Widget] Gtk.Image image;
+       [Widget] Gtk.Label label_rfid;
+       [Widget] Gtk.TextView textview_task;
+
+       public DialogPersonPopup (int personID, string name, string rfid, string task)
+       {
+               Glade.XML gladeXML;
+               gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "dialog_person_popup.glade", 
"dialog_person_popup", null);
+               gladeXML.Autoconnect(this);
+
+               //put an icon to window
+               UtilGtk.IconWindow(dialog_person_popup);
+
+               label_name.Text = "<b>" + name + "</b>";
+               label_name.UseMarkup = true;
+               label_rfid.Text = rfid;
+
+               string photoFile = Util.GetPhotoFileName(false, personID);
+               if(File.Exists(photoFile)) {
+                       try {
+                               Pixbuf pixbuf = new Pixbuf (photoFile); //from a file
+                               image.Pixbuf = pixbuf;
+                       } catch {
+                               //on windows there are problem using the fileNames that are not on temp
+                               string tempFileName = Path.Combine(Path.GetTempPath(), 
Constants.PhotoSmallTemp +
+                                               Util.GetMultimediaExtension(Constants.MultimediaItems.PHOTO));
+                               File.Copy(photoFile, tempFileName, true);
+                               Pixbuf pixbuf = new Pixbuf (tempFileName);
+                               image.Pixbuf = pixbuf;
+                       }
+               }
+
+               TextBuffer tb = new TextBuffer (new TextTagTable());
+               tb.Text =  task;
+               textview_task.Buffer = tb;
+       }
+
+       public void on_button_close_clicked (object obj, EventArgs args)
+       {
+               dialog_person_popup.Destroy ();
+       }
+
+       private void on_delete_event (object o, DeleteEventArgs args)
+       {
+               dialog_person_popup.Destroy ();
+       }
+
+       //call this if a new person put his rfid code before showing it's data
+       public void DestroyDialog ()
+       {
+               LogB.Information("Destroying dialogPersonPupopu");
+               dialog_person_popup.Destroy ();
+               LogB.Information("Destroyed dialogPersonPupopu");
+       }
+}
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index 90198b9..70ee823 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -74,6 +74,8 @@ public partial class ChronoJumpWindow
        private static bool shouldUpdateRFIDGui;
        private static bool updatingRFIDGuiStuff;
        private bool rfidProcessCancel;
+
+       DialogPersonPopup dialogPersonPopup;
                
        Config configChronojump;
        private void configInitRead()
@@ -414,15 +416,21 @@ public partial class ChronoJumpWindow
                if(currentPersonWasNull)
                        sensitiveGuiYesPerson();
 
-               /*TODO:
                if(pChanged)
                {
+                       /*TODO:
                        int rowToSelect = myTreeViewPersons.FindRow(currentPerson.UniqueID);
                        if(rowToSelect != -1)
                                selectRowTreeView_persons(treeview_persons, rowToSelect);
-               }
                        */
 
+                       if(dialogPersonPopup != null)
+                               dialogPersonPopup.DestroyDialog();
+
+                       dialogPersonPopup = new DialogPersonPopup(
+                                       currentPerson.UniqueID, currentPerson.Name, capturedRFID, "Sample 
task");
+               }
+
                updatingRFIDGuiStuff = false;
 
                Thread.Sleep (100);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]