From 97b39bd17cb6d24e84fcab29a51fcafdbab6ee2c Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sun, 24 Apr 2011 15:30:30 +0000 Subject: [PATCH] nixos-gui: - Reduce the number of call the nix-instantiate. - Improve the option panel, show the name, type, description, value, example, default value, declarations and definitions files. svn path=/nixos/trunk/; revision=26951 --- gui/chrome/content/main.js | 37 ++++-- gui/chrome/content/myviewer.xul | 22 +++- gui/chrome/content/nixos.js | 210 ++++++++++++++++++++++++------- gui/chrome/content/optionView.js | 11 +- 4 files changed, 225 insertions(+), 55 deletions(-) diff --git a/gui/chrome/content/main.js b/gui/chrome/content/main.js index de272e27378..ee238993a3d 100644 --- a/gui/chrome/content/main.js +++ b/gui/chrome/content/main.js @@ -18,13 +18,36 @@ function setProgress(current, max) function updatePanel(options) { log("updatePanel: " + options.length); - var t = ""; - for (var i = 0; i < options.length; i++) - { - log("Called with " + options[i].path); - t += options[i].description; - } - $("#option-desc").text(t); + if (options.length == 0) + return; + // FIXME: ignore the rest of the selection for now. + var o = options[0]; + $("#name").attr("label", o.path); + + if (o.typename != null) + $("#typename").attr("label", o.typename); + else + $("#typename").attr("label", ""); + + $("#desc").text(o.description); + + if (o.value != null) + $("#val").text(o.value); + else + $("#val").text(""); + + if (o.defaultValue != null) + $("#def").text(o.defaultValue); + else + $("#def").text(""); + + if (o.example != null) + $("#exp").text(o.example); + else + $("#exp").text(""); + + $("#decls").text(o.declarations.join("\n")); + $("#defs").text(o.definitions.join("\n")); } diff --git a/gui/chrome/content/myviewer.xul b/gui/chrome/content/myviewer.xul index 23c6ce0a65d..732d5d62606 100644 --- a/gui/chrome/content/myviewer.xul +++ b/gui/chrome/content/myviewer.xul @@ -13,7 +13,7 @@ width = "800" height = "600" xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> -