[chronojump] new feature: encoder/forceSensor/runEncoder play from load win
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] new feature: encoder/forceSensor/runEncoder play from load win
- Date: Tue, 29 Oct 2019 16:52:03 +0000 (UTC)
commit 4df1aacf4f7c99f525439bbed5b4c4f30a497c1b
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Oct 29 17:51:40 2019 +0100
new feature: encoder/forceSensor/runEncoder play from load win
glade/generic_window.glade | 87 +++++++++++++++++++++++++++++++---------------
src/gui/encoder.cs | 18 +++++++---
src/gui/forceSensor.cs | 14 ++++++--
src/gui/genericWindow.cs | 65 ++++++++++++++++++++++------------
src/gui/runEncoder.cs | 12 ++++++-
5 files changed, 139 insertions(+), 57 deletions(-)
---
diff --git a/glade/generic_window.glade b/glade/generic_window.glade
index ad391f6d..0dc3d072 100644
--- a/glade/generic_window.glade
+++ b/glade/generic_window.glade
@@ -706,24 +706,35 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <widget class="GtkButton" id="button_delete">
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <child>
- <widget class="GtkImage" id="image_delete">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-missing-image</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">12</property>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<widget class="GtkButton" id="button_cancel">
<property name="label">gtk-cancel</property>
@@ -736,9 +747,9 @@
<accelerator key="Escape" signal="clicked"/>
</widget>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -761,6 +772,26 @@
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <widget class="GtkButton" id="button_treeviewload_row_play">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_play_selected_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkImage" id="image_treeviewload_row_play">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-missing-image</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
<child>
<widget class="GtkButton" id="button_treeviewload_row_delete">
<property name="label" translatable="yes">Delete</property>
@@ -773,14 +804,14 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -794,19 +825,19 @@
<signal name="clicked" handler="on_button_accept_clicked" swapped="no"/>
</widget>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="pack_type">end</property>
- <property name="position">3</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
</widget>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 67e3bf2b..9104eb78 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1597,8 +1597,8 @@ public partial class ChronoJumpWindow
currentPerson.Name) + "\n" +
Catalog.GetString("If you want to edit or delete a row, right click on it."),
bigArray);
- genericWin.SetTreeview(columnsString, false, dataPrint, new ArrayList(),
GenericWindow.EditActions.EDITDELETE, true);
-
+ genericWin.SetTreeview(columnsString, false, dataPrint, new ArrayList(),
GenericWindow.EditActions.EDITPLAYDELETE, true);
+
//find all persons in current session
ArrayList personsPre =
SqlitePersonSession.SelectCurrentSessionPersons(currentSession.UniqueID,
false); //means: do not returnPersonAndPSlist
@@ -1614,14 +1614,16 @@ public partial class ChronoJumpWindow
//select row corresponding to current signal
genericWin.SelectRowWithID(0, myEncoderSignalUniqueID); //colNum, id
-
+
+ genericWin.VideoColumn = 8;
genericWin.CommentColumn = 9;
-
+
genericWin.ShowButtonCancel(true);
genericWin.SetButtonAcceptLabel(Catalog.GetString("Load"));
genericWin.SetButtonCancelLabel(Catalog.GetString("Close"));
genericWin.SetButtonAcceptSensitive(false);
genericWin.Button_accept.Clicked += new EventHandler(on_encoder_load_signal_accepted);
+ genericWin.Button_row_play.Clicked += new EventHandler(on_encoder_load_signal_row_play);
genericWin.Button_row_edit.Clicked += new EventHandler(on_encoder_load_signal_row_edit);
genericWin.Button_row_edit_apply.Clicked += new
EventHandler(on_encoder_load_signal_row_edit_apply);
genericWin.Button_row_delete.Clicked += new
EventHandler(on_encoder_load_signal_row_delete_pre);
@@ -1744,6 +1746,14 @@ public partial class ChronoJumpWindow
}
}
+ protected void on_encoder_load_signal_row_play (object o, EventArgs args)
+ {
+ LogB.Information("row play at load signal");
+ LogB.Information(genericWin.TreeviewSelectedUniqueID.ToString());
+ playVideo(Util.GetVideoFileName(currentSession.UniqueID,
+ Constants.TestTypes.ENCODER, genericWin.TreeviewSelectedUniqueID));
+ }
+
protected void on_encoder_load_signal_row_edit (object o, EventArgs args) {
LogB.Information("row edit at load signal");
LogB.Information(genericWin.TreeviewSelectedUniqueID.ToString());
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 8eeeb84f..678142b3 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -1468,7 +1468,7 @@ LogB.Information(" fs R ");
Catalog.GetString("If you want to edit or delete a row, right click on it.")
, bigArray);
- genericWin.SetTreeview(columnsString, false, dataPrint, new ArrayList(),
GenericWindow.EditActions.EDITDELETE, true);
+ genericWin.SetTreeview(columnsString, false, dataPrint, new ArrayList(),
GenericWindow.EditActions.EDITPLAYDELETE, true);
//find all persons in current session
ArrayList personsPre =
SqlitePersonSession.SelectCurrentSessionPersons(currentSession.UniqueID,
@@ -1486,13 +1486,15 @@ LogB.Information(" fs R ");
//select row corresponding to current signal
genericWin.SelectRowWithID(0, currentForceSensor.UniqueID); //colNum, id
- genericWin.CommentColumn = 7;
+ genericWin.VideoColumn = 7;
+ genericWin.CommentColumn = 8;
genericWin.ShowButtonCancel(true);
genericWin.SetButtonAcceptLabel(Catalog.GetString("Load"));
genericWin.SetButtonCancelLabel(Catalog.GetString("Close"));
genericWin.SetButtonAcceptSensitive(false);
genericWin.Button_accept.Clicked += new EventHandler(on_force_sensor_load_signal_accepted);
+ genericWin.Button_row_play.Clicked += new EventHandler(on_force_sensor_load_signal_row_play);
genericWin.Button_row_edit.Clicked += new EventHandler(on_force_sensor_load_signal_row_edit);
genericWin.Button_row_edit_apply.Clicked += new
EventHandler(on_force_sensor_load_signal_row_edit_apply);
genericWin.Button_row_delete.Clicked += new
EventHandler(on_force_sensor_load_signal_row_delete_prequestion);
@@ -1575,6 +1577,14 @@ LogB.Information(" fs R ");
button_force_sensor_analyze_options.Sensitive = true;
}
+ protected void on_force_sensor_load_signal_row_play (object o, EventArgs args)
+ {
+ LogB.Information("row play at load signal");
+ LogB.Information(genericWin.TreeviewSelectedUniqueID.ToString());
+ playVideo(Util.GetVideoFileName(currentSession.UniqueID,
+ Constants.TestTypes.FORCESENSOR, genericWin.TreeviewSelectedUniqueID));
+ }
+
protected void on_force_sensor_load_signal_row_edit (object o, EventArgs args) {
LogB.Information("row edit at load signal");
LogB.Information(genericWin.TreeviewSelectedUniqueID.ToString());
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index b8a136f2..34fa68e0 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -74,14 +74,16 @@ public class GenericWindow
[Widget] Gtk.TreeView treeview;
[Widget] Gtk.Button button_accept;
[Widget] Gtk.Button button_cancel;
- [Widget] Gtk.Button button_delete; //currently only on encoder exercise edit
-
+
//treeview fake buttons
[Widget] Gtk.Button button_row_edit;
+ [Widget] Gtk.Button button_row_play;
[Widget] Gtk.Button button_row_delete;
[Widget] Gtk.Button button_treeviewload_row_edit;
[Widget] Gtk.Button button_treeviewload_row_delete;
+ [Widget] Gtk.Button button_treeviewload_row_play;
+ [Widget] Gtk.Image image_treeviewload_row_play;
[Widget] Gtk.Box hbox_entry2;
[Widget] Gtk.Label label_entry2;
@@ -94,8 +96,6 @@ public class GenericWindow
[Widget] Gtk.Label label_spin_double2;
[Widget] Gtk.SpinButton spin_double2;
- [Widget] Gtk.Image image_delete;
-
private ArrayList nonSensitiveRows;
static GenericWindow GenericWindowBox;
@@ -103,7 +103,7 @@ public class GenericWindow
private TreeStore store;
private bool textviewChanging = false;
- public enum EditActions { NONE, EDITDELETE, DELETE }
+ public enum EditActions { NONE, EDITPLAYDELETE, DELETE }
//used to read data, see if it's ok, and print an error message.
//if all is ok, destroy it with HideAndNull()
@@ -113,6 +113,7 @@ public class GenericWindow
//and we want to ensure next window will be created at needed size
public bool DestroyOnAccept;
public int TreeviewSelectedUniqueID;
+ private int videoColumn = 0;
private int commentColumn;
public int uniqueID; //used on encoder & forceSensor edit exercise
@@ -156,8 +157,8 @@ public class GenericWindow
foreach(ArrayList widgetArray in array)
GenericWindowBox.showWidgetsPowerful(widgetArray);
- Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_delete.png");
- GenericWindowBox.image_delete.Pixbuf = pixbuf;
+ Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "video_play.png");
+ GenericWindowBox.image_treeviewload_row_play.Pixbuf = pixbuf;
if(showNow)
GenericWindowBox.generic_window.Show ();
@@ -214,6 +215,7 @@ public class GenericWindow
check1.Hide();
hbox_edit_row.Hide();
button_treeviewload_row_edit.Hide();
+ button_treeviewload_row_play.Hide();
button_treeviewload_row_delete.Hide();
hbox_all_none_selected.Hide();
hbox_combo_all_none_selected.Hide();
@@ -608,13 +610,16 @@ public class GenericWindow
this.activateRowAcceptsWindow = activateRowAcceptsWindow;
- if(editAction == EditActions.EDITDELETE)
+ if(editAction == EditActions.EDITPLAYDELETE)
{
button_treeviewload_row_edit.Sensitive = false;
button_treeviewload_row_edit.Visible = true;
+ button_treeviewload_row_play.Sensitive = false;
+ button_treeviewload_row_play.Visible = true;
button_treeviewload_row_delete.Sensitive = false;
button_treeviewload_row_delete.Visible = true;
button_row_edit = new Gtk.Button();
+ button_row_play = new Gtk.Button();
button_row_delete = new Gtk.Button();
} else if(editAction == EditActions.DELETE)
{
@@ -696,12 +701,16 @@ public class GenericWindow
SetButtonAcceptSensitive(true);
button_treeviewload_row_edit.Sensitive = true;
button_treeviewload_row_delete.Sensitive = true;
+
+ string video = (string) myModel.GetValue (iter, videoColumn);
+ button_treeviewload_row_play.Sensitive = (video == Catalog.GetString("Yes"));
}
else
{
SetButtonAcceptSensitive(false);
button_treeviewload_row_edit.Sensitive = false;
button_treeviewload_row_delete.Sensitive = false;
+ button_treeviewload_row_play.Sensitive = false;
}
ShowEditRow(false);
@@ -714,6 +723,7 @@ public class GenericWindow
if (treeview.Selection.GetSelected (out myModel, out iter))
{
button_treeviewload_row_edit.Sensitive = true;
+ button_treeviewload_row_play.Sensitive = true;
button_treeviewload_row_delete.Sensitive = true;
}
}
@@ -859,6 +869,7 @@ public class GenericWindow
entry_edit_row.Text = (string) model.GetValue (iter, commentColumn);
button_treeviewload_row_edit.Sensitive = false;
+ button_treeviewload_row_play.Sensitive = false;
button_treeviewload_row_delete.Sensitive = false;
button_row_edit.Click();
@@ -875,9 +886,21 @@ public class GenericWindow
store.SetValue (iter, commentColumn, entry_edit_row.Text);
}
+ private void on_play_selected_clicked (object o, EventArgs args)
+ {
+ TreeModel model;
+ TreeIter iter = new TreeIter();
+ if(! treeview.Selection.GetSelected (out model, out iter))
+ return;
+
+ TreeviewSelectedUniqueID = Convert.ToInt32((string) store.GetValue (iter, 0));
+ button_row_play.Click();
+ }
+
public void on_hbox_combo_button_cancel_clicked (object o, EventArgs args)
{
button_treeviewload_row_edit.Sensitive = true;
+ button_treeviewload_row_play.Sensitive = true;
button_treeviewload_row_delete.Sensitive = true;
hbox_edit_row.Hide();
}
@@ -908,6 +931,7 @@ public class GenericWindow
TreeviewSelectedUniqueID = Convert.ToInt32((string) store.GetValue (iter, 0));
button_treeviewload_row_edit.Sensitive = false;
+ button_treeviewload_row_play.Sensitive = false;
button_treeviewload_row_delete.Sensitive = false;
//activate button to manage on gui/encoder.cs in order to delete from SQL
@@ -934,10 +958,6 @@ public class GenericWindow
scrolled_window_treeview.Show();
}
- public void ShowButtonDelete(bool show) {
- button_delete.Visible = show;
- }
-
public void SetButtonAcceptLabel(string str) {
button_accept.Label=str;
}
@@ -949,7 +969,7 @@ public class GenericWindow
public void SetButtonCancelLabel(string str) {
button_cancel.Label=str;
}
-
+
public void ShowButtonCancel(bool show) {
button_cancel.Visible = show;
}
@@ -1004,12 +1024,6 @@ public class GenericWindow
get { return button_middle; }
}
- public Button Button_delete {
- set { button_delete = value; }
- get { return button_delete; }
- }
-
-
public Button Button_accept {
set { button_accept = value; }
get { return button_accept; }
@@ -1019,16 +1033,23 @@ public class GenericWindow
set { button_row_edit = value; }
get { return button_row_edit; }
}
-
+
+ public Button Button_row_play {
+ get { return button_row_play; }
+ }
+
public Button Button_row_edit_apply {
set { hbox_combo_button_apply = value; }
get { return hbox_combo_button_apply; }
}
-
+
+ public int VideoColumn {
+ set { videoColumn = value; }
+ }
public int CommentColumn {
set { commentColumn = value; }
}
-
+
public Button Button_row_delete {
set { button_row_delete = value; }
get { return button_row_delete; }
diff --git a/src/gui/runEncoder.cs b/src/gui/runEncoder.cs
index 680ce336..1fba3a2f 100644
--- a/src/gui/runEncoder.cs
+++ b/src/gui/runEncoder.cs
@@ -672,7 +672,7 @@ public partial class ChronoJumpWindow
Catalog.GetString("If you want to edit or delete a row, right click on it.")
, bigArray);
- genericWin.SetTreeview(columnsString, false, dataPrint, new ArrayList(),
GenericWindow.EditActions.EDITDELETE, true);
+ genericWin.SetTreeview(columnsString, false, dataPrint, new ArrayList(),
GenericWindow.EditActions.EDITPLAYDELETE, true);
//find all persons in current session
ArrayList personsPre =
SqlitePersonSession.SelectCurrentSessionPersons(currentSession.UniqueID,
@@ -690,6 +690,7 @@ public partial class ChronoJumpWindow
//select row corresponding to current signal
genericWin.SelectRowWithID(0, currentRunEncoder.UniqueID); //colNum, id
+ genericWin.VideoColumn = 6;
genericWin.CommentColumn = 7;
genericWin.ShowButtonCancel(true);
@@ -697,6 +698,7 @@ public partial class ChronoJumpWindow
genericWin.SetButtonCancelLabel(Catalog.GetString("Close"));
genericWin.SetButtonAcceptSensitive(false);
genericWin.Button_accept.Clicked += new EventHandler(on_run_encoder_load_accepted);
+ genericWin.Button_row_play.Clicked += new EventHandler(on_run_encoder_load_signal_row_play);
genericWin.Button_row_edit.Clicked += new EventHandler(on_run_encoder_load_signal_row_edit);
genericWin.Button_row_edit_apply.Clicked += new
EventHandler(on_run_encoder_load_signal_row_edit_apply);
genericWin.Button_row_delete.Clicked += new
EventHandler(on_run_encoder_load_signal_row_delete_prequestion);
@@ -751,6 +753,14 @@ public partial class ChronoJumpWindow
event_execute_label_message.Text = "Loaded: " + Util.GetLastPartOfPath(re.Filename);
}
+ protected void on_run_encoder_load_signal_row_play (object o, EventArgs args)
+ {
+ LogB.Information("row play at load signal");
+ LogB.Information(genericWin.TreeviewSelectedUniqueID.ToString());
+ playVideo(Util.GetVideoFileName(currentSession.UniqueID,
+ Constants.TestTypes.RACEANALYZER, genericWin.TreeviewSelectedUniqueID));
+ }
+
protected void on_run_encoder_load_signal_row_edit (object o, EventArgs args) {
LogB.Information("row edit at load signal");
LogB.Information(genericWin.TreeviewSelectedUniqueID.ToString());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]