Mailinglist Archive: yast-commit (815 mails)

< Previous Next >
[yast-commit] r39886 - in /trunk/packager: package/yast2-packager.changes src/clients/inst_source.ycp src/modules/ src/modules/PackageCallbacks.ycp src/modules/SourceDialogs.ycp
  • From: lslezak@xxxxxxxxxxxxxxxx
  • Date: Thu, 02 Aug 2007 09:24:36 -0000
  • Message-id: <20070802092436.A627CB5879@xxxxxxxxxxxxxxxx>
Author: lslezak
Date: Thu Aug  2 11:24:36 2007
New Revision: 39886

URL: http://svn.opensuse.org/viewcvs/yast?rev=39886&view=rev
Log:
- inst_source - download metadata for CD/DVD repositories
  immedately, the medium can be changed later and accidentaly
  a different repository can registered
- improved download progress callback handlers (#292629)
- fixed "tick" callback progress

Modified:
    trunk/packager/package/yast2-packager.changes
    trunk/packager/src/clients/inst_source.ycp
    trunk/packager/src/modules/   (props changed)
    trunk/packager/src/modules/PackageCallbacks.ycp
    trunk/packager/src/modules/SourceDialogs.ycp

Modified: trunk/packager/package/yast2-packager.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.changes?rev=39886&r1=39885&r2=39886&view=diff
==============================================================================
--- trunk/packager/package/yast2-packager.changes (original)
+++ trunk/packager/package/yast2-packager.changes Thu Aug  2 11:24:36 2007
@@ -1,4 +1,13 @@
 -------------------------------------------------------------------
+Thu Aug  2 11:08:37 CEST 2007 - lslezak@xxxxxxx
+
+- inst_source - download metadata for CD/DVD repositories
+  immedately, the medium can be changed later and accidentaly
+  a different repository can registered
+- improved download progress callback handlers (#292629)
+- fixed "tick" callback progress
+
+-------------------------------------------------------------------
 Tue Jul 31 14:24:52 CEST 2007 - locilka@xxxxxxx
 
 - New location of licenses on the media - in /media.1/license/

Modified: trunk/packager/src/clients/inst_source.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/clients/inst_source.ycp?rev=39886&r1=39885&r2=39886&view=diff
==============================================================================
--- trunk/packager/src/clients/inst_source.ycp (original)
+++ trunk/packager/src/clients/inst_source.ycp Thu Aug  2 11:24:36 2007
@@ -301,9 +301,18 @@
                    repo_prop["type"] = repo_type;
 
                    integer new_repo_id = Pkg::RepositoryAdd(repo_prop);
-                   y2internal("New repository: %1: %2", new_repo_id, repo_prop);
+                   y2milestone("Added repository: %1: %2", new_repo_id, repo_prop);
 
                    newSources = add(newSources, new_repo_id);
+
+                   if (contains(["cd", "dvd"], tolower(URL::Parse(url)["scheme"]:"")))
+                   {
+                       // for CD/DVD repo download the metadata immediately,
+                       // the medium is in the drive right now, it can be changed later
+                       // and accidentaly added a different repository
+                       y2milestone("Adding a CD or DVD repository, refreshing now...");
+                       Pkg::SourceRefreshNow(new_repo_id);
+                   }
                }
            );
 

Modified: trunk/packager/src/modules/PackageCallbacks.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/PackageCallbacks.ycp?rev=39886&r1=39885&r2=39886&view=diff
==============================================================================
--- trunk/packager/src/modules/PackageCallbacks.ycp (original)
+++ trunk/packager/src/modules/PackageCallbacks.ycp Thu Aug  2 11:24:36 2007
@@ -804,6 +804,7 @@
                w = URL::FormatURL(parsed, max_len);
            }
            // is it a file name?
+           else
            {
                if (substring(w, 0, 1) == "/")
                {
@@ -1503,42 +1504,85 @@
     }
 
 
+    global boolean IsDownloadProgressPopup()
+    {
+       return (!Mode::commandline()) &&
+           UI::WidgetExists(`id(`download_progress_popup_window)) &&
+           UI::WidgetExists(`id(`progress));
+    }
+
+    global void CloseDownloadProgressPopup()
+    {
+       if (IsDownloadProgressPopup())
+       {
+           UI::CloseDialog();
+       }
+    }
+
+    global void InitDownload(string task)
+    {
+       if (!Mode::commandline())
+       {
+           if (!IsDownloadProgressPopup())
+           {
+               // heading of popup
+               string heading = _("Downloading");
+
+               UI::OpenDialog (`opt(`decorated),
+                               `VBox (`Heading (`id(`download_progress_popup_window), heading) ,
+                                      `VBox (
+                                             `HSpacing(60),
+                                             `HBox(
+                                                   `HSpacing(1),
+                                                   `ProgressBar (`id(`progress),
+                                                                 task, 100),
+                                                   `HSpacing(1)
+                                                   ),
+                                             `VSpacing(0.5),
+                                             `HBox (
+                                               `HStretch (),
+                                               `PushButton (`id (`abort), Label::AbortButton ()),
+                                               `HStretch ()
+                                             ),
+                                             `VSpacing(0.5)
+                                             )
+                                      )
+                               );
+           }
+
+           UI::ChangeWidget (`id(`progress), `Value, 0);
+       }
+    }
+
+    global void DestDownload()
+    {
+       CloseDownloadProgressPopup();
+    }
+
     global void StartDownload (string url, string localfile)
     {
+       y2milestone("Downloading %1 to %2", url, localfile);
+
        // heading of popup
-       string heading = _("Download");
+       string heading = _("Downloading");
+
+       // reformat the URL
+       string url_report = URL::FormatURL(URL::Parse(url), max_size);
 
        // message in a progress popup
-       string message = sformat (_("Downloading: %1"), url);
+       string message = sformat (_("Downloading: %1"), url_report);
 
        if (Mode::commandline()) {
            CommandLine::PrintVerbose(message);
        }
        else
        {
-           UI::OpenDialog (`opt(`decorated),
-                           `VBox (`Heading (heading) ,
-                                  `VBox (
-                                         `Label(message),
-                                         `HSpacing(60),
-                                         `HBox(
-                                               `HSpacing(2),
-                                               `ProgressBar (`id(`progress),
-                                                             _("Status"), 100),
-                                               `HSpacing(2)
-                                               ),
-                                         `VSpacing(1),
-                                         `HBox (
-                                           `HStretch (),
-                                           `PushButton (`id (`abort), Label::AbortButton ()),
-                                           `HStretch ()
-                                         ),
-                                         `VSpacing(1)
-                                         )
-                                  )
-                           );
-
-           UI::ChangeWidget (`id(`progress), `Value, 0);
+           if (IsDownloadProgressPopup())
+           {
+               // change the label
+               UI::ChangeWidget(`id(`progress), `Label, message);
+               UI::ChangeWidget (`id(`progress), `Value, 0);
+           }
        }
     }
 
@@ -1579,16 +1623,16 @@
 %1"), error_text));
            }
        }
-
-       UI::CloseDialog ();
     }
 
 
     global void SetDownloadCallbacks ()
     {
+       Pkg::CallbackInitDownload ("PackageCallbacks::InitDownload");
        Pkg::CallbackStartDownload ("PackageCallbacks::StartDownload");
        Pkg::CallbackProgressDownload ("PackageCallbacks::ProgressDownload");
        Pkg::CallbackDoneDownload ("PackageCallbacks::DoneDownload");
+       Pkg::CallbackDestDownload ("PackageCallbacks::DestDownload");
     }
 
     global void ClearDownloadCallbacks ()
@@ -2037,12 +2081,21 @@
        }
 
        UI::OpenDialog(
-           `VBox(
-               `HSpacing(`id(`callback_progress_popup), max_size),
-               (in_percent) ? `ProgressBar (`id (`progress_widget), task, 100, val_percent)
-                   : `Label(`id(`progress_widget), sformat("%1: %2", task, (tick_progress) ? tick_labels[current_tick]:"/" : val_raw)),
-               `VSpacing(0.5),
-               `PushButton (`id (`abort), Label::AbortButton ())
+           `HBox(
+               `HSpacing(1),
+               `VBox(
+                   `VSpacing(0.5),
+                   `HSpacing(`id(`callback_progress_popup), max_size),
+                   (in_percent) ? `ProgressBar (`id (`progress_widget), task, 100, val_percent)
+                       : `VBox(
+                           `Label(task),
+                           `Label(`id(`progress_widget), (tick_progress) ? tick_labels[current_tick]:"/" : val_raw)
+                       ),
+                   `VSpacing(0.5),
+                   `PushButton (`id (`abort), Label::AbortButton ()),
+                   `VSpacing(0.5)
+               ),
+               `HSpacing(1)
            )
        );
 

Modified: trunk/packager/src/modules/SourceDialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/SourceDialogs.ycp?rev=39886&r1=39885&r2=39886&view=diff
==============================================================================
--- trunk/packager/src/modules/SourceDialogs.ycp (original)
+++ trunk/packager/src/modules/SourceDialogs.ycp Thu Aug  2 11:24:36 2007
@@ -244,10 +244,12 @@
        "init" : RepoNameInit,
        "store" : RepoNameStore,
        "validate_type" : `function,
+       // TODO FIXME: RepoName can be empty if the URL has been changed,
+       // yast will use the product name or the URL in this case (the repository is recreated)
        "validate_function" : RepoNameValidate,
        // help text
        "help" : _("<p><big><b>Repository Name</b></big><br>
-Use <b>Repository Name</b> to specify the name of the repository.</p>")
+Use <b>Repository Name</b> to specify the name of the repository. If it is empty Yast will use the product name (if available) or the URL as the name.</p>")
     ];
 
 }

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages