[chronojump] Better code for: label_contacts_exercise_selected_name
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Better code for: label_contacts_exercise_selected_name
- Date: Mon, 9 Dec 2019 11:46:49 +0000 (UTC)
commit 6dfde133d7a6674ca66c65e9455d26acdd85ab24
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Dec 9 12:46:40 2019 +0100
Better code for: label_contacts_exercise_selected_name
glade/app1.glade | 25 ++++++++++++++++++++++++-
src/gui/chronojump.cs | 30 +++++++++++++++++++++++++++---
src/gui/forceSensor.cs | 2 +-
src/gui/jump.cs | 4 ++--
src/gui/multiChronopic.cs | 4 ++--
src/gui/pulse.cs | 4 ++--
src/gui/reactionTime.cs | 8 ++++----
src/gui/run.cs | 4 ++--
src/gui/runEncoder.cs | 2 +-
9 files changed, 65 insertions(+), 18 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 70c6f0ba..93a5b0fd 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -5669,9 +5669,32 @@ EncoderInertialCapture</property>
</packing>
</child>
<child>
- <widget class="GtkLabel"
id="label_contacts_exercise_selected">
+ <widget class="GtkVBox" id="vbox158">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">10</property>
+ <child>
+ <widget class="GtkLabel"
id="label_contacts_exercise_selected_name">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_contacts_exercise_selected_options">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 6b232695..de3e9bd3 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -219,7 +219,8 @@ public partial class ChronoJumpWindow
//tests
[Widget] Gtk.Button button_contacts_exercise;
- [Widget] Gtk.Label label_contacts_exercise_selected;
+ [Widget] Gtk.Label label_contacts_exercise_selected_name;
+ [Widget] Gtk.Label label_contacts_exercise_selected_options;
[Widget] Gtk.Notebook notebook_contacts_capture_doing_wait;
[Widget] Gtk.Button button_contacts_bells;
[Widget] Gtk.Button button_contacts_capture_load;
@@ -3379,7 +3380,7 @@ public partial class ChronoJumpWindow
//on force sensor only show table
notebook_capture_graph_table.CurrentPage = 1; //"Show table"
notebook_capture_graph_table.ShowTabs = false;
- label_contacts_exercise_selected.Text =
UtilGtk.ComboGetActive(combo_force_sensor_exercise);
+ setLabelContactsExerciseSelected(m);
}
else if(m == Constants.Menuitem_modes.RUNSENCODER)
{
@@ -3404,7 +3405,7 @@ public partial class ChronoJumpWindow
combo_race_analyzer_device.Active = 0;
forceSensorImageTestChange();
- label_contacts_exercise_selected.Text =
UtilGtk.ComboGetActive(combo_run_encoder_exercise);
+ setLabelContactsExerciseSelected(m);
}
else if(m == Constants.Menuitem_modes.RT)
{
@@ -3501,6 +3502,29 @@ public partial class ChronoJumpWindow
image_encoder_selected_type.Pixbuf = pixbuf;
}
+ private void setLabelContactsExerciseSelected(Constants.Menuitem_modes m)
+ {
+ string name = "";
+ if(m == Constants.Menuitem_modes.JUMPSSIMPLE)
+ name = UtilGtk.ComboGetActive(combo_select_jumps);
+ else if(m == Constants.Menuitem_modes.JUMPSREACTIVE)
+ name = UtilGtk.ComboGetActive(combo_select_jumps_rj);
+ else if(m == Constants.Menuitem_modes.RUNSSIMPLE)
+ name = UtilGtk.ComboGetActive(combo_select_runs);
+ else if(m == Constants.Menuitem_modes.RUNSINTERVALLIC)
+ name = UtilGtk.ComboGetActive(combo_select_runs_interval);
+ else if(m == Constants.Menuitem_modes.FORCESENSOR)
+ name = UtilGtk.ComboGetActive(combo_force_sensor_exercise);
+ else if(m == Constants.Menuitem_modes.RUNSENCODER)
+ name = UtilGtk.ComboGetActive(combo_run_encoder_exercise);
+
+ label_contacts_exercise_selected_name.Text = name;
+ }
+ private void setLabelContactsExerciseSelected(string name)
+ {
+ label_contacts_exercise_selected_name.Text = name;
+ }
+
/*
ChronopicDetect cpDetect;
private void autoDetectChronopic(Constants.Menuitem_modes m)
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 3f46a1b6..f217c127 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -2322,7 +2322,7 @@ LogB.Information(" fs R ");
button_force_sensor_stiffness.Visible = false;
image_button_force_sensor_stiffness_problem.Visible = false;
}
- label_contacts_exercise_selected.Text = Catalog.GetString(fse.Name);
+ setLabelContactsExerciseSelected(Catalog.GetString(fse.Name));
}
private void fillForceSensorExerciseCombo(string name)
diff --git a/src/gui/jump.cs b/src/gui/jump.cs
index b0898f21..c17e634e 100644
--- a/src/gui/jump.cs
+++ b/src/gui/jump.cs
@@ -1119,7 +1119,7 @@ public partial class ChronoJumpWindow
{
currentEventType = myJumpType;
changeTestImage(EventType.Types.JUMP.ToString(), myJumpType.Name, myJumpType.ImageFileName);
- label_contacts_exercise_selected.Text = UtilGtk.ComboGetActive(combo_select_jumps);
+ setLabelContactsExerciseSelected(Constants.Menuitem_modes.JUMPSSIMPLE);
if(myJumpType.HasWeight) {
@@ -1218,7 +1218,7 @@ public partial class ChronoJumpWindow
{
currentEventType = myJumpType;
changeTestImage(EventType.Types.JUMP.ToString(), myJumpType.Name, myJumpType.ImageFileName);
- label_contacts_exercise_selected.Text = UtilGtk.ComboGetActive(combo_select_jumps_rj);
+ setLabelContactsExerciseSelected(Constants.Menuitem_modes.JUMPSREACTIVE);
checkbutton_allow_finish_rj_after_time.Visible = false;
if(myJumpType.FixedValue >= 0) {
diff --git a/src/gui/multiChronopic.cs b/src/gui/multiChronopic.cs
index abb6b109..d86cce19 100644
--- a/src/gui/multiChronopic.cs
+++ b/src/gui/multiChronopic.cs
@@ -77,10 +77,10 @@ public partial class ChronoJumpWindow
bool showRunDistance = false;
if(myMultiChronopicType.Name == Constants.MultiChronopicName) {
showSyncAndDeleteFirst = true;
- label_contacts_exercise_selected.Text = Catalog.GetString("Multi Chronopic");
+ setLabelContactsExerciseSelected(Catalog.GetString("Multi Chronopic"));
} else if(myMultiChronopicType.Name == Constants.RunAnalysisName) {
showRunDistance = true;
- label_contacts_exercise_selected.Text = Catalog.GetString("Race analysis");
+ setLabelContactsExerciseSelected(Catalog.GetString("Race analysis"));
}
extra_window_multichronopic_showSyncAndDeleteFirst(showSyncAndDeleteFirst);
extra_window_multichronopic_showRunDistance(showRunDistance);
diff --git a/src/gui/pulse.cs b/src/gui/pulse.cs
index 5ab7ffc2..c98e6b96 100644
--- a/src/gui/pulse.cs
+++ b/src/gui/pulse.cs
@@ -153,9 +153,9 @@ public partial class ChronoJumpWindow
hasOptions = true;
extra_window_pulses_spinbutton_pulse_step.Value = extra_window_pulseStep;
extra_window_pulses_spinbutton_total_pulses.Value = extra_window_totalPulses;
- label_contacts_exercise_selected.Text = Catalog.GetString("Custom");
+ setLabelContactsExerciseSelected(Catalog.GetString("Custom"));
} else
- label_contacts_exercise_selected.Text = Catalog.GetString("Free");
+ setLabelContactsExerciseSelected(Catalog.GetString("Free"));
extra_window_pulses_showNoOptions(hasOptions);
}
diff --git a/src/gui/reactionTime.cs b/src/gui/reactionTime.cs
index 246f8ba1..b927fa3f 100644
--- a/src/gui/reactionTime.cs
+++ b/src/gui/reactionTime.cs
@@ -55,25 +55,25 @@ public partial class ChronoJumpWindow
currentReactionTimeType = new ReactionTimeType("reactionTime");
changeTestImage("","", "reaction_time.png");
- label_contacts_exercise_selected.Text = Catalog.GetString("Reaction time");
+ setLabelContactsExerciseSelected(Catalog.GetString("Reaction time"));
if(extra_window_radio_reaction_time_animation_lights.Active) {
hbox_animation_lights.Visible = true;
currentReactionTimeType = new ReactionTimeType("anticipation");
changeTestImage("","", "reaction_time_discriminative.png");
- label_contacts_exercise_selected.Text = Catalog.GetString("Animation lights");
+ setLabelContactsExerciseSelected(Catalog.GetString("Animation lights"));
}
else if(extra_window_radio_reaction_time_flicker.Active) {
hbox_flicker_lights.Visible = true;
currentReactionTimeType = new ReactionTimeType("flickr");
changeTestImage("","", "reaction_time_discriminative.png");
- label_contacts_exercise_selected.Text = Catalog.GetString("Flicker");
+ setLabelContactsExerciseSelected(Catalog.GetString("Flicker"));
}
else if(extra_window_radio_reaction_time_discriminative.Active) {
hbox_discriminative_lights.Visible = true;
currentReactionTimeType = new ReactionTimeType("Discriminative");
changeTestImage("","", "reaction_time_discriminative.png");
- label_contacts_exercise_selected.Text = Catalog.GetString("Discriminative");
+ setLabelContactsExerciseSelected(Catalog.GetString("Discriminative"));
}
label_reaction_time_device_help.Visible = (
diff --git a/src/gui/run.cs b/src/gui/run.cs
index 8020ee12..3e3d5483 100644
--- a/src/gui/run.cs
+++ b/src/gui/run.cs
@@ -979,7 +979,7 @@ public partial class ChronoJumpWindow
{
currentEventType = myRunType;
changeTestImage(EventType.Types.RUN.ToString(), myRunType.Name, myRunType.ImageFileName);
- label_contacts_exercise_selected.Text = UtilGtk.ComboGetActive(combo_select_runs);
+ setLabelContactsExerciseSelected(Constants.Menuitem_modes.RUNSSIMPLE);
label_runs_simple_track_distance_units.Text = "m";
@@ -1035,7 +1035,7 @@ public partial class ChronoJumpWindow
{
currentEventType = myRunType;
changeTestImage(EventType.Types.RUN.ToString(), myRunType.Name, myRunType.ImageFileName);
- label_contacts_exercise_selected.Text = UtilGtk.ComboGetActive(combo_select_runs_interval);
+ setLabelContactsExerciseSelected(Constants.Menuitem_modes.RUNSINTERVALLIC);
if(myRunType.Distance > 0) {
label_runs_interval_track_distance_value.Text = myRunType.Distance.ToString();
diff --git a/src/gui/runEncoder.cs b/src/gui/runEncoder.cs
index 98349ca2..45241fa4 100644
--- a/src/gui/runEncoder.cs
+++ b/src/gui/runEncoder.cs
@@ -1232,7 +1232,7 @@ LogB.Information(" re R ");
private void on_combo_run_encoder_exercise_changed(object o, EventArgs args)
{
- label_contacts_exercise_selected.Text = UtilGtk.ComboGetActive(combo_run_encoder_exercise);
+ setLabelContactsExerciseSelected(Constants.Menuitem_modes.RUNSENCODER);
}
private void fillRunEncoderExerciseCombo(string name)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]