* ATOMS GUI: When a module is not up-to-date, a warning is displayed on the 79/579/5
Pierre MARECHAL [Wed, 12 May 2010 13:11:22 +0000 (15:11 +0200)]
  corresponding sheet.

* bug 6842 fixed - If the installed version of a module was not the most recent
                   one, the ATOMS GUI claimed that the newest version was
                   installed.

Change-Id: Ib5174d5509abad45c2ac80ce534a5a1769a02e46

scilab/CHANGES_5.3.X
scilab/modules/atoms/Makefile.am
scilab/modules/atoms/Makefile.in
scilab/modules/atoms/images/icons/notuptodate.png [new file with mode: 0755]
scilab/modules/atoms/images/icons/software-update-available.png [new file with mode: 0644]
scilab/modules/atoms/locales/en_US/atoms.pot
scilab/modules/atoms/locales/fr_FR/atoms.po
scilab/modules/atoms/macros/atoms_gui/atomsGui.sci
scilab/modules/atoms/macros/atoms_gui/cbAtomsGui.sci
scilab/modules/atoms/tests/nonreg_tests/bug_6842.tst [new file with mode: 0644]

index c2ed488..d362950 100644 (file)
@@ -292,9 +292,15 @@ ATOMS:
 
 * The ATOMS GUI ergonomics has been improved.
 
+* ATOMS GUI: When a module is not up-to-date, a warning is displayed on the
+  corresponding sheet.
+
 * bug 6596 fixed - When the ATOMS GUI started, nothing was displayed. Now, the
                    list of already installed modules appears on the home page.
 
+* bug 6842 fixed - If the installed version of a module was not the most recent
+                   one, the ATOMS GUI claimed that the newest version was
+                   installed.
 
 Bug fixes:
 ==========
index 270a852..7ca7a06 100644 (file)
@@ -23,6 +23,8 @@ MACROSDIRSEXT = macros/atoms_internals macros/atoms_gui
 #### atoms : icons files ####
 libsciatoms_la_iconsdir=$(mydatadir)/
 nobase_libsciatoms_la_icons_DATA = images/icons/installed.png \
-images/icons/notinstalled.png
+images/icons/notinstalled.png \
+images/icons/notuptodate.png \
+images/icons/software-update-available.png
 
 include $(top_srcdir)/Makefile.incl.am
index 6714ebc..4359d01 100644 (file)
@@ -369,7 +369,9 @@ MACROSDIRSEXT = macros/atoms_internals macros/atoms_gui
 #### atoms : icons files ####
 libsciatoms_la_iconsdir = $(mydatadir)/
 nobase_libsciatoms_la_icons_DATA = images/icons/installed.png \
-images/icons/notinstalled.png
+images/icons/notinstalled.png \
+images/icons/notuptodate.png \
+images/icons/software-update-available.png
 
 
 # Where all the Scilab stuff is installed (macros, help, ...)
diff --git a/scilab/modules/atoms/images/icons/notuptodate.png b/scilab/modules/atoms/images/icons/notuptodate.png
new file mode 100755 (executable)
index 0000000..7c40430
Binary files /dev/null and b/scilab/modules/atoms/images/icons/notuptodate.png differ
diff --git a/scilab/modules/atoms/images/icons/software-update-available.png b/scilab/modules/atoms/images/icons/software-update-available.png
new file mode 100644 (file)
index 0000000..ab8d494
Binary files /dev/null and b/scilab/modules/atoms/images/icons/software-update-available.png differ
index a2e0b39..5730af5 100644 (file)
@@ -14,7 +14,7 @@ msgstr ""
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=ISO-8859-1\n"
 "Content-Transfer-Encoding: 8bit\n"
-"Revision-Date: 2010-05-18 15:11+0100\n"
+"Revision-Date: 2010-05-18 15:22+0100\n"
 
 # File: macros/atomsAutoloadAdd.sci, line: 168
 # File: macros/atomsAutoloadAdd.sci, line: 173
@@ -751,7 +751,7 @@ msgstr ""
 msgid "%s: Wrong value for input argument #%d: ''%s'' is not a valid URL.\n"
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 135
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 134
 #, c-format
 msgid "%s: Wrong value for input argument #%d: ''%s'' or ''%s'' expected.\n"
 msgstr ""
@@ -974,47 +974,52 @@ msgstr ""
 msgid "%s: the package ''%s'' doesn''t exist.\n"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 69
+# File: macros/atoms_gui/atomsGui.sci, line: 73
 msgid "&?"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 68
+# File: macros/atoms_gui/atomsGui.sci, line: 72
 msgid "&Edit"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 66
+# File: macros/atoms_gui/atomsGui.sci, line: 70
 msgid "&File"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 67
+# File: macros/atoms_gui/atomsGui.sci, line: 71
 msgid "&Tools"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 97
+# File: macros/atoms_gui/atomsGui.sci, line: 101
 msgid "?"
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 62
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 72
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 82
-# File: macros/atoms_gui/atomsGui.sci, line: 57
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 290
+#, c-format
+msgid "A new version (''%s'') of ''%s'' is available"
+msgstr ""
+#
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 61
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 71
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 81
+# File: macros/atoms_gui/atomsGui.sci, line: 61
 msgid "Atoms"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 102
+# File: macros/atoms_gui/atomsGui.sci, line: 106
 msgid "Atoms Help..."
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 60
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 70
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 80
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 59
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 69
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 79
 # File: macros/atoms_gui/atomsGui.sci, line: 23
 # File: macros/atoms_gui/atomsGui.sci, line: 25
 msgid "Atoms error"
 msgstr ""
 #
 # File: macros/atomsShow.sci, line: 85
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 222
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 234
 msgid "Author(s)"
 msgstr ""
 #
@@ -1022,7 +1027,7 @@ msgstr ""
 msgid "Automatically Installed"
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 320
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 329
 msgid "Bytes"
 msgstr ""
 #
@@ -1030,7 +1035,7 @@ msgstr ""
 msgid "Category(ies)"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 90
+# File: macros/atoms_gui/atomsGui.sci, line: 94
 msgid "Close"
 msgstr ""
 #
@@ -1039,11 +1044,11 @@ msgid "Depend"
 msgstr ""
 #
 # File: macros/atomsShow.sci, line: 99
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 244
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 256
 msgid "Description"
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 207
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 219
 msgid "Download size"
 msgstr ""
 #
@@ -1051,15 +1056,15 @@ msgstr ""
 msgid "Entity"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 78
+# File: macros/atoms_gui/atomsGui.sci, line: 82
 msgid "File"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 83
+# File: macros/atoms_gui/atomsGui.sci, line: 87
 msgid "Home"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 288
+# File: macros/atoms_gui/atomsGui.sci, line: 315
 msgid "Install"
 msgstr ""
 #
@@ -1067,15 +1072,15 @@ msgstr ""
 msgid "Install Directory"
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 62
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 61
 msgid "Installation done! Please restart Scilab to take changes into account."
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 60
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 59
 msgid "Installation failed!"
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 323
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 332
 msgid "KB"
 msgstr ""
 #
@@ -1083,12 +1088,12 @@ msgstr ""
 msgid "License"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 251
-# File: macros/atoms_gui/atomsGui.sci, line: 325
+# File: macros/atoms_gui/atomsGui.sci, line: 278
+# File: macros/atoms_gui/atomsGui.sci, line: 352
 msgid "List of installed modules"
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 326
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 335
 msgid "MB"
 msgstr ""
 #
@@ -1096,7 +1101,7 @@ msgstr ""
 msgid "Maintainer(s)"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 206
+# File: macros/atoms_gui/atomsGui.sci, line: 233
 msgid "Modules"
 msgstr ""
 #
@@ -1112,15 +1117,15 @@ msgstr ""
 msgid "Package"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 278
+# File: macros/atoms_gui/atomsGui.sci, line: 305
 msgid "Remove"
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 72
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 71
 msgid "Remove done! Please restart Scilab to take changes into account. "
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 70
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 69
 msgid "Remove failed!"
 msgstr ""
 #
@@ -1140,20 +1145,20 @@ msgstr ""
 msgid "Title"
 msgstr ""
 #
-# File: macros/atoms_gui/atomsGui.sci, line: 298
+# File: macros/atoms_gui/atomsGui.sci, line: 325
 msgid "Update"
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 82
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 81
 msgid "Update done! Please restart Scilab to take changes into account."
 msgstr ""
 #
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 80
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 79
 msgid "Update failed!"
 msgstr ""
 #
 # File: macros/atomsShow.sci, line: 82
-# File: macros/atoms_gui/cbAtomsGui.sci, line: 239
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 251
 msgid "Version"
 msgstr ""
 #
index 3aa2883..51a5138 100644 (file)
@@ -634,6 +634,12 @@ msgstr "&Outils"
 msgid "?"
 msgstr "?"
 
+#
+# File: macros/atoms_gui/cbAtomsGui.sci, line: 290
+#, c-format
+msgid "A new version (''%s'') of ''%s'' is available"
+msgstr ""
+
 msgid "Atoms"
 msgstr "Atoms"
 
index 7a3be5c..1e0ec60 100644 (file)
@@ -38,6 +38,10 @@ function atomsGui()
     margin           = 10;
     widgetHeight     = 25;
 
+    // Message Frame
+    msgWidth         = figwidth -2*margin;
+    msgHeight        = 30;
+
     // Button
     buttonHeight     = 20;
 
@@ -115,8 +119,19 @@ function atomsGui()
         vers           = getfield(1, allModules(modulesNames(k)));
         vers           = vers(3);
 
-        if atomsIsInstalled([modulesNames(k) vers]) then
-            icon = "installed.png";
+        if atomsIsInstalled(modulesNames(k)) then
+
+            MRVersionAvailable = atomsGetMRVersion(modulesNames(k));
+            MRVersionInstalled = atomsVersionSort(atomsGetInstalledVers(modulesNames(k)),"DESC");
+            MRVersionInstalled = MRVersionInstalled(1);
+            if atomsVersionCompare(MRVersionInstalled,MRVersionAvailable) == -1 then
+                // Not up-to-date
+                icon = "notuptodate.png";
+            else
+                // The Most Recent Version is already installed
+                icon = "installed.png";
+            end
+
         else
             icon = "notinstalled.png";
         end
@@ -151,6 +166,17 @@ function atomsGui()
 
     for k=1:size(installed(:,1), "*")
 
+        MRVersionAvailable = atomsGetMRVersion(installed(k,1));
+        MRVersionInstalled = atomsVersionSort(atomsGetInstalledVers(installed(k,1)),"DESC");
+        MRVersionInstalled = MRVersionInstalled(1);
+        if atomsVersionCompare(MRVersionInstalled,MRVersionAvailable) == -1 then
+            // Not up-to-date
+            icon = "notuptodate.png";
+        else
+            // The Most Recent Version is already installed
+            icon = "installed.png";
+        end
+
         if modulo(k,2) == 0 then
             background = "#eeeeee";
         else
@@ -158,8 +184,9 @@ function atomsGui()
         end
 
         thisItem =            "<html>";
+
         thisItem = thisItem + "<table style=""background-color:"+background+";color:#000000;"" ><tr>";
-        thisItem = thisItem + "<td><img src=""file:///"+SCI+"/modules/atoms/images/icons/installed.png"" /></td>";
+        thisItem = thisItem + "<td><img src=""file:///"+SCI+"/modules/atoms/images/icons/"+icon+""" /></td>";
         thisItem = thisItem + "<td>";
         thisItem = thisItem + "  <div style=""width:385px;text-align:left;"">";
         thisItem = thisItem + "    <span style=""font-weight:bold;"">"+allModules(installed(k,1))(installed(k,2)).Title+" "+installed(k,2)+"</span><br />";
@@ -184,7 +211,7 @@ function atomsGui()
     listboxWidth              = 200;
     listboxFrameWidth         = listboxWidth + 2*margin;
 
-    listboxFrameHeight        = figheight- 2*margin;
+    listboxFrameHeight        = figheight- 3*margin - msgHeight;
     listboxHeight             = listboxFrameHeight - 3*margin;
 
     // Frame
@@ -192,7 +219,7 @@ function atomsGui()
         "Parent"              , atomsfig,..
         "Style"               , "frame",..
         "Relief"              , "solid",..
-        "Position"            , [margin margin listboxFrameWidth listboxFrameHeight],..
+        "Position"            , [margin widgetHeight+2*margin listboxFrameWidth listboxFrameHeight],..
         "Background"          , [1 1 1],..
         "Tag"                 , "LeftFrame");
 
@@ -237,7 +264,7 @@ function atomsGui()
         "Style"              , "frame",..
         "Relief"             , "solid",..
         "Background"         , [1 1 1],..
-        "Position"           , [listboxFrameWidth+2*margin margin descFrameWidth descFrameHeight],..
+        "Position"           , [listboxFrameWidth+2*margin widgetHeight+2*margin descFrameWidth descFrameHeight],..
         "Tag"                , "DescFrame", ..
         "Visible"            , "off");
 
@@ -301,7 +328,7 @@ function atomsGui()
         "Tag"                , "updateButton");
 
     // Home: List of installed modules
-    // =============================================================================
+    // =========================================================================
 
     descWidth                = descFrameWidth  - 2*margin;
     descHeight               = descFrameHeight - 3*margin;
@@ -312,7 +339,7 @@ function atomsGui()
         "Style"              , "frame",..
         "Relief"             , "solid",..
         "Background"         , [1 1 1],..
-        "Position"           , [listboxFrameWidth+2*margin margin descFrameWidth descFrameHeight],..
+        "Position"           , [listboxFrameWidth+2*margin widgetHeight+2*margin descFrameWidth descFrameHeight],..
         "Tag"                , "HomeFrame");
 
     // Frame title
@@ -341,4 +368,28 @@ function atomsGui()
         "Max"                 , 1, ..
         "Tag"                 , "HomeListbox");
 
+    // Message Frame
+    // =========================================================================
+
+    // Frame
+    msgFrame                 = uicontrol( ..
+        "Parent"             , atomsfig,..
+        "Style"              , "frame",..
+        "Relief"             , "solid",..
+        "Background"         , [1 1 1],..
+        "Position"           , [margin margin msgWidth msgHeight],..
+        "Tag"                , "msgFrame");
+
+    // Text
+    msgText                  = uicontrol( ..
+        "Parent"             , msgFrame,...
+        "Style"              , "text",..
+        "HorizontalAlignment", "left",..
+        "VerticalAlignment"  , "middle",..
+        "String"             , "", ..
+        "FontSize"           , 12,..
+        "Background"         , [1 1 1],..
+        "Position"           , [2 2 msgWidth-10 msgHeight-4],..
+        "Tag"                , "msgText");
+
 endfunction
index a260bdf..322ff6a 100644 (file)
@@ -22,7 +22,6 @@ function cbAtomsGui()
     // Get the description frame object
     DescFrame = findobj("tag","DescFrame");
 
-
     // Display selected module informations
     // =========================================================================
 
@@ -189,14 +188,27 @@ function updateDescFrame()
     allModules     = get(thisFigure,"userdata");
     thisModuleName = get(DescFrame ,"userdata");
 
+    // Reset the message frame
+    // =========================================================================
+    set(findobj("tag","msgText"),"String","");
+
     // Get the module details
     // =========================================================================
 
     modulesNames       = getfield(1, allModules);
     modulesNames (1:2) = [];
     thisModuleStruct   = allModules(thisModuleName);
-    thisModuleVersions = getfield(1,thisModuleStruct);
-    thisModuleDetails  = thisModuleStruct(thisModuleVersions(3));
+
+    MRVersionAvailable = atomsGetMRVersion(thisModuleName);
+    MRVersionInstalled = "";
+
+    if atomsIsInstalled(thisModuleName) then
+        MRVersionInstalled = atomsVersionSort(atomsGetInstalledVers(thisModuleName),"DESC");
+        MRVersionInstalled = MRVersionInstalled(1);
+        thisModuleDetails  = thisModuleStruct(MRVersionInstalled);
+    else
+        thisModuleDetails  = thisModuleStruct(MRVersionAvailable);
+    end
 
     // Manage size
     // =========================================================================
@@ -270,15 +282,12 @@ function updateDescFrame()
     // Tests for update available
     // --------------------------
 
-    moduleVersion     = atomsGetMRVersion(thisModuleName);
-    installedVersions = atomsGetInstalledVers(thisModuleName);
-    canUpdate         = "off";
+    canUpdate = "off";
 
-    for k=1:size(installedVersions,"*")
-        if atomsVersionCompare(installedVersions(k), moduleVersion)==-1 then
-            canUpdate = "on";
-            break
-        end
+    if atomsIsInstalled(thisModuleName) & atomsVersionCompare(MRVersionInstalled,MRVersionAvailable) == -1 then
+        // Not up-to-date
+        canUpdate = "on";
+        showWarning(sprintf(gettext("A new version (''%s'') of ''%s'' is available"),MRVersionAvailable,thisModuleDetails.Title));
     end
 
     // Can be removed
@@ -355,6 +364,9 @@ endfunction
 
 function showHome()
 
+    // Reset the message frame
+    set(findobj("tag","msgText"),"String","");
+
     // Hide the Desc frame
     hide("DescFrame");
     hide("DescTitle");
@@ -392,3 +404,24 @@ function showDesc()
     show("updateButton");
 
 endfunction
+
+
+// =============================================================================
+// showWarning
+// + Update the string in the msg Frame
+// =============================================================================
+
+function showWarning(msg)
+
+    str =       "<html>";
+    str = str + "<table><tr>";
+    str = str + "<td><img src=""file:///"+SCI+"/modules/atoms/images/icons/software-update-available.png"" /></td>";
+    str = str + "<td><div style=""color:red;font-style:italic;"">"+msg+"</div></td>";
+    str = str + "</tr></table>";
+    str = str + "</html>";
+
+    msgText = findobj("tag","msgText");
+
+    set(msgText,"String",str);
+
+endfunction
diff --git a/scilab/modules/atoms/tests/nonreg_tests/bug_6842.tst b/scilab/modules/atoms/tests/nonreg_tests/bug_6842.tst
new file mode 100644 (file)
index 0000000..4a373f9
--- /dev/null
@@ -0,0 +1,32 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH ATOMS -->
+// <-- INTERACTIVE TEST -->
+//
+// <-- Non-regression test for bug 6842 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=6842
+//
+// <-- Short Description -->
+// When an ATOMS module has several versions and that, e.g. the oldest is
+// installed by using atomsInstall on Scilab's command line, atomsGUI claims
+// that the newest version is installed.
+
+load("SCI/modules/atoms/macros/atoms_internals/lib");
+
+atomsRepositorySetOfl("http://scene11.test.atoms.scilab.org");
+atomsSystemUpdate();
+atomsInstall(["toolbox_4","1.0-1"]);
+if ~atomsIsInstalled("toolbox_4") then pause, end
+atomsGui();
+
+// Check if there is a warning when the description of toolbox_1 is displayed.
+
+atomsRemove("toolbox_1");
+atomsRepositorySetOfl("http://atoms.scilab.org");