[chronojump] Preferences: "no translate graphs" (partial fix greek problems)



commit 1885333bed88e4bc4f6b52f278718f9044b2b106
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Jun 16 16:06:33 2014 +0200

    Preferences: "no translate graphs" (partial fix greek problems)

 glade/chronojump.glade    |  112 +++++++++++++++++++++++++++++++++++++++++++++
 src/gui/chronojump.cs     |    7 ++-
 src/gui/encoder.cs        |   12 ++++-
 src/gui/preferences.cs    |   13 +++++-
 src/sqlite/main.cs        |   26 ++++++++---
 src/sqlite/preferences.cs |    1 +
 src/utilEncoder.cs        |   21 +++++---
 7 files changed, 172 insertions(+), 20 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 4da9d60..e8c47cd 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -5991,6 +5991,9 @@ Second Chronopic to platforms.</property>
                                                         <child>
                                                           <placeholder/>
                                                         </child>
+                                                        <child>
+                                                          <placeholder/>
+                                                        </child>
                                                       </widget>
                                                       <packing>
                                                         <property name="expand">True</property>
@@ -6610,6 +6613,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             </child>
                                                             <child>
@@ -7363,6 +7369,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">2</property>
@@ -7875,6 +7884,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">4</property>
@@ -17071,6 +17083,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -17488,6 +17503,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -18336,6 +18354,12 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -25883,6 +25907,24 @@ options</property>
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -27689,6 +27731,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                 <child>
                                   <placeholder/>
                                 </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
                               </widget>
                             </child>
                           </widget>
@@ -28165,6 +28210,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -29425,6 +29473,61 @@ show elevation as:</property>
                     <property name="position">2</property>
                   </packing>
                 </child>
+                <child>
+                  <widget class="GtkVBox" id="vbox3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <widget class="GtkLabel" id="label20">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Translate statistics graphs</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_graphs_translate">
+                        <property name="label" translatable="yes">Translate</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_graphs_no_translate">
+                        <property name="label" translatable="yes">Do not translate</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">radio_graphs_translate</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
               </widget>
               <packing>
                 <property name="position">4</property>
@@ -30101,6 +30204,9 @@ show elevation as:</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -30182,6 +30288,9 @@ show elevation as:</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -30278,6 +30387,9 @@ show elevation as:</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index be487f2..cb1e5a9 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -360,6 +360,7 @@ public partial class ChronoJumpWindow
        private static bool heightPreferred;
        private static bool metersSecondsPreferred;
        private static string CSVExportDecimalSeparator; //"COMMA" or "POINT"
+       private static bool RGraphsTranslate;
 
        private static Person currentPerson;
        private static Session currentSession;
@@ -951,6 +952,8 @@ public partial class ChronoJumpWindow
                                SqlitePreferences.Select("encoderSmoothCon") ) );
 
                CSVExportDecimalSeparator = SqlitePreferences.Select("CSVExportDecimalSeparator");
+               
+               RGraphsTranslate = SqlitePreferences.Select("RGraphsTranslate") == "True";
 
                //change language works on windows. On Linux let's change the locale
                //if(UtilAll.IsWindows())
@@ -2831,7 +2834,7 @@ public partial class ChronoJumpWindow
                                SqlitePreferences.Select("language"),
                                encoderPropulsive, encoderSmoothCon,
                                videoDevices, videoDeviceNum, SqlitePreferences.Select("encoder1RMMethod"),
-                               CSVExportDecimalSeparator 
+                               CSVExportDecimalSeparator, RGraphsTranslate
                                );
                myWin.Button_accept.Clicked += new EventHandler(on_preferences_accepted);
        }
@@ -2917,6 +2920,8 @@ public partial class ChronoJumpWindow
                                SqlitePreferences.Select("encoderSmoothCon") ) );
                
                CSVExportDecimalSeparator = SqlitePreferences.Select("CSVExportDecimalSeparator");
+               
+               RGraphsTranslate = SqlitePreferences.Select("RGraphsTranslate") == "True"; 
 
                videoDeviceNum = Convert.ToInt32(SqlitePreferences.Select("videoDevice"));
                if(checkbutton_video.Active) {
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 162ff1a..7edf680 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -738,7 +738,9 @@ public partial class ChronoJumpWindow
                                
Util.ChangeSpaceAndMinusForUnderscore(UtilGtk.ComboGetActive(combo_encoder_exercise)) + 
                                "-(" + Util.ConvertToPoint(findMass(Constants.MassType.DISPLACED)) + "Kg)",
                                es,
-                               false); //do not use neuromuscularProfile script
+                               false,  //do not use neuromuscularProfile script
+                               RGraphsTranslate
+                               ); 
                                
                if(result)
                        //store this to show 1,2,3,4,... or 1e,1c,2e,2c,... in RenderN
@@ -1423,7 +1425,9 @@ public partial class ChronoJumpWindow
                                Util.ChangeSpaceAndMinusForUnderscore(lastEncoderSQLSignal.exerciseName) + 
                                        "-(" + displacedMass + "Kg)",
                                encoderStruct,
-                               false); //do not use neuromuscularProfile script
+                               false,                  //do not use neuromuscularProfile script
+                               RGraphsTranslate
+                               );
 
                //encoder_pulsebar_capture.Text = string.Format(Catalog.GetString(
                //                      "Exported to {0}."), UtilEncoder.GetEncoderExportTempFileName());
@@ -2407,7 +2411,9 @@ Log.Write(" AT ANALYZE 2 ");
                                titleStr += "-" + 
Util.ChangeSpaceAndMinusForUnderscore(UtilGtk.ComboGetActive(combo_encoder_exercise));
                }
 
-               UtilEncoder.RunEncoderGraphNoRDotNet(titleStr, encoderStruct, encoderAnalysis == 
"neuromuscularProfile");
+               UtilEncoder.RunEncoderGraphNoRDotNet(titleStr, encoderStruct, 
+                               encoderAnalysis == "neuromuscularProfile",
+                               RGraphsTranslate);
        }
 
        private void on_check_encoder_analyze_signal_or_curves_toggled (object obj, EventArgs args) {
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 16de26e..0ffd3b3 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -84,6 +84,9 @@ public class PreferencesWindow {
                        
        [Widget] Gtk.RadioButton radio_export_latin;
        [Widget] Gtk.RadioButton radio_export_non_latin;
+       
+       [Widget] Gtk.RadioButton radio_graphs_translate;
+       [Widget] Gtk.RadioButton radio_graphs_no_translate;
 
 //     [Widget] Gtk.Box hbox_language_row;
 //     [Widget] Gtk.Box hbox_combo_language;
@@ -126,7 +129,7 @@ public class PreferencesWindow {
                        bool askDeletion, bool weightStatsPercent, bool heightPreferred, bool 
metersSecondsPreferred, 
                        string language, bool encoderPropulsive, double encoderSmoothCon,
                        string [] videoDevices, int videoDeviceNum, string encoder1RMMethod,
-                       string CSVExportDecimalSeparator)
+                       string CSVExportDecimalSeparator, bool RGraphsTranslate)
        {
                if (PreferencesWindowBox == null) {
                        PreferencesWindowBox = new PreferencesWindow ();
@@ -243,6 +246,11 @@ public class PreferencesWindow {
 
                //done here and not in glade to be shown with the decimal point of user language        
                PreferencesWindowBox.label_encoder_con.Text = (0.7).ToString();
+               
+               if(RGraphsTranslate)
+                       PreferencesWindowBox.radio_graphs_translate.Active = true;
+               else
+                       PreferencesWindowBox.radio_graphs_no_translate.Active = true;
 
                PreferencesWindowBox.preferences.Show ();
                return PreferencesWindowBox;
@@ -549,6 +557,9 @@ public class PreferencesWindow {
                        SqlitePreferences.Update("CSVExportDecimalSeparator","COMMA", true); 
                else
                        SqlitePreferences.Update("CSVExportDecimalSeparator","POINT", true); 
+               
+               SqlitePreferences.Update("RGraphsTranslate", 
+                               PreferencesWindowBox.radio_graphs_translate.Active.ToString(), true);
        
                string encoder1RMMethod = "";   
                if(PreferencesWindowBox.radio_encoder_1RM_nonweighted.Active)
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index a978276..c30c945 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -74,7 +74,7 @@ class Sqlite
         * Important, change this if there's any update to database
         * Important2: if database version get numbers higher than 1, check if the comparisons with 
currentVersion works ok
         */
-       static string lastChronojumpDatabaseVersion = "1.07";
+       static string lastChronojumpDatabaseVersion = "1.08";
 
        public Sqlite() {
        }
@@ -1573,6 +1573,17 @@ class Sqlite
 
                                currentVersion = "1.07";
                        }
+                       if(currentVersion == "1.07") {
+                               dbcon.Open();
+                       
+                               Log.WriteLine("Added translate statistics graph option to preferences");
+                               
+                               SqlitePreferences.Insert ("RGraphsTranslate", "True"); 
+                               SqlitePreferences.Update ("databaseVersion", "1.08", true); 
+                               dbcon.Close();
+
+                               currentVersion = "1.08";
+                       }
                
                
 
@@ -1717,12 +1728,13 @@ class Sqlite
                SqliteCountry.initialize();
                
                //changes [from - to - desc]
-               //1.06 - 1-07 Converted DB to 1.07 Added jump_dj_a.png
-               //1.05 - 1-06 Converted DB to 1.06 Curves are now linked to signals
-               //1.04 - 1-05 Converted DB to 1.05 Removed inertial curves, because sign was not checked on 
1.04 when saving curves
-               //1.03 - 1-04 Converted DB to 1.04 Encoder table improved
-               //1.02 - 1-03 Converted DB to 1.03 Updated encoder exercise, angle is now on encoder 
configuration
-               //1.01 - 1-02 Converted DB to 1.02 Added Agility Tests: Agility-T-Test, Agility-3L3R
+               //1.07 - 1.08 Converted DB to 1.08 Added translate statistics graph option to preferences
+               //1.06 - 1.07 Converted DB to 1.07 Added jump_dj_a.png
+               //1.05 - 1.06 Converted DB to 1.06 Curves are now linked to signals
+               //1.04 - 1.05 Converted DB to 1.05 Removed inertial curves, because sign was not checked on 
1.04 when saving curves
+               //1.03 - 1.04 Converted DB to 1.04 Encoder table improved
+               //1.02 - 1.03 Converted DB to 1.03 Updated encoder exercise, angle is now on encoder 
configuration
+               //1.01 - 1.02 Converted DB to 1.02 Added Agility Tests: Agility-T-Test, Agility-3L3R
                //1.00 - 1.01 Converted DB to 1.01 Added export to CSV configuration on preferences
                //0.99 - 1.00 Converted DB to 1.00 Encoder added Free and Inclinated Exercises
                //0.98 - 0.99 Converted DB to 0.99 Encoder table improved 
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 42426e5..1b52572 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -78,6 +78,7 @@ class SqlitePreferences : Sqlite
                Insert ("encoder1RMMethod", Constants.Encoder1RMMethod.WEIGHTED2.ToString());
                Insert ("inertialmomentum", "0.01");
                Insert ("CSVExportDecimalSeparator", Util.GetDecimalSeparatorFromLocale());
+               Insert ("RGraphsTranslate", "True");
        }
 
        public static void Insert(string myName, string myValue)
diff --git a/src/utilEncoder.cs b/src/utilEncoder.cs
index 5c9d807..277daca 100644
--- a/src/utilEncoder.cs
+++ b/src/utilEncoder.cs
@@ -329,7 +329,7 @@ public class UtilEncoder
        }
        
        
-       private static EncoderGraphROptions prepareEncoderGraphOptions(string title, EncoderStruct es, bool 
neuromuscularProfileDo) 
+       private static EncoderGraphROptions prepareEncoderGraphOptions(string title, EncoderStruct es, bool 
neuromuscularProfileDo, bool translate) 
        {
                string scriptUtilR = GetEncoderScriptUtilR();
 
@@ -363,11 +363,16 @@ public class UtilEncoder
                int count = 0;
                string temp = "";
                string [] encoderTranslatedWordsOK = new String [Constants.EncoderTranslatedWords.Length];
-               foreach(string etw in Constants.EncoderTranslatedWords) {
-                       temp = Util.ChangeChars(etw, ";", ",");
-                       temp = Util.RemoveNewLine(temp, true);
-                       encoderTranslatedWordsOK[count++] = temp;
-               }
+
+               //if ! translate, then just print the english words
+               if(translate) {
+                       foreach(string etw in Constants.EncoderTranslatedWords) {
+                               temp = Util.ChangeChars(etw, ";", ",");
+                               temp = Util.RemoveNewLine(temp, true);
+                               encoderTranslatedWordsOK[count++] = temp;
+                       }
+               } else
+                       encoderTranslatedWordsOK = Constants.EncoderEnglishWords;
 
                return new EncoderGraphROptions( 
                                es.InputData, es.OutputGraph, es.OutputData1, 
@@ -448,7 +453,7 @@ public class UtilEncoder
         * this method don't use RDotNet, then has to call call_graph.R, who will call graph.R
         * and has to write a Roptions.txt file
         */
-       public static bool RunEncoderGraphNoRDotNet(string title, EncoderStruct es, bool 
neuromuscularProfileDo) 
+       public static bool RunEncoderGraphNoRDotNet(string title, EncoderStruct es, bool 
neuromuscularProfileDo, bool translate) 
        {
                CancelRScript = false;
 
@@ -468,7 +473,7 @@ public class UtilEncoder
                }
                
 
-               string scriptOptions = prepareEncoderGraphOptions(title, es, 
neuromuscularProfileDo).ToString();
+               string scriptOptions = prepareEncoderGraphOptions(title, es, neuromuscularProfileDo, 
translate).ToString();
 
                string optionsFile = Path.GetTempPath() + "Roptions.txt";
                TextWriter writer = File.CreateText(optionsFile);


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