[chronojump] DB:2.06 python3 by default on all users. Removed "python"



commit 6632c6f2b5afcb56bda561c006a79e85b0c4ca21
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Dec 14 12:14:08 2020 +0100

    DB:2.06 python3 by default on all users. Removed "python"

 glade/preferences_win.glade | 84 ++++++++++++++++++---------------------------
 src/chronojumpImporter.cs   |  3 +-
 src/gui/preferences.cs      |  9 ++---
 src/preferences.cs          |  4 ++-
 src/sqlite/main.cs          | 12 +++++--
 src/sqlite/preferences.cs   |  2 +-
 6 files changed, 51 insertions(+), 63 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index a1131d51..e2b4780b 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -6969,13 +6969,29 @@ version:</property>
                                         <property name="can_focus">False</property>
                                         <property name="spacing">12</property>
                                         <child>
-                                          <widget class="GtkHBox" id="hbox71">
+                                          <widget class="GtkRadioButton" id="radio_python_2">
+                                            <property name="label">Python 2</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>
+                                            <property name="group">radio_python_3</property>
+                                          </widget>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <widget class="GtkHBox" id="hbox70">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="spacing">4</property>
+                                            <property name="spacing">6</property>
                                             <child>
-                                              <widget class="GtkRadioButton" id="radio_python_default">
-                                                <property name="label" translatable="yes">default</property>
+                                              <widget class="GtkRadioButton" id="radio_python_3">
+                                                <property name="label">Python 3</property>
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">False</property>
@@ -6983,13 +6999,13 @@ version:</property>
                                                 <property name="draw_indicator">True</property>
                                               </widget>
                                               <packing>
-                                                <property name="expand">False</property>
-                                                <property name="fill">False</property>
+                                                <property name="expand">True</property>
+                                                <property name="fill">True</property>
                                                 <property name="position">0</property>
                                               </packing>
                                             </child>
                                             <child>
-                                              <widget class="GtkHBox" id="hbox70">
+                                              <widget class="GtkHBox" id="hbox71">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <child>
@@ -6999,81 +7015,49 @@ version:</property>
                                                     <property name="label">(</property>
                                                   </widget>
                                                   <packing>
-                                                    <property name="expand">False</property>
-                                                    <property name="fill">False</property>
+                                                    <property name="expand">True</property>
+                                                    <property name="fill">True</property>
                                                     <property name="position">0</property>
                                                   </packing>
                                                 </child>
                                                 <child>
-                                                  <widget class="GtkLabel" id="label36">
+                                                  <widget class="GtkLabel" id="label69">
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">False</property>
-                                                    <property name="label" 
translatable="yes">recommended</property>
+                                                    <property name="label" 
translatable="yes">Recommended</property>
                                                   </widget>
                                                   <packing>
-                                                    <property name="expand">False</property>
-                                                    <property name="fill">False</property>
+                                                    <property name="expand">True</property>
+                                                    <property name="fill">True</property>
                                                     <property name="position">1</property>
                                                   </packing>
                                                 </child>
                                                 <child>
-                                                  <widget class="GtkLabel" id="label69">
+                                                  <widget class="GtkLabel" id="label36">
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">False</property>
                                                     <property name="label">)</property>
                                                   </widget>
                                                   <packing>
-                                                    <property name="expand">False</property>
-                                                    <property name="fill">False</property>
+                                                    <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="expand">True</property>
+                                                <property name="fill">True</property>
                                                 <property name="position">1</property>
                                               </packing>
                                             </child>
                                           </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_python_2">
-                                            <property name="label">Python 2</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>
-                                            <property name="group">radio_python_default</property>
-                                          </widget>
                                           <packing>
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
                                             <property name="position">1</property>
                                           </packing>
                                         </child>
-                                        <child>
-                                          <widget class="GtkRadioButton" id="radio_python_3">
-                                            <property name="label">Python 3</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>
-                                            <property name="group">radio_python_default</property>
-                                          </widget>
-                                          <packing>
-                                            <property name="expand">False</property>
-                                            <property name="fill">False</property>
-                                            <property name="position">2</property>
-                                          </packing>
-                                        </child>
                                       </widget>
                                       <packing>
                                         <property name="expand">True</property>
diff --git a/src/chronojumpImporter.cs b/src/chronojumpImporter.cs
index ef005968..bc1a1ff0 100644
--- a/src/chronojumpImporter.cs
+++ b/src/chronojumpImporter.cs
@@ -335,8 +335,7 @@ LogB.Information("import A ");
                if (UtilAll.IsWindows()) {
                        // On Windows we execute the .exe file (it's the Python with py2exe)
                        // right now default to python2
-                       if(pythonVersion == Preferences.pythonVersionEnum.Python ||
-                                       pythonVersion == Preferences.pythonVersionEnum.Python2)
+                       if(pythonVersion == Preferences.pythonVersionEnum.Python2)
                                importer_executable = System.IO.Path.Combine (Util.GetPrefixDir (), 
"bin\\chronojump-importer\\chronojump_importer.exe");
                        else
                                importer_executable = System.IO.Path.Combine (Util.GetPrefixDir (), 
"bin\\chronojump-importer-python3\\chronojump_importer.exe");
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 92090aa1..d06d59dd 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -258,7 +258,6 @@ public class PreferencesWindow
        [Widget] Gtk.Frame frame_networks;
        [Widget] Gtk.CheckButton check_networks_devices;
 
-       [Widget] Gtk.RadioButton radio_python_default;
        [Widget] Gtk.RadioButton radio_python_2;
        [Widget] Gtk.RadioButton radio_python_3;
 
@@ -749,10 +748,8 @@ public class PreferencesWindow
 
                if(preferences.importerPythonVersion == Preferences.pythonVersionEnum.Python2)
                        PreferencesWindowBox.radio_python_2.Active = true;
-               else if(preferences.importerPythonVersion == Preferences.pythonVersionEnum.Python3)
+               else //if(preferences.importerPythonVersion == Preferences.pythonVersionEnum.Python3)
                        PreferencesWindowBox.radio_python_3.Active = true;
-               else //if(preferences.importerPythonVersion == Preferences.pythonVersionEnum.Python)
-                       PreferencesWindowBox.radio_python_default.Active = true;
 
                if(preferences.colorBackgroundOsColor) {
                        PreferencesWindowBox.radio_color_os.Active = true;
@@ -2268,9 +2265,7 @@ public class PreferencesWindow
 
        private Preferences.pythonVersionEnum get_pythonVersion_from_gui()
        {
-               if( PreferencesWindowBox.radio_python_default.Active)
-                       return Preferences.pythonVersionEnum.Python;
-               else if( PreferencesWindowBox.radio_python_2.Active)
+               if( PreferencesWindowBox.radio_python_2.Active)
                        return Preferences.pythonVersionEnum.Python2;
                else //if( PreferencesWindowBox.radio_python_3.Active)
                        return Preferences.pythonVersionEnum.Python3;
diff --git a/src/preferences.cs b/src/preferences.cs
index a386fdbe..3277684c 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -159,10 +159,12 @@ public class Preferences
        public bool muteLogs;
        public bool networksAllowChangeDevices; //managed on preferences;
 
-       public enum pythonVersionEnum { Python, Python2, Python3 };
+       public enum pythonVersionEnum { Python2, Python3 };
        public pythonVersionEnum importerPythonVersion;
 
        /*
+        * at DB: 2.06, vales pythonVersionEnum were Python2, Python3, we do not use "Python" anymore
+        *
         * at DB: 1.95, vales pythonVersionEnum were Python, Python2, Python3
         * so we need the executable: python, python2, python3
         * chronojump_importer.py works on python2 and python3
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 45102e9f..491f83f1 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -129,7 +129,7 @@ class Sqlite
        /*
         * Important, change this if there's any update to database
         */
-       static string lastChronojumpDatabaseVersion = "2.05";
+       static string lastChronojumpDatabaseVersion = "2.06";
 
        public Sqlite()
        {
@@ -2724,7 +2724,7 @@ class Sqlite
                                LogB.SQL("Inserted into preferences: importerPythonVersion");
 
                                SqlitePreferences.Insert (SqlitePreferences.ImporterPythonVersion,
-                                       Preferences.pythonVersionEnum.Python.ToString());
+                                       Preferences.pythonVersionEnum.Python3.ToString());
 
                                currentVersion = updateVersion("1.95");
                        }
@@ -2818,6 +2818,13 @@ class Sqlite
 
                                currentVersion = updateVersion("2.05");
                        }
+                       if(currentVersion == "2.05")
+                       {
+                               LogB.SQL("Default python version for all users: Python3");
+                               SqlitePreferences.Update (SqlitePreferences.ImporterPythonVersion, 
Preferences.pythonVersionEnum.Python3.ToString(), true); 
+
+                               currentVersion = updateVersion("2.06");
+                       }
 
                        /*
                        if(currentVersion == "1.79")
@@ -3035,6 +3042,7 @@ class Sqlite
 //just testing: 1.79 - 1.80 Converted DB to 1.80 Created table ForceSensorElasticBandGlue and moved 
stiffnessString records there
 
 
+               //2.05 - 2.06 Converted DB to 2.06 Default python version for all users: Python3
                //2.04 - 2.05 Converted DB to 2.05 Inserted into preferences: forceSensorStartEndOptimized
                //2.03 - 2.04 Converted DB to 2.04 Created tables: tagSession, sessionTagSession
                //2.02 - 2.03 Converted DB to 2.03 Inserted into preferences: encoderInertialGraphsX
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 556497f6..9a584008 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -305,7 +305,7 @@ class SqlitePreferences : Sqlite
                                Insert (EncoderAutoSaveCurveBestNValue, "3", dbcmdTr);
                                Insert ("email", "", dbcmdTr);
                                Insert ("muteLogs", "False", dbcmdTr);
-                               Insert (ImporterPythonVersion, 
Preferences.pythonVersionEnum.Python.ToString(), dbcmdTr);
+                               Insert (ImporterPythonVersion, 
Preferences.pythonVersionEnum.Python3.ToString(), dbcmdTr);
 
                                //session
                                Insert (LoadLastSessionAtStart, "True", dbcmdTr);


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