Hi,

A patch to give a more elaborate error message for missing module dependencies. Regarding converter dependencies, I don't treat them specially for now; missing converters simply get listed together with missing latex packages. But that's already an improvement.

--
Julien
Index: src/TextClass.cpp
===================================================================
--- src/TextClass.cpp   (revision 36739)
+++ src/TextClass.cpp   (working copy)
@@ -1298,11 +1298,15 @@
                        continue;
                }
                if (!lm->isAvailable()) {
+                       docstring const prereqs = 
from_utf8(lm->prerequisites());
                        docstring const msg =
-                               bformat(_("The module %1$s requires a package 
that is\n"
-                               "not available in your LaTeX installation, or a 
converter\n"
-                               "you have not installed. LaTeX output may not 
be possible.\n"), 
-                               from_utf8(modName));
+                               bformat(_("The module %1$s requires a package 
that is not\n"
+                               "available in your LaTeX installation, or a 
converter that\n"
+                               "you have not installed. LaTeX output may not 
be possible.\n"
+                               "Missing prerequisites:\n"
+                                       "\t%2$s\n"
+                               "See section 3.1.2.3 of the User's Guide for 
more information."),
+                               from_utf8(modName), prereqs);
                        frontend::Alert::warning(_("Package not available"), 
msg);
                }
                FileName layout_file = libFileSearch("layouts", 
lm->getFilename());
Index: src/ModuleList.cpp
===================================================================
--- src/ModuleList.cpp  (revision 36739)
+++ src/ModuleList.cpp  (working copy)
@@ -44,7 +44,21 @@
        filename_ = id_ + ".module";
 }
 
+string LyXModule::prerequisites() const {
+#ifdef TEX2LYX
+       return "";
+#else
+       if (!checked_)
+               isAvailable();
+       if (contains(prerequisites_, ',')) {
+               vector<string> const pres = getVectorFromString(prerequisites_);
+               prerequisites_ = getStringFromVector(pres, "\n\t");
+       }
+       return prerequisites_; 
+#endif
+}
 
+
 bool LyXModule::isAvailable() const {
 #ifdef TEX2LYX
        return true;
@@ -54,16 +68,17 @@
        if (checked_)
                return available_;
        checked_ = true;
+       available_ = true;
+       prerequisites_ = "";
        //check whether all of the required packages are available
        vector<string>::const_iterator it  = package_list_.begin();
        vector<string>::const_iterator end = package_list_.end(); 
        for (; it != end; ++it) {
                if (!LaTeXFeatures::isAvailable(*it)) {
                        available_ = false;
-                       return available_;
+                       prerequisites_ += *it + ",";
                }
        }
-       available_ = true;
        return available_;
 #endif
 }
Index: src/ModuleList.h
===================================================================
--- src/ModuleList.h    (revision 36739)
+++ src/ModuleList.h    (working copy)
@@ -58,6 +58,8 @@
                  std::string const & catgy);
        /// whether the required packages are available
        bool isAvailable() const;
+       /// the missing prerequisites, if any
+       std::string prerequisites() const;
        ///
        std::string const & getName() const { return name_; }
        ///
@@ -108,6 +110,8 @@
        mutable bool checked_;
        ///
        mutable bool available_;
+       ///
+       mutable std::string prerequisites_;
 };
 
 typedef std::vector<LyXModule> LyXModuleList;

Reply via email to