[chronojump] camera works on windows. chronopic reload disables. minor changes
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] camera works on windows. chronopic reload disables. minor changes
- Date: Tue, 19 Apr 2011 19:32:15 +0000 (UTC)
commit 3d33c9b8455341ee808e85121bbfc33de983ce3f
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Apr 19 18:12:42 2011 +0200
camera works on windows. chronopic reload disables. minor changes
glade/chronojump.glade | 5 +--
src/gui/chronojump.cs | 35 ++++++++++++++-----
src/gui/chronopic.cs | 45 ++++++++++++++++---------
src/gui/chronopicConnection.cs | 7 ++--
src/gui/person.cs | 71 ++++++++++++++++++++++++++-------------
src/gui/preferences.cs | 6 ++--
src/util.cs | 6 +++-
7 files changed, 114 insertions(+), 61 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index c5139f5..31489a4 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -2035,9 +2035,8 @@
</child>
<child>
<widget class="GtkLabel" id="label_video_experimental">
- <property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">EXPERIMENTAL, Chronojump may crash.</property>
+ <property name="label">EXPERIMENTAL, Chronojump may crash.</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -23543,11 +23542,9 @@ Evaluator can use real name or nickname.</property>
<child>
<widget class="GtkButton" id="button_reload">
<property name="label">gtk-refresh</property>
- <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
- <signal name="clicked" handler="on_button_reload_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 0410f41..3afcd99 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2340,10 +2340,20 @@ public partial class ChronoJumpWindow
//when adding new person, photos cannot be recorded as currentPerson.UniqueID
//because it was undefined. Copy them now
if(File.Exists(Util.GetPhotoTempFileName(false)) && File.Exists(Util.GetPhotoTempFileName(true))) {
- File.Move(Util.GetPhotoTempFileName(false),
- Util.GetPhotoFileName(false, currentPerson.UniqueID));
- File.Move(Util.GetPhotoTempFileName(true),
- Util.GetPhotoFileName(true, currentPerson.UniqueID));
+ try {
+ File.Move(Util.GetPhotoTempFileName(false),
+ Util.GetPhotoFileName(false, currentPerson.UniqueID));
+ } catch {
+ File.Copy(Util.GetPhotoTempFileName(false),
+ Util.GetPhotoFileName(false, currentPerson.UniqueID));
+ }
+ try {
+ File.Move(Util.GetPhotoTempFileName(true),
+ Util.GetPhotoFileName(true, currentPerson.UniqueID));
+ } catch {
+ File.Move(Util.GetPhotoTempFileName(true),
+ Util.GetPhotoFileName(true, currentPerson.UniqueID));
+ }
}
int rowToSelect = findRowOfCurrentPerson(treeview_persons, treeview_persons_store, currentPerson);
@@ -3874,17 +3884,24 @@ Console.WriteLine("X");
private void on_chronopic_clicked (object o, EventArgs args) {
chronopicWin = ChronopicWindow.View(volumeOn);
- chronopicWin.Button_reload.Clicked += new EventHandler(chronopicWindowReload);
+ //chronopicWin.FakeWindowReload.Clicked += new EventHandler(chronopicWindowReload);
chronopicWin.FakeWindowDone.Clicked += new EventHandler(on_chronopic_window_connected_or_done);
}
-
+
+ /*
private void chronopicWindowReload(object o, EventArgs args) {
- chronopicWin.Button_reload.Clicked -= new EventHandler(chronopicWindowReload);
+ //chronopicWin.FakeWindowReload.Clicked -= new EventHandler(chronopicWindowReload);
+
+ //store ports info and update labels if necessary
+ on_chronopic_window_connected_or_done (o, args);
+
//create chronopic window again (maybe new ports)
- createChronopicWindow(true);
+ //createChronopicWindow(true);
+
//show it
- on_chronopic_clicked(o, args);
+ chronopicWin = ChronopicWindow.View(volumeOn);
}
+ */
private void on_chronopic_window_connected_or_done (object o, EventArgs args) {
//chronopicWin.FakeWindowDone.Clicked -= new EventHandler(on_chronopic_window_connected_or_done);
diff --git a/src/gui/chronopic.cs b/src/gui/chronopic.cs
index 060ae2a..a92a621 100644
--- a/src/gui/chronopic.cs
+++ b/src/gui/chronopic.cs
@@ -77,7 +77,7 @@ public class ChronopicWindow
[Widget] Gtk.CheckButton checkbutton_multi_show;
[Widget] Gtk.Table table_multi_chronopic;
- [Widget] Gtk.Button button_reload;
+ //[Widget] Gtk.Button button_reload;
[Widget] Gtk.Image chronopic_image;
[Widget] Gtk.TextView textview_ports_found;
@@ -91,6 +91,7 @@ public class ChronopicWindow
[Widget] Gtk.Button fakeConnectionButton; //raised when chronopic detection ended
[Widget] Gtk.Button fakeWindowDone; //raised when chronopic detection ended
+ //[Widget] Gtk.Button fakeWindowReload; //raised when asked to reload
bool isWindows;
@@ -173,6 +174,7 @@ public class ChronopicWindow
ChronopicWindowBox.volumeOn = volumeOn;
ChronopicWindowBox.fakeWindowDone = new Gtk.Button();
+ //ChronopicWindowBox.fakeWindowReload = new Gtk.Button();
return ChronopicWindowBox;
}
@@ -181,7 +183,7 @@ public class ChronopicWindow
{
if (ChronopicWindowBox == null) {
ChronopicWindowBox = new ChronopicWindow (cpd);
- }
+ }
ChronopicWindowBox.volumeOn = volumeOn;
ChronopicWindowBox.checkChronopicDisconnected();
@@ -192,6 +194,8 @@ public class ChronopicWindow
ChronopicWindowBox.findPorts();
ChronopicWindowBox.chronopic_window.Show();
+ ChronopicWindowBox.chronopic_window.Present();
+Log.WriteLine("bbb");
return ChronopicWindowBox;
}
@@ -288,14 +292,16 @@ public class ChronopicWindow
//private void createComboWindows(string myPort, Gtk.ComboBox myCombo) {
private void createComboWindows() {
//combo port stuff
- comboWindowsOptions = new string[257];
- for (int i=1; i <= 257; i ++)
+ comboWindowsOptions = new string[32];
+ for (int i=1; i <= 32; i ++)
comboWindowsOptions[i-1] = "COM" + i;
+ string [] def = Util.StringToStringArray(Constants.ChronopicDefaultPortWindows);
+ string [] allWithDef = Util.AddArrayString(def, comboWindowsOptions);
- UtilGtk.ComboUpdate(combo_windows1, comboWindowsOptions, Constants.ChronopicDefaultPortWindows);
- UtilGtk.ComboUpdate(combo_windows2, comboWindowsOptions, Constants.ChronopicDefaultPortWindows);
- UtilGtk.ComboUpdate(combo_windows3, comboWindowsOptions, Constants.ChronopicDefaultPortWindows);
- UtilGtk.ComboUpdate(combo_windows4, comboWindowsOptions, Constants.ChronopicDefaultPortWindows);
+ UtilGtk.ComboUpdate(combo_windows1, allWithDef, Constants.ChronopicDefaultPortWindows);
+ UtilGtk.ComboUpdate(combo_windows2, allWithDef, Constants.ChronopicDefaultPortWindows);
+ UtilGtk.ComboUpdate(combo_windows3, allWithDef, Constants.ChronopicDefaultPortWindows);
+ UtilGtk.ComboUpdate(combo_windows4, allWithDef, Constants.ChronopicDefaultPortWindows);
foreach(ChronopicPortData a in cpd) {
if(a.Num == 1) {
@@ -401,7 +407,7 @@ public class ChronopicWindow
Util.StringArrayToString(SerialPort.GetPortNames(),"\n"));
textview_ports_found_explanation.Buffer = UtilGtk.TextViewPrint(
Catalog.GetString("These are USB devices like Chronopic but also pendrives, USB printers...") + "\n" +
- Catalog.GetString("If you just connected Chronopic, refresh this window pressing 'Refresh'.") +
+ Catalog.GetString("If you just connected Chronopic, close and open again this window.") +
saferPorts
);
}
@@ -561,10 +567,6 @@ public class ChronopicWindow
new HelpPorts();
}
- private void on_button_reload_clicked (object o, EventArgs args) {
- //event will be raised and managed on gui/chronojump.cs
- }
-
public void SerialPortsClose() {
Console.WriteLine("Closing sp");
sp.Close();
@@ -740,6 +742,14 @@ public class ChronopicWindow
ChronopicWindowBox.chronopic_window.Hide();
}
+ /*
+ private void on_button_reload_clicked (object o, EventArgs args) {
+ Log.WriteLine("RELOAD");
+ fakeWindowReload.Click();
+ //ChronopicWindowBox.chronopic_window.Hide();
+ }
+ */
+
void on_delete_event (object o, DeleteEventArgs args)
{
//nice: this makes windows no destroyed, then it works like button_close
@@ -788,12 +798,13 @@ public class ChronopicWindow
public Button FakeWindowDone {
get { return fakeWindowDone; }
}
-
- public Button Button_reload
+
+ /*
+ public Button FakeWindowReload
{
- set { button_reload = value; }
- get { return button_reload; }
+ get { return fakeWindowReload; }
}
+ */
}
diff --git a/src/gui/chronopicConnection.cs b/src/gui/chronopicConnection.cs
index 848ca96..d270262 100644
--- a/src/gui/chronopicConnection.cs
+++ b/src/gui/chronopicConnection.cs
@@ -114,10 +114,11 @@ public class ChronopicConnection
private void on_delete_event (object o, DeleteEventArgs args)
{
- //button_cancel.Click();
+ button_cancel.Click();
+ args.RetVal = true;
- ChronopicConnectionBox.chronopic_connection.Hide();
- ChronopicConnectionBox = null;
+ //ChronopicConnectionBox.chronopic_connection.Hide();
+ //ChronopicConnectionBox = null;
}
public Button Button_cancel
diff --git a/src/gui/person.cs b/src/gui/person.cs
index 98ed7a0..0fc8e22 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -943,8 +943,17 @@ public class PersonAddModifyWindow
string photoFile = Util.GetPhotoFileName(true, currentPerson.UniqueID);
if(File.Exists(photoFile)) {
- pixbuf = new Pixbuf (photoFile); //from a file
- image_photo_mini.Pixbuf = pixbuf;
+ try {
+ pixbuf = new Pixbuf (photoFile); //from a file
+ image_photo_mini.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 = new Pixbuf (tempFileName);
+ image_photo_mini.Pixbuf = pixbuf;
+ }
}
//show zoom button only if big image exists
if(File.Exists(Util.GetPhotoFileName(false, currentPerson.UniqueID)))
@@ -963,12 +972,15 @@ public class PersonAddModifyWindow
}
void on_button_zoom_clicked (object o, EventArgs args) {
- string fileName = Util.GetPhotoFileName(false, currentPerson.UniqueID);
- if(adding)
- fileName = Path.Combine(Path.GetTempPath(), Constants.PhotoTemp +
- Util.GetMultimediaExtension(Constants.MultimediaItems.PHOTO));
-
- new DialogImageTest(currentPerson.Name, fileName);
+ string tempFileName = Path.Combine(Path.GetTempPath(), Constants.PhotoTemp +
+ Util.GetMultimediaExtension(Constants.MultimediaItems.PHOTO));
+ if(! adding) {
+ //on windows there are problem using the fileNames that are not on temp
+ string fileName = Util.GetPhotoFileName(false, currentPerson.UniqueID);
+ File.Copy(fileName, tempFileName, true);
+ }
+
+ new DialogImageTest(currentPerson.Name, tempFileName);
}
Gtk.Window capturerWindow;
@@ -990,38 +1002,49 @@ public class PersonAddModifyWindow
capturerWindow.Add(capturer);
capturerWindow.Modal=true;
capturerWindow.ShowAll();
+ capturerWindow.Present();
capturerWindow.DeleteEvent += delegate(object sender, DeleteEventArgs e) {capturer.Close(); capturer.Dispose();};
capturer.Run();
}
private void on_snapshot_done(Pixbuf pixbuf) {
- string fileName = Util.GetPhotoFileName(false, currentPerson.UniqueID);
- if(adding)
- fileName = Path.Combine(Path.GetTempPath(), Constants.PhotoTemp +
- Util.GetMultimediaExtension(Constants.MultimediaItems.PHOTO));
+ string fileName = Path.Combine(Path.GetTempPath(), Constants.PhotoTemp +
+ Util.GetMultimediaExtension(Constants.MultimediaItems.PHOTO));
pixbuf.Save(fileName,"jpeg");
+
+ //on windows there are problem using the fileNames that are not on temp
+ if(!adding)
+ File.Copy(fileName, Util.GetPhotoFileName(false, currentPerson.UniqueID), true); //overwrite
+
button_zoom.Sensitive = true;
}
private void on_snapshot_mini_done(Pixbuf pixbuf) {
- string fileName = Util.GetPhotoFileName(true, currentPerson.UniqueID);
- if(adding)
- fileName = Path.Combine(Path.GetTempPath(), Constants.PhotoSmallTemp +
- Util.GetMultimediaExtension(Constants.MultimediaItems.PHOTO));
+ string tempSmallFileName = Path.Combine(Path.GetTempPath(), Constants.PhotoSmallTemp +
+ Util.GetMultimediaExtension(Constants.MultimediaItems.PHOTO));
+
+ pixbuf.Save(tempSmallFileName,"jpeg");
+
+ //on windows there are problem using the fileNames that are not on temp
+ if(!adding)
+ File.Copy(tempSmallFileName, Util.GetPhotoFileName(true, currentPerson.UniqueID), true); //overwrite
- pixbuf.Save(fileName,"jpeg");
capturer.Close();
capturer.Dispose();
capturerWindow.Hide();
-
- string photoFile = Util.GetPhotoFileName(true, currentPerson.UniqueID);
- if(adding)
- photoFile = Path.Combine(Path.GetTempPath(), Constants.PhotoSmallTemp +
- Util.GetMultimediaExtension(Constants.MultimediaItems.PHOTO));
- if(File.Exists(photoFile)) {
- Pixbuf pixbuf2 = new Pixbuf (photoFile); //from a file
+
+ string tempFileName = Path.Combine(Path.GetTempPath(), Constants.PhotoSmallTemp +
+ Util.GetMultimediaExtension(Constants.MultimediaItems.PHOTO));
+ if(!adding) {
+ //on windows there are problem using the fileNames that are not on temp
+ string fileName = Util.GetPhotoFileName(true, currentPerson.UniqueID);
+ File.Copy(fileName, tempFileName, true);
+ }
+
+ if(File.Exists(tempFileName)) {
+ Pixbuf pixbuf2 = new Pixbuf (tempFileName); //from a file
image_photo_mini.Pixbuf = pixbuf2;
}
}
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index e84c139..5106b66 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -66,7 +66,7 @@ public class PreferencesWindow {
[Widget] Gtk.Image image_video_yes;
[Widget] Gtk.Image image_video_no;
[Widget] Gtk.Label label_video;
- [Widget] Gtk.Label label_video_experimental;
+// [Widget] Gtk.Label label_video_experimental;
// [Widget] Gtk.Box hbox_language_row;
// [Widget] Gtk.Box hbox_combo_language;
@@ -225,11 +225,11 @@ public class PreferencesWindow {
if(myVideo) {
label_video.Text = Catalog.GetString("Enabled test video recording and person's snapshots.");
- label_video_experimental.Visible = true;
+ //label_video_experimental.Visible = true;
}
else {
label_video.Text = Catalog.GetString("Disabled video and snapshots.");
- label_video_experimental.Visible = false;
+ //label_video_experimental.Visible = false;
}
}
diff --git a/src/util.cs b/src/util.cs
index 6d258b4..2d1fc19 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -771,7 +771,11 @@ public class Util
public static void MoveTempVideo(int sessionID, Constants.TestTypes type, int uniqueID) {
if(File.Exists(GetVideoTempFileName())) {
CreateVideoSessionDirIfNeeded(sessionID);
- File.Move(GetVideoTempFileName(), GetVideoFileName(sessionID, type, uniqueID));
+ try {
+ File.Move(GetVideoTempFileName(), GetVideoFileName(sessionID, type, uniqueID));
+ } catch {
+ File.Copy(GetVideoTempFileName(), GetVideoFileName(sessionID, type, uniqueID));
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]