[chronojump] Encoder bells done. TODO: sound on Python
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder bells done. TODO: sound on Python
- Date: Mon, 2 Apr 2012 16:42:00 +0000 (UTC)
commit 47a50e2011bc55c6577adf84acff3eda5ce359d1
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Apr 3 00:37:12 2012 +0800
Encoder bells done. TODO: sound on Python
encoder/pyserial_pyper.py | 25 ++-
glade/chronojump.glade | 490 ++++++++++++++++++++++++++++++++++++++-
src/constants.cs | 4 +
src/encoder.cs | 16 ++-
src/gui/chronojump.cs | 16 ++-
src/gui/encoder.cs | 89 +++++---
src/gui/repetitiveConditions.cs | 139 ++++++++++-
7 files changed, 722 insertions(+), 57 deletions(-)
---
diff --git a/encoder/pyserial_pyper.py b/encoder/pyserial_pyper.py
index 7fc9e16..4865c70 100644
--- a/encoder/pyserial_pyper.py
+++ b/encoder/pyserial_pyper.py
@@ -37,6 +37,10 @@ isJump = sys.argv[4]
mass = float(sys.argv[5])
smoothingOne = float(sys.argv[6])
eccon = sys.argv[7] #contraction "ec" or "c"
+powerHigherCondition = int(sys.argv[8])
+peakPowerHigherCondition = int(sys.argv[9])
+powerLowerCondition = int(sys.argv[10])
+peakPowerLowerCondition = int(sys.argv[11])
delete_initial_time = 20 #delete first records because there's encoder bug
#w_baudrate = 9600 # Setting the baudrate of Chronopic(9600)
@@ -95,6 +99,14 @@ def colorize(text, color, bold):
FORMAT = '0;%dm'
return ESCAPE + (FORMAT % (color, )) + text + RESET
+def assignColor(found, conditionHigher, conditionLower):
+ if conditionHigher != -1 and found >= conditionHigher:
+ return GREEN
+ elif conditionLower != -1 and found <= conditionLower:
+ return RED
+ else:
+ return BLACK
+
def calculate_all_in_r(temp, top_values, bottom_values, direction_now, smoothingOne, eccon, minHeight, isJump):
if (len(top_values)>0 and len(bottom_values)>0):
@@ -156,17 +168,20 @@ def calculate_all_in_r(temp, top_values, bottom_values, direction_now, smoothing
peakPowerT = myR.get('peakPowerT')
meanSpeedCol = "%10.2f," % meanSpeed
+
+# if(meanSpeed > 2): colSpeed = GREENINV
+# else: colSpeed = GREEN
+
meanPowerCol = "%10.2f," % meanPower
- if(meanSpeed > 2): colSpeed = GREENINV
- else: colSpeed = GREEN
- if(meanPower > 3500): colPower = REDINV
- else: colPower = RED
+ colPower = assignColor(meanPower, powerHigherCondition, powerLowerCondition)
+ peakPowerCol = "%10.2f," % peakPower
+ colPeakPower = assignColor(peakPower, peakPowerHigherCondition, peakPowerLowerCondition)
phaseRange = phaseRange / 10 #from cm to mm
if eccon == "ec" or direction_now == -1:
if phaseRange >= minHeight:
- print phaseCol + "%6i," % phaseRange + colorize(meanSpeedCol,colSpeed,TRUE) + "%9.2f," % maxSpeed + colorize(meanPowerCol,colPower,TRUE) + "%10.2f," % peakPower + "%11i" % peakPowerT
+ print phaseCol + "%6i," % phaseRange + "%10.2f," % meanSpeed + "%9.2f," % maxSpeed + colorize(meanPowerCol,colPower,colPower!=BLACK) + colorize(peakPowerCol,colPeakPower,colPeakPower!=BLACK) + "%11i" % peakPowerT
else:
print chr(27) + "[2;37m" + phase + chr(27) + "[0;47m" + "%6i," % phaseRange + chr(27)+"[0m" + chr(27) + "[2;37m" + meanSpeedCol + "%9.2f," % maxSpeed + meanPowerCol + "%10.2f," % peakPower + "%11i" % peakPowerT + chr(27)+"[0m"
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index fa24975..3e6d2bd 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -6345,7 +6345,9 @@ suitable for agility tests)</property>
</widget>
<widget class="GtkWindow" id="repetitive_conditions">
<property name="border_width">10</property>
- <property name="title" translatable="yes">Conditions in repetive test</property>
+ <property name="title" translatable="yes">Configure feedback</property>
+ <property name="resizable">False</property>
+ <property name="default_width">280</property>
<signal name="delete_event" handler="on_delete_event"/>
<child>
<widget class="GtkVBox" id="vbox95">
@@ -6363,7 +6365,7 @@ suitable for agility tests)</property>
</packing>
</child>
<child>
- <widget class="GtkFrame" id="frame23">
+ <widget class="GtkFrame" id="frame_best_and_worst">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
@@ -6587,6 +6589,7 @@ suitable for agility tests)</property>
</widget>
<packing>
<property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
@@ -6601,7 +6604,7 @@ suitable for agility tests)</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwin_conditions">
- <property name="height_request">120</property>
+ <property name="height_request">200</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
@@ -7192,6 +7195,7 @@ suitable for agility tests)</property>
<property name="digits">2</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_tf_greater_value_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -7211,6 +7215,7 @@ suitable for agility tests)</property>
<property name="digits">2</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_tf_lower_value_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -7230,6 +7235,7 @@ suitable for agility tests)</property>
<property name="digits">2</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_tc_greater_value_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -7249,6 +7255,7 @@ suitable for agility tests)</property>
<property name="digits">2</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_tc_lower_value_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -7268,6 +7275,7 @@ suitable for agility tests)</property>
<property name="digits">2</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_tf_tc_greater_value_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -7287,6 +7295,7 @@ suitable for agility tests)</property>
<property name="digits">2</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_tf_tc_lower_value_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -7299,6 +7308,8 @@ suitable for agility tests)</property>
</child>
</widget>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
@@ -7515,6 +7526,7 @@ suitable for agility tests)</property>
<property name="digits">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_time_lower_value_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -7534,6 +7546,7 @@ suitable for agility tests)</property>
<property name="digits">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_time_greater_value_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -7546,11 +7559,478 @@ suitable for agility tests)</property>
</child>
</widget>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkTable" id="table_encoder_conditions">
+ <property name="visible">True</property>
+ <property name="n_rows">5</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">10</property>
+ <property name="row_spacing">8</property>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">condition</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">value</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">action</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_SHRINK</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_encoder_power_higher">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Bell good</property>
+ <property name="draw_indicator">True</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image_encoder_power_higher">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_encoder_power_lower">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Bell bad</property>
+ <property name="draw_indicator">True</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image_encoder_power_lower">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="spacing">10</property>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Power</b> (W)</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="label"><=</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="spacing">10</property>
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Power</b> (W)</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="label">>=</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spinbutton_encoder_power_higher">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ <property name="adjustment">4000 100 50000 100 1 0</property>
+ <property name="climb_rate">1</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_encoder_power_higher_value_changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spinbutton_encoder_power_lower">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ <property name="adjustment">1000 100 50000 100 1 0</property>
+ <property name="climb_rate">1</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_encoder_power_lower_value_changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_SHRINK</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="spacing">10</property>
+ <child>
+ <widget class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Peak Power</b> (W)</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="label">>=</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="spacing">10</property>
+ <child>
+ <widget class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Peak Power</b> (W)</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label11">
+ <property name="visible">True</property>
+ <property name="label"><=</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spinbutton_encoder_peakpower_higher">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ <property name="adjustment">4000 100 50000 100 1 0</property>
+ <property name="climb_rate">1</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_encoder_peakpower_higher_value_changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spinbutton_encoder_peakpower_lower">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ <property name="adjustment">1000 100 50000 100 1 0</property>
+ <property name="climb_rate">1</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <signal name="value_changed" handler="on_spinbutton_encoder_peakpower_lower_value_changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox8">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_encoder_peakpower_higher">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Bell good</property>
+ <property name="draw_indicator">True</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox9">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image_encoder_peakpower_higher">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options"></property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox10">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_encoder_peakpower_lower">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Bell good</property>
+ <property name="draw_indicator">True</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox11">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image_encoder_peakpower_lower">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options"></property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
@@ -7563,7 +8043,7 @@ suitable for agility tests)</property>
</widget>
</child>
<child>
- <widget class="GtkLabel" id="label375">
+ <widget class="GtkLabel" id="label_other_conditions">
<property name="visible">True</property>
<property name="label" translatable="yes"><b>Other conditions</b></property>
<property name="use_markup">True</property>
@@ -7717,6 +8197,7 @@ suitable for agility tests)</property>
</widget>
<packing>
<property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
@@ -23231,6 +23712,7 @@ on current Chronojump version.</property>
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip" translatable="yes">Bells</property>
+ <signal name="clicked" handler="on_button_encoder_bells_clicked"/>
<child>
<widget class="GtkAlignment" id="alignment21">
<property name="visible">True</property>
diff --git a/src/constants.cs b/src/constants.cs
index dc2c9bd..5fa09c2 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -559,6 +559,10 @@ public class Constants
public static string RunStartInitialSpeedYes = Catalog.GetString("Running start. Started with initial speed.");
public static string RunStartInitialSpeedNo = Catalog.GetString("Standing start. Started without initial speed.");
+
+ public enum BellModes {
+ JUMPS, RUNS, ENCODER
+ }
/*
* encoder storage
diff --git a/src/encoder.cs b/src/encoder.cs
index 097faca..a5060ab 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -36,8 +36,14 @@ public class EncoderParams
private int curve;
private int width;
private int height;
+ private int powerHigherCondition;
+ private int peakPowerHigherCondition;
+ private int powerLowerCondition;
+ private int peakPowerLowerCondition;
- public EncoderParams(int time, int minHeight, bool isJump, string mass, string smooth, string eccon)
+ public EncoderParams(int time, int minHeight, bool isJump, string mass, string smooth, string eccon,
+ int powerHigherCondition, int peakPowerHigherCondition,
+ int powerLowerCondition, int peakPowerLowerCondition)
{
this.time = time;
this.minHeight = minHeight;
@@ -45,12 +51,18 @@ public class EncoderParams
this.mass = mass;
this.smooth = smooth;
this.eccon = eccon;
+ this.powerHigherCondition = powerHigherCondition;
+ this.peakPowerHigherCondition = peakPowerHigherCondition;
+ this.powerLowerCondition = powerLowerCondition;
+ this.peakPowerLowerCondition = peakPowerLowerCondition;
}
public string ToString1 ()
{
return time.ToString() + " " + minHeight.ToString() + " " + isJump.ToString() +
- " " + mass.ToString() + " " + smooth + " " + eccon;
+ " " + mass.ToString() + " " + smooth + " " + eccon +
+ " " + powerHigherCondition.ToString() + " " + peakPowerHigherCondition.ToString() +
+ " " + powerLowerCondition.ToString() + " " + peakPowerLowerCondition.ToString();
}
public EncoderParams(int minHeight, bool isJump, string mass, string eccon,
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 6e56690..52f1fcb 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -462,6 +462,7 @@ public partial class ChronoJumpWindow
createdStatsWin = false;
repetitiveConditionsWin = RepetitiveConditionsWindow.Create();
+ repetitiveConditionsWin.FakeButtonClose.Clicked += new EventHandler(on_repetitive_conditions_closed);
createChronopicWindow(false);
@@ -5064,12 +5065,23 @@ Console.WriteLine("X");
}
private void on_button_rj_bells_clicked(object o, EventArgs args) {
- repetitiveConditionsWin.View(true, volumeOn); //show jumps
+ repetitiveConditionsWin.View(Constants.BellModes.JUMPS, volumeOn);
}
private void on_button_time_bells_clicked(object o, EventArgs args) {
- repetitiveConditionsWin.View(false, volumeOn); //show runs
+ repetitiveConditionsWin.View(Constants.BellModes.RUNS, volumeOn);
}
+
+ private void on_button_encoder_bells_clicked(object o, EventArgs args) {
+ repetitiveConditionsWin.View(Constants.BellModes.ENCODER, volumeOn);
+ }
+
+ private void on_repetitive_conditions_closed(object o, EventArgs args) {
+ //repetitiveConditionsWin.FakeButtonClose.Clicked += new EventHandler
+ Log.WriteLine("UPDATING ENCODER TV");
+ EncoderUpdateThings(false);
+ }
+
/* ---------------------------------------------------------
* ---------------- SENSITIVE GUI METHODS-------------------
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 1013661..de17964 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -60,14 +60,17 @@ public partial class ChronoJumpWindow
private string encoderAnalysis="powerBars";
-
+
+ //TODO: campanes a l'encoder pq mostri colors i sons en funcio del que passa. Falten els sons des de python
+
+ //TODO: store encoder data: auto save, and show on a treeview. Put button to delete current (or should be called "last")
+
//TODO: put chronopic detection in a generic place. Done But:
//TODO: solve the problem of connecting two different chronopics
//TODO: improve formatting of data.ataany column show same number of digits at left of dec point
- //TODO: campanes a l'encoder pq mostri colors i sons en funcio del que passa
//TODO: in ec, curves and powerBars have to be different on ec than on c
//TODO: smaller zoom button on analysis
@@ -85,7 +88,20 @@ public partial class ChronoJumpWindow
{
//TODO: que surti barra de progres de calculando... despres de capturar i boto de cerrar automatico
//TODO: i mostrar valors des de la gui (potser a zona dreta damunt del zoom)
-
+
+ int powerHigherCondition = -1;
+ if(repetitiveConditionsWin.EncoderPowerHigher)
+ powerHigherCondition = repetitiveConditionsWin.EncoderPowerHigherValue;
+ int peakPowerHigherCondition = -1;
+ if(repetitiveConditionsWin.EncoderPeakPowerHigher)
+ peakPowerHigherCondition = repetitiveConditionsWin.EncoderPeakPowerHigherValue;
+
+ int powerLowerCondition = -1;
+ if(repetitiveConditionsWin.EncoderPowerLower)
+ powerLowerCondition = repetitiveConditionsWin.EncoderPowerLowerValue;
+ int peakPowerLowerCondition = -1;
+ if(repetitiveConditionsWin.EncoderPeakPowerLower)
+ peakPowerLowerCondition = repetitiveConditionsWin.EncoderPeakPowerLowerValue;
//capture data
EncoderParams ep = new EncoderParams(
@@ -94,7 +110,9 @@ public partial class ChronoJumpWindow
!radiobutton_encoder_capture_bar.Active,
findMass(),
Util.ConvertToPoint((double) spin_encoder_smooth.Value), //R decimal: '.'
- findEccon()
+ findEccon(),
+ powerHigherCondition, peakPowerHigherCondition,
+ powerLowerCondition, peakPowerLowerCondition
);
EncoderStruct es = new EncoderStruct(
@@ -104,17 +122,18 @@ public partial class ChronoJumpWindow
Util.RunPythonEncoder(Constants.EncoderScriptCapture, es, true);
- updateThings();
+ EncoderUpdateThings(true);
}
void on_button_encoder_recalculate_clicked (object o, EventArgs args)
{
- updateThings();
+ EncoderUpdateThings(true);
}
- private void updateThings()
+ private void EncoderUpdateThings(bool graph)
{
- makeCurvesGraph();
+ if(graph)
+ makeCurvesGraph();
string contents = Util.ReadFile(Util.GetEncoderCurvesTempFileName());
if (contents == null) {
@@ -321,8 +340,21 @@ public partial class ChronoJumpWindow
/* rendering columns */
- string colorGood= "ForestGreen"; //more at System.Drawing.Color (Monodoc)
- string colorBad= "red";
+ private string assignColor(double found, bool higherActive, bool lowerActive, int higherValue, int lowerValue)
+ {
+ //more at System.Drawing.Color (Monodoc)
+ string colorGood= "ForestGreen";
+ string colorBad= "red";
+ string colorNothing= "black";
+
+ if(higherActive && found >= higherValue)
+ return colorGood;
+ else if(lowerActive && found <= lowerValue)
+ return colorBad;
+ else
+ return colorNothing;
+ }
+
private void RenderN (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
EncoderCurve curve = (EncoderCurve) model.GetValue (iter, 0);
@@ -336,61 +368,54 @@ public partial class ChronoJumpWindow
private void RenderHeight (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
EncoderCurve curve = (EncoderCurve) model.GetValue (iter, 0);
- (cell as Gtk.CellRendererText).Text = curve.Height;
+ (cell as Gtk.CellRendererText).Text = (Convert.ToDouble(curve.Height)/10).ToString(); //mm -> cm
}
private void RenderMeanSpeed (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
EncoderCurve curve = (EncoderCurve) model.GetValue (iter, 0);
- if (Convert.ToDouble(curve.MeanSpeed) >= 2.5)
- (cell as Gtk.CellRendererText).Foreground = colorGood;
- else
- (cell as Gtk.CellRendererText).Foreground = colorBad;
-
(cell as Gtk.CellRendererText).Text = curve.MeanSpeed;
}
private void RenderMaxSpeed (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
EncoderCurve curve = (EncoderCurve) model.GetValue (iter, 0);
- if (Convert.ToDouble(curve.MaxSpeed) >= 2.5)
- (cell as Gtk.CellRendererText).Foreground = colorGood;
- else
- (cell as Gtk.CellRendererText).Foreground = colorBad;
-
(cell as Gtk.CellRendererText).Text = curve.MaxSpeed;
}
private void RenderMeanPower (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
EncoderCurve curve = (EncoderCurve) model.GetValue (iter, 0);
- if (Convert.ToDouble(curve.MeanPower) >= 1700)
- (cell as Gtk.CellRendererText).Foreground = colorGood;
- else
- (cell as Gtk.CellRendererText).Foreground = colorBad;
-
+ (cell as Gtk.CellRendererText).Foreground = assignColor(
+ Convert.ToDouble(curve.MeanPower),
+ repetitiveConditionsWin.EncoderPowerHigher,
+ repetitiveConditionsWin.EncoderPowerLower,
+ repetitiveConditionsWin.EncoderPowerHigherValue,
+ repetitiveConditionsWin.EncoderPowerLowerValue);
(cell as Gtk.CellRendererText).Text = curve.MeanPower;
}
private void RenderPeakPower (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
EncoderCurve curve = (EncoderCurve) model.GetValue (iter, 0);
- if (Convert.ToDouble(curve.PeakPower) >= 1700)
- (cell as Gtk.CellRendererText).Foreground = colorGood;
- else
- (cell as Gtk.CellRendererText).Foreground = colorBad;
-
+ (cell as Gtk.CellRendererText).Foreground = assignColor(
+ Convert.ToDouble(curve.PeakPower),
+ repetitiveConditionsWin.EncoderPeakPowerHigher,
+ repetitiveConditionsWin.EncoderPeakPowerLower,
+ repetitiveConditionsWin.EncoderPeakPowerHigherValue,
+ repetitiveConditionsWin.EncoderPeakPowerLowerValue);
(cell as Gtk.CellRendererText).Text = curve.PeakPower;
}
private void RenderPeakPowerT (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
EncoderCurve curve = (EncoderCurve) model.GetValue (iter, 0);
+ /*
if (Convert.ToDouble(curve.PeakPowerT) <= 100)
(cell as Gtk.CellRendererText).Foreground = colorGood;
else
(cell as Gtk.CellRendererText).Foreground = colorBad;
-
+ */
(cell as Gtk.CellRendererText).Text = curve.PeakPowerT;
}
diff --git a/src/gui/repetitiveConditions.cs b/src/gui/repetitiveConditions.cs
index 3f488cf..ea43a97 100644
--- a/src/gui/repetitiveConditions.cs
+++ b/src/gui/repetitiveConditions.cs
@@ -29,6 +29,9 @@ public class RepetitiveConditionsWindow
[Widget] Gtk.Window repetitive_conditions;
// [Widget] Gtk.ScrolledWindow scrolled_conditions;
+ [Widget] Gtk.Frame frame_best_and_worst;
+ [Widget] Gtk.Label label_other_conditions;
+
/* jumps */
[Widget] Gtk.Table table_jump_conditions;
[Widget] Gtk.CheckButton checkbutton_jump_tf_tc_best;
@@ -59,6 +62,18 @@ public class RepetitiveConditionsWindow
[Widget] Gtk.SpinButton spinbutton_time_greater;
[Widget] Gtk.SpinButton spinbutton_time_lower;
+ /* encoder */
+ [Widget] Gtk.Table table_encoder_conditions;
+ [Widget] Gtk.CheckButton checkbutton_encoder_power_higher;
+ [Widget] Gtk.CheckButton checkbutton_encoder_peakpower_higher;
+ [Widget] Gtk.CheckButton checkbutton_encoder_power_lower;
+ [Widget] Gtk.CheckButton checkbutton_encoder_peakpower_lower;
+ [Widget] Gtk.SpinButton spinbutton_encoder_power_higher;
+ [Widget] Gtk.SpinButton spinbutton_encoder_peakpower_higher;
+ [Widget] Gtk.SpinButton spinbutton_encoder_power_lower;
+ [Widget] Gtk.SpinButton spinbutton_encoder_peakpower_lower;
+
+
/* bell tests*/
[Widget] Gtk.RadioButton radiobutton_test_good;
[Widget] Gtk.RadioButton radiobutton_test_bad;
@@ -73,6 +88,8 @@ public class RepetitiveConditionsWindow
[Widget] Gtk.Image image_repetitive_tc_lower;
[Widget] Gtk.Image image_repetitive_tf_tc_greater;
[Widget] Gtk.Image image_repetitive_time_lower;
+ [Widget] Gtk.Image image_encoder_power_higher;
+ [Widget] Gtk.Image image_encoder_peakpower_higher;
[Widget] Gtk.Image image_repetitive_test_good;
//bells bad (red)
[Widget] Gtk.Image image_repetitive_worst_tf_tc;
@@ -81,7 +98,11 @@ public class RepetitiveConditionsWindow
[Widget] Gtk.Image image_repetitive_tc_greater;
[Widget] Gtk.Image image_repetitive_tf_tc_lower;
[Widget] Gtk.Image image_repetitive_time_greater;
+ [Widget] Gtk.Image image_encoder_power_lower;
+ [Widget] Gtk.Image image_encoder_peakpower_lower;
[Widget] Gtk.Image image_repetitive_test_bad;
+
+ public Gtk.Button FakeButtonClose;
//static bool volumeOn;
bool volumeOn;
@@ -99,6 +120,8 @@ public class RepetitiveConditionsWindow
//put an icon to window
UtilGtk.IconWindow(repetitive_conditions);
+ FakeButtonClose = new Gtk.Button();
+
putNonStandardIcons();
}
@@ -114,34 +137,44 @@ public class RepetitiveConditionsWindow
return RepetitiveConditionsWindowBox;
}
- public void View (bool showJumps, bool volumeOn) {
+ public void View (Constants.BellModes bellMode, bool volumeOn) {
//this.volumeOn = volumeOn;
//when user "deleted_event" the window
if (RepetitiveConditionsWindowBox == null) {
RepetitiveConditionsWindowBox = new RepetitiveConditionsWindow ();
}
- RepetitiveConditionsWindowBox.showWidgets(showJumps);
+ RepetitiveConditionsWindowBox.showWidgets(bellMode);
RepetitiveConditionsWindowBox.repetitive_conditions.Show ();
RepetitiveConditionsWindowBox.volumeOn = volumeOn;
}
- void showWidgets(bool showJumps) {
- if(showJumps) {
+ void showWidgets(Constants.BellModes bellMode) {
+ frame_best_and_worst.Hide();
+ label_other_conditions.Hide();
+
+ table_jump_conditions.Hide();
+ checkbutton_jump_tf_tc_best.Hide();
+ checkbutton_jump_tf_tc_worst.Hide();
+ table_run_conditions.Hide();
+ checkbutton_run_time_best.Hide();
+ checkbutton_run_time_worst.Hide();
+ table_encoder_conditions.Hide();
+
+ if(bellMode == Constants.BellModes.JUMPS) {
+ frame_best_and_worst.Show();
+ label_other_conditions.Show();
table_jump_conditions.Show();
checkbutton_jump_tf_tc_best.Show();
checkbutton_jump_tf_tc_worst.Show();
- table_run_conditions.Hide();
- checkbutton_run_time_best.Hide();
- checkbutton_run_time_worst.Hide();
-// scrolled_conditions
- } else {
+ } else if(bellMode == Constants.BellModes.RUNS) {
+ frame_best_and_worst.Show();
+ label_other_conditions.Show();
table_run_conditions.Show();
checkbutton_run_time_best.Show();
checkbutton_run_time_worst.Show();
- table_jump_conditions.Hide();
- checkbutton_jump_tf_tc_best.Hide();
- checkbutton_jump_tf_tc_worst.Hide();
+ } else { //encoder
+ table_encoder_conditions.Show();
}
}
@@ -154,6 +187,8 @@ public class RepetitiveConditionsWindow
image_repetitive_tc_lower.Pixbuf = pixbuf;
image_repetitive_tf_tc_greater.Pixbuf = pixbuf;
image_repetitive_time_lower.Pixbuf = pixbuf;
+ image_encoder_power_higher.Pixbuf = pixbuf;
+ image_encoder_peakpower_higher.Pixbuf = pixbuf;
image_repetitive_test_good.Pixbuf = pixbuf;
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_bell_red.png");
@@ -163,6 +198,8 @@ public class RepetitiveConditionsWindow
image_repetitive_tc_greater.Pixbuf = pixbuf;
image_repetitive_tf_tc_lower.Pixbuf = pixbuf;
image_repetitive_time_greater.Pixbuf = pixbuf;
+ image_encoder_power_lower.Pixbuf = pixbuf;
+ image_encoder_peakpower_lower.Pixbuf = pixbuf;
image_repetitive_test_bad.Pixbuf = pixbuf;
}
@@ -181,6 +218,7 @@ public class RepetitiveConditionsWindow
void on_button_close_clicked (object o, EventArgs args)
{
RepetitiveConditionsWindowBox.repetitive_conditions.Hide();
+ FakeButtonClose.Click();
// RepetitiveConditionsWindowBox = null;
}
@@ -194,6 +232,54 @@ public class RepetitiveConditionsWindow
set { volumeOn = value; }
}
+ /* Auto.mark checkbox if spinbutton is changed */
+
+ /* jumps */
+ void on_spinbutton_tf_greater_value_changed (object o, EventArgs args) {
+ checkbutton_tf_greater.Active = true;
+ }
+ void on_spinbutton_tf_lower_value_changed (object o, EventArgs args) {
+ checkbutton_tf_lower.Active = true;
+ }
+
+ void on_spinbutton_tc_greater_value_changed (object o, EventArgs args) {
+ checkbutton_tc_greater.Active = true;
+ }
+ void on_spinbutton_tc_lower_value_changed (object o, EventArgs args) {
+ checkbutton_tc_lower.Active = true;
+ }
+
+ void on_spinbutton_tf_tc_greater_value_changed (object o, EventArgs args) {
+ checkbutton_tf_tc_greater.Active = true;
+ }
+ void on_spinbutton_tf_tc_lower_value_changed (object o, EventArgs args) {
+ checkbutton_tf_tc_lower.Active = true;
+ }
+
+ /*runs*/
+ void on_spinbutton_time_greater_value_changed (object o, EventArgs args) {
+ checkbutton_time_greater.Active = true;
+ }
+ void on_spinbutton_time_lower_value_changed (object o, EventArgs args) {
+ checkbutton_time_lower.Active = true;
+ }
+
+ /* encoder */
+ void on_spinbutton_encoder_power_higher_value_changed (object o, EventArgs args) {
+ checkbutton_encoder_power_higher.Active = true;
+ }
+ void on_spinbutton_encoder_peakpower_higher_value_changed (object o, EventArgs args) {
+ checkbutton_encoder_peakpower_higher.Active = true;
+ }
+
+ void on_spinbutton_encoder_power_lower_value_changed (object o, EventArgs args) {
+ checkbutton_encoder_power_lower.Active = true;
+ }
+ void on_spinbutton_encoder_peakpower_lower_value_changed (object o, EventArgs args) {
+ checkbutton_encoder_peakpower_lower.Active = true;
+ }
+
+
/* JUMPS */
public bool TfTcBest {
get { return checkbutton_jump_tf_tc_best.Active; }
@@ -276,5 +362,34 @@ public class RepetitiveConditionsWindow
get { return Convert.ToDouble(spinbutton_time_lower.Value); }
}
+ /* ENCODER */
+ public bool EncoderPowerHigher {
+ get { return checkbutton_encoder_power_higher.Active; }
+ }
+ public int EncoderPowerHigherValue {
+ get { return Convert.ToInt32(spinbutton_encoder_power_higher.Value); }
+ }
+
+ public bool EncoderPeakPowerHigher {
+ get { return checkbutton_encoder_peakpower_higher.Active; }
+ }
+ public int EncoderPeakPowerHigherValue {
+ get { return Convert.ToInt32(spinbutton_encoder_peakpower_higher.Value); }
+ }
+
+ public bool EncoderPowerLower {
+ get { return checkbutton_encoder_power_lower.Active; }
+ }
+ public int EncoderPowerLowerValue {
+ get { return Convert.ToInt32(spinbutton_encoder_power_lower.Value); }
+ }
+
+ public bool EncoderPeakPowerLower {
+ get { return checkbutton_encoder_peakpower_lower.Active; }
+ }
+ public int EncoderPeakPowerLowerValue {
+ get { return Convert.ToInt32(spinbutton_encoder_peakpower_lower.Value); }
+ }
+
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]