[OpenWalnut-Dev] [OWci] r6854: [ADD #320] Now there is the possibility to store the additional library paths of module toolboxes within the .OpenWalnut/config.script file. The file format is as follows and compatible with the config.qt4gui file format: The file should ...

Alexander Wiebel alexander.wiebel at hs-coburg.de
Wed Jan 22 12:06:34 CET 2014


Hi fellow OW-developers

I just realized (after years) that calling this ScriptGUI (where GUI
stands for _graphical_ user interface) does make much sense. I would
recommend to change the name to ScriptUI.

Any comments on this suggestion?

Cheers
Alex



On 01/16/2014 11:03 AM, math wrote:
> *Branch default*
> [ADD #320] Now there is the possibility to store the additional library paths of module toolboxes within the .OpenWalnut/config.script file. The file format is as follows and compatible with the config.qt4gui file format: The file should contain a line starting with "additionalModulePaths=" followed by a comma separated list of absolute paths. If the lines does not occur or the file is not present nothing will be done.
> 
> changeset 6854:73ae843c578c in /srv/hg/ow (Thu Jan 16 10:49:33 2014 +0100):
> 
> http://www.openwalnut.org/projects/openwalnut/repository/revisions/6854
> 
> diffstat:
> 
>  src/scriptgui/gui/WScriptGui.cpp |  34 +++++++++++++++++++++++++++++++++-
>  src/scriptgui/gui/WScriptGui.h   |   9 +++++++++
>  2 files changed, 42 insertions(+), 1 deletions(-)
> 
> diffs (77 lines):
> 
> diff -r 8450165961a4 -r 73ae843c578c src/scriptgui/gui/WScriptGui.cpp
> --- a/src/scriptgui/gui/WScriptGui.cpp	Thu Jan 16 10:41:20 2014 +0100
> +++ b/src/scriptgui/gui/WScriptGui.cpp	Thu Jan 16 10:49:33 2014 +0100
> @@ -22,9 +22,14 @@
>  //
>  //---------------------------------------------------------------------------
>  
> +#include <fstream>
> +#include <sstream>
>  #include <string>
>  #include <vector>
>  
> +#include <boost/algorithm/string/predicate.hpp>
> +#include <boost/algorithm/string.hpp>
> +
>  #include "core/common/WLogger.h"
>  #include "core/common/WIOTools.h"
>  #include "core/common/WLogStream.h"
> @@ -76,6 +81,8 @@
>      WPathHelper::getPathHelper()->setBasePaths( walnutBin, homePath / ".OpenWalnut" );
>  #endif
>  
> +    loadToolboxes( WPathHelper::getHomePath() / "config.script" );
> +
>      //----------------------------
>      // startup
>      //----------------------------
> @@ -201,4 +208,29 @@
>  {
>  }
>  
> -
> +void WScriptGui::loadToolboxes( boost::filesystem::path configPath )
> +{
> +    // add additional module paths to the PathHelper, the rest will be done by module loader
> +    if( boost::filesystem::exists( configPath ) )
> +    {
> +        wlog::info( "Walnut" ) << "Reading config file from: " << configPath;
> +        std::ifstream is( configPath.string().c_str() );
> +        std::string line;
> +        std::string pattern = "additionalModulePaths="; // same pattern in config.qt4gui file, so you may use symlinks
> +        while( std::getline( is, line ) )
> +        {
> +            if( boost::starts_with( line, pattern ) )
> +            {
> +                std::istringstream ss( line.substr( pattern.size(), line.size() - pattern.size() ) );
> +                std::string path;
> +                while( std::getline( ss, path, ',' ) )
> +                {
> +                    boost::algorithm::trim( path );
> +                    WPathHelper::getPathHelper()->addAdditionalModulePath( path );
> +                    // wlog::debug( "Walnut" ) << "Added: " << path << " to PathHelper";
> +                }
> +                break;
> +            }
> +        }
> +    }
> +}
> diff -r 8450165961a4 -r 73ae843c578c src/scriptgui/gui/WScriptGui.h
> --- a/src/scriptgui/gui/WScriptGui.h	Thu Jan 16 10:41:20 2014 +0100
> +++ b/src/scriptgui/gui/WScriptGui.h	Thu Jan 16 10:49:33 2014 +0100
> @@ -79,6 +79,15 @@
>      virtual void closeCustomWidget( WCustomWidget::SPtr );
>  
>  protected:
> +    /**
> +     * If you need to load additional modules from your toolboxes, you might want specify these paths in a config file.
> +     * In that file we need a line starting with: "additionalModulePaths=" followed by a comma separated list of paths.
> +     * Please note this is the same format as in the config.qt4gui file, so you may symlink it.
> +     *
> +     * \param configPath This is the path to the config file. If not existent, nothing will be thrown or done.
> +     */
> +    virtual void loadToolboxes( boost::filesystem::path configPath );
> +
>      //! The programm options.
>      boost::program_options::variables_map const& m_programOptions;
>  };
> _______________________________________________
> All-openwalnut-commits mailing list
> All-openwalnut-commits at lists.informatik.uni-leipzig.de
> http://lists.informatik.uni-leipzig.de/mailman/listinfo/all-openwalnut-commits
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.informatik.uni-leipzig.de/pipermail/openwalnut-dev/attachments/20140122/5b84e30c/attachment.asc>


More information about the OpenWalnut-Dev mailing list