From: guigues Date: Tue, 12 Feb 2008 12:55:15 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: r0.6.1~237 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=01f46ce7ba8fe9067dff0688706986475aaec73e;p=bbtk.git *** empty log message *** --- diff --git a/kernel/cmake/BBTKConfigurePackage.cmake b/kernel/cmake/BBTKConfigurePackage.cmake index 2cea2fc..e529b0a 100644 --- a/kernel/cmake/BBTKConfigurePackage.cmake +++ b/kernel/cmake/BBTKConfigurePackage.cmake @@ -40,6 +40,19 @@ ENDIF(UNIX) IF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME}) #--------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # VARS CONFIGURED IN bbPackage.h AND IN doc/bbdoc/header.html.in + SET(BBTK_PACKAGE_AUTHOR "${${BBTK_PACKAGE_NAME}_AUTHOR}") + SET(BBTK_PACKAGE_DESCRIPTION "${${BBTK_PACKAGE_NAME}_DESCRIPTION}") + SET(BBTK_PACKAGE_MAJOR_VERSION ${${BBTK_PACKAGE_NAME}_MAJOR_VERSION}) + SET(BBTK_PACKAGE_MINOR_VERSION ${${BBTK_PACKAGE_NAME}_MINOR_VERSION}) + SET(BBTK_PACKAGE_BUILD_VERSION ${${BBTK_PACKAGE_NAME}_BUILD_VERSION}) + SET(BBTK_PACKAGE_VERSION + "\"${${BBTK_PACKAGE_NAME}_MAJOR_VERSION}.${${BBTK_PACKAGE_NAME}_MINOR_VERSION}.${${BBTK_PACKAGE_NAME}_BUILD_VERSION}\"") + #---------------------------------------------------------------------------- + + #--------------------------------------------------------------------------- # If package deps not in global deps : add them IF(NOT ${BBTK_PACKAGE_NAME}_IN_DEPS) diff --git a/kernel/cmake/BBTKConfigurePackage_src.cmake b/kernel/cmake/BBTKConfigurePackage_src.cmake index 967fbde..1f33f21 100644 --- a/kernel/cmake/BBTKConfigurePackage_src.cmake +++ b/kernel/cmake/BBTKConfigurePackage_src.cmake @@ -14,16 +14,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ) INCLUDE_DIRECTORIES(../${${BBTK_PACKAGE_NAME}_INCLUDE_DIRS}) #---------------------------------------------------------------------------- -#---------------------------------------------------------------------------- -# VARS CONFIGURED IN bbPackage.h -SET(BBTK_PACKAGE_AUTHOR "\"${${BBTK_PACKAGE_NAME}_AUTHOR}\"") -SET(BBTK_PACKAGE_DESCRIPTION "\"${${BBTK_PACKAGE_NAME}_DESCRIPTION}\"") -SET(BBTK_PACKAGE_MAJOR_VERSION ${${BBTK_PACKAGE_NAME}_MAJOR_VERSION}) -SET(BBTK_PACKAGE_MINOR_VERSION ${${BBTK_PACKAGE_NAME}_MINOR_VERSION}) -SET(BBTK_PACKAGE_BUILD_VERSION ${${BBTK_PACKAGE_NAME}_BUILD_VERSION}) -SET(BBTK_PACKAGE_VERSION - "\"${${BBTK_PACKAGE_NAME}_MAJOR_VERSION}.${${BBTK_PACKAGE_NAME}_MINOR_VERSION}.${${BBTK_PACKAGE_NAME}_BUILD_VERSION}\"") -#---------------------------------------------------------------------------- #---------------------------------------------------------------------------- diff --git a/kernel/cmake/bbPackage.cxx.in b/kernel/cmake/bbPackage.cxx.in index e64aaad..8e8fde5 100644 --- a/kernel/cmake/bbPackage.cxx.in +++ b/kernel/cmake/bbPackage.cxx.in @@ -1,6 +1,6 @@ #include "bb@BBTK_PACKAGE_NAME@Package.h" BBTK_IMPLEMENT_PACKAGE(@BBTK_PACKAGE_NAME@, - @BBTK_PACKAGE_AUTHOR@, - @BBTK_PACKAGE_DESCRIPTION@, + "@BBTK_PACKAGE_AUTHOR@", + "@BBTK_PACKAGE_DESCRIPTION@", @BBTK_PACKAGE_VERSION@) diff --git a/kernel/doc/bbtkUsersGuide/bbi-gui.png b/kernel/doc/bbtkUsersGuide/bbi-gui.png new file mode 100644 index 0000000..be00d84 Binary files /dev/null and b/kernel/doc/bbtkUsersGuide/bbi-gui.png differ diff --git a/kernel/doc/bbtkUsersGuide/bbtkUsersGuide.tex b/kernel/doc/bbtkUsersGuide/bbtkUsersGuide.tex index fb6e131..5cd9e8d 100644 --- a/kernel/doc/bbtkUsersGuide/bbtkUsersGuide.tex +++ b/kernel/doc/bbtkUsersGuide/bbtkUsersGuide.tex @@ -34,6 +34,14 @@ defines a {\bf black box} as \emph{``any component in a system in which only the input and output characteristics are of interest, without regard to its internal mechanism or structure''}. +I would add something very important to this definition : +not only the inputs and outputs are of interest but also +\emph{what the box does} ! +Hence, I would say that a black box is any \emph{\bf documented} +component of a system, letting know the user +\emph{\bf what} the box is supposed to do and +\emph{\bf how to use it} +but not \emph{\bf how it does it}. \BBTK provides a systematic framework to encapsulate (or ``wrap'') any @@ -46,7 +54,7 @@ for all boxes. Hence one does not need to know which particular method allows, say, to set a particular input or get a particular output of the box. One can use a black box in a purely abstract way. -\item{\bf symbolic} means a particular +\item{\bf symbolic} means that a particular input or output is referenced by a 'name', that is by a symbol which identifies the input or output. It also means that symbolic information (text!) is @@ -82,13 +90,13 @@ which allows to manipulate packages and boxes very easily in symbolic way. \BBTK provides one: \bbi (the Black Box Interpreter). \item {\bf Automatic documentation} of existing packages. \texttt{html} documentation of packages is proposed by -the \bbdoc application. +\bbi. \end{itemize} Finally, these different components allow {\bf efficient}: \begin{itemize} -\item {\bf capitalization and reuse} of existing processings, +\item {\bf capitalization and reuse} of existing processing units, including {\bf documentation} \item {\bf testing, prototyping} in a very simple script language \item {\bf inter-operability} between atomic processings which @@ -119,10 +127,11 @@ processing chains by connecting various black boxes of the already loaded packag \begin{itemize} \item \bbfy generates the \CPP code of a black box from a description file written in \texttt{xml}. -\item \bbdoc generates the html documentation of a black box package -(author, description, description of its black boxes: -author, description, inputs, outputs, and so on). -\item \bbCreatePackage creates a directory on disk which contains the basic files to start the development of a new black box package. +%\item \bbdoc generates the html documentation of a black box package +%(author, description, description of its black boxes: +%author, description, inputs, outputs, and so on). +\item \bbCreatePackage allows to create the basic file architecture +to start the development of a new black box package. \end{itemize} \end{itemize} @@ -208,14 +217,26 @@ Use it as a reference. To run the black box interpreter, open a console and type \texttt{bbi} or double click on the application icon. -You get a message and a prompt: -\begin{verbatim} -$$ bbi -BBI (Black Box Interpreter) - bbtk "1.0.0" - (c) Creatis 2007 -> -\end{verbatim} +You get a window which looks like the one in figure +\ref{bbi-fig-bbi-gui} +(the exact appearance of \bbi is system and \bbtk version dependent) +\footnote{If you compiled \bbtk without \wx then \bbi does not have a +graphical interface but a simple prompt). + +\begin{figure}[!ht] +\caption{\label{bbi-fig-bbi-gui}The black box interpreter interface} +\begin{center} +\includegraphics[width=0.7\textwidth]{bbi-gui.png} +\end{center} +\end{figure} + +The 'Command' tab is subdivided into two parts : +one single line zone at the bottom in which you can enter your commands and +one multiple line zone in which \bbi prints out the result of your commands. -If you type: + +Try typing in the input zone (in this manual, +the commands entered by the user will be preceded by a prompt '>') : \begin{verbatim} > help \end{verbatim} @@ -224,21 +245,25 @@ you get the list of the commands of the interpreter: \begin{verbatim} Available commands: author + category config connect define delete description endefine + endpackage exec graph help include + index input load message new output + package print quit reset @@ -313,6 +338,7 @@ If you type \texttt{'help workspace'}, you get: Complex Black Box User's workspace By: bbi (internal) + Category(s) : complex box; * No inputs * No outputs * No boxes @@ -333,7 +359,7 @@ which contains basic useful black boxes. To load it, type: \begin{verbatim} -> load std +> include std \end{verbatim} Then if you type: @@ -364,13 +390,16 @@ You get: \begin{verbatim} Black Box Adds its inputs - By: laurent.guigues@creatis.insa-lyon.fr + By: laurent.guigues at creatis.insa-lyon.fr + Categories : atomic box;math; * Inputs: - 'In1' : First number to add - 'In2' : Second number to add - 'ProcessMode' : Set the process mode of the box (0=Pipeline | 1=Always | 2=Reactive) - * Outputs: - 'Out' : Result + 'BoxExecute' : Any signal received by this input executes the box + 'BoxProcessMode' : Sets the processing mode of the box (Pipeline | Always | Reactive) + 'In1' : First number to add + 'In2' : Second number to add + * Outputs : + 'BoxChange' : Signal modifications of the box + 'Out' : Result'In1' : First number to add \end{verbatim} Like previously, @@ -379,11 +408,12 @@ means that the box \texttt{Add} belongs to the \texttt{std} package. Then comes a description (the one which was provided by the author of the box), -the author(s) of the box (usually e-mail adress(es)). +the author(s) of the box (usually e-mail adress(es)) and +the categories to which the box belong. Finally comes the lists of inputs and outputs of the box. For each input or output, \bbi provides its \emph{name} (between quotes, e.g. \texttt{'ProcessMode'}), -its \emph{type} (between \texttt{<>}, e.g. \texttt{}) +its \emph{type} (between \texttt{<>}, e.g. \texttt{}) and a description. Remark that the box \texttt{Add} is not a 'complex' black box but an 'atomic' box, hence its help does not @@ -418,6 +448,7 @@ you get: Complex Black Box User's workspace By: bbi (internal) + Category(s) : complex box; * No inputs * No outputs * Boxes: @@ -465,11 +496,11 @@ To process this special substrings, \bbi does: Box processing is needed if: \begin{itemize} \item at least input has changed since last processing or -\item the input \texttt{'ProcessMode'} of the box is set to -\texttt{1}, which forces box reprocessing. +\item the input \texttt{'BoxProcessMode'} of the box is set to +\texttt{'Always'}, which forces box reprocessing. \end{itemize} -Note that all boxes have the input \texttt{'ProcessMode'}. +Note that all boxes have the input \texttt{'BoxProcessMode'}. Another way to process the box \texttt{a} is to issue the command: \begin{verbatim} @@ -494,7 +525,7 @@ Good bye ! \paragraph{Summary} %\hrule \begin{itemize} -\item The \texttt{load} command allows to load a package. +\item The \texttt{include} command allows to load a package. \item \texttt{help} gives help on: \begin{itemize} \item Available commands if you just type \texttt{help}. @@ -521,6 +552,8 @@ The same syntax holds for outputs. \label{bbi-connecting-black-boxes} % ========================================== +LG : THE GUIDE IS UP TO DATE UNTIL HERE + \BBTK allows to create and execute processing chains, also called \emph{pipelines}, @@ -531,9 +564,7 @@ more information on pipeline processing. First start \bbi and load the package \texttt{std}: \begin{verbatim} -$$ bbi -BBI (Black Box Interpreter) - bbtk "1.0.0" - (c) Creatis 2007 -> load std +> include std \end{verbatim} Assume you want to compute $1+2+3$. You can do it by diff --git a/kernel/install/gnome/bbi-icon.png b/kernel/install/gnome/bbi-icon.png new file mode 100644 index 0000000..f83315e Binary files /dev/null and b/kernel/install/gnome/bbi-icon.png differ diff --git a/kernel/install/gnome/bbi.desktop.in b/kernel/install/gnome/bbi.desktop.in new file mode 100644 index 0000000..1817ab4 --- /dev/null +++ b/kernel/install/gnome/bbi.desktop.in @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Encoding=UTF-8 +Name=bbi +MimeType=text/bbs; +Exec=BBI -c %f +Type=Application +Terminal=false +NoDisplay=false +GenericName[en_US]="The Black Box Interpreter (bbi)" +Icon=HOME/.local/share/applications/bbi-icon.png diff --git a/kernel/install/gnome/bbs.xml b/kernel/install/gnome/bbs.xml new file mode 100644 index 0000000..0d3144d --- /dev/null +++ b/kernel/install/gnome/bbs.xml @@ -0,0 +1,12 @@ + + + + + + Black Box Script + Black Box Script + + + + + diff --git a/kernel/install/gnome/install-gnome.sh b/kernel/install/gnome/install-gnome.sh new file mode 100755 index 0000000..c34e564 --- /dev/null +++ b/kernel/install/gnome/install-gnome.sh @@ -0,0 +1,42 @@ +#!/bin/bash +echo "***** Installing bbi on gnome desktop *****" + +BBI=$(which bbi) +echo "* bbi path = ${BBI}" + +# The desktop launcher & its icon +echo "* Creating bbi launcher on desktop (${HOME}/Desktop/bbi.desktop)" +sed s,HOME,${HOME},g bbi.desktop.in > bbi.desktop.tmp +sed s,BBI,${BBI},g bbi.desktop.tmp > bbi.desktop.tmp2 +cp bbi.desktop.tmp2 ${HOME}/Desktop + +echo "* Copying 'bbi-icon.png' in ${HOME}/.local/share/applications/" +cp bbi-icon.png ${HOME}/.local/share/applications/ + +# add the type 'text/bbs' to mime database +echo "* Adding mime-type 'test/bbs' to mime database (${HOME}/.local/share/mime/packages/bbs.xml)" +if [ ! -d ${HOME}/.local/share/mime ] + then + mkdir ${HOME}/.local/share/mime + if [ ! -d ${HOME}/.local/share/mime/packages ] + then + mkdir ${HOME}/.local/share/mime/packages + fi +fi +cp bbs.xml ${HOME}/.local/share/mime/packages/ +update-mime-database ${HOME}/.local/share/mime +nautilus --quit +nautilus & + +# associate 'text/bbs' to the desktop launcher +# add the line 'text/bbs=bbi.desktop' +# in file ${HOME}/.local/share/applications/defaults.list +line="text/bbs=bbi.desktop" +file="${HOME}/.local/share/applications/defaults.list" +if grep -q ${line} ${file} +then + echo "* Mime-type 'text/bbs' already present in '${file}' : nothing to do" +else + echo "* Associating mime-type 'text/bbs' to 'bbi.desktop' (${file})" + echo ${line} | cat >> ${file} +fi diff --git a/kernel/src/bbtkFactory.cxx b/kernel/src/bbtkFactory.cxx index 48963f2..ab82b88 100644 --- a/kernel/src/bbtkFactory.cxx +++ b/kernel/src/bbtkFactory.cxx @@ -4,8 +4,8 @@ Program: bbtk Module: $RCSfile: bbtkFactory.cxx,v $ Language: C++ -Date: $Date: 2008/02/08 07:39:49 $ -Version: $Revision: 1.17 $ +Date: $Date: 2008/02/12 12:55:16 $ +Version: $Revision: 1.18 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de @@ -582,8 +582,11 @@ namespace bbtk //=================================================================== //=================================================================== - /// Prints help on the black box of type - void Factory::HelpBlackBox(const std::string& name, bool full) const + /// Prints help on the black box of type + /// Returns the package to which it belongs + void Factory::HelpBlackBox(const std::string& name, + std::string& package, + bool full) const { bbtkDebugMessageInc("Kernel",9,"Factory::HelpBlackBox(\""<second.mPackage->ContainsBlackBox(name)) { i->second.mPackage->HelpBlackBox(name,full); + package = i->second.mPackage->GetName(); found = true; } } diff --git a/kernel/src/bbtkFactory.h b/kernel/src/bbtkFactory.h index 9b2aab1..0a7f39e 100644 --- a/kernel/src/bbtkFactory.h +++ b/kernel/src/bbtkFactory.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkFactory.h,v $ Language: C++ - Date: $Date: 2008/02/05 11:39:32 $ - Version: $Revision: 1.4 $ + Date: $Date: 2008/02/12 12:55:16 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -49,7 +49,8 @@ namespace bbtk void UnLoadPackage( const std::string& name ); void PrintPackages(bool details = true, bool adaptors = false) const; void HelpPackage(const std::string& name, bool adaptors = false) const; - void HelpBlackBox(const std::string& name, bool full=true) const; + void HelpBlackBox(const std::string& name, std::string& package, + bool full=true ) const; void ShowGraphTypes(const std::string& name) const; void InsertPackage( Package* ); void RemovePackage( Package* ); @@ -163,7 +164,15 @@ namespace bbtk inline void HelpBlackBox(const std::string& name, bool full=true) { - GetGlobalFactory()->HelpBlackBox(name,full); + std::string package; + GetGlobalFactory()->HelpBlackBox(name, package, full); + } + + inline void HelpBlackBox(const std::string& name, std::string& package, + bool full=true + ) + { + GetGlobalFactory()->HelpBlackBox(name, package, full); } diff --git a/kernel/src/bbtkInterpreter.cxx b/kernel/src/bbtkInterpreter.cxx index 5b0c26e..f0617c0 100644 --- a/kernel/src/bbtkInterpreter.cxx +++ b/kernel/src/bbtkInterpreter.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.cxx,v $ $ Language: C++ - Date: $Date: 2008/02/06 10:53:02 $ - Version: $Revision: 1.28 $ + Date: $Date: 2008/02/12 12:55:16 $ + Version: $Revision: 1.29 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -1083,26 +1083,50 @@ void Interpreter::Help(const std::vector& words) try { HelpPackage(words[1]); +#ifdef _USE_WXWIDGETS_ + if ( WxConsole::GetInstance() != 0 ) + { + std::string url = ConfigurationFile::GetInstance().Get_url(); + url += "/bbdoc/" + words[1] + "/index.html"; + if (Utilities::FileExists(url)) + { + WxConsole::GetInstance()->ShowHtmlPage(url); + } + } +#endif } catch (bbtk::Exception f) { try { - HelpBlackBox(words[1]); - } - catch (bbtk::Exception g) - { - try - { - this->mExecuter->ShowRelations(words[1],"0","9999"); - } - catch (bbtk::Exception h){ - bbtkError("\""<ShowHtmlPage(url); + } + } +#endif + } + catch (bbtk::Exception g) + { + try + { + this->mExecuter->ShowRelations(words[1],"0","9999"); + } + catch (bbtk::Exception h){ + bbtkError("\""<
\n"; - s << "Automatically generated by "< from " - < on " + s << "Automatically generated by "< "//from " + // < + <<"on " << ptm->tm_mday << "/" << ptm->tm_mon << "/" << ptm->tm_year+1900 << " - " << ptm->tm_hour << ":" << ptm->tm_min << " GMT\n"; s << "\n"; diff --git a/kernel/src/bbtkWxBrowser.cxx b/kernel/src/bbtkWxBrowser.cxx index 3776e1f..5a24a95 100644 --- a/kernel/src/bbtkWxBrowser.cxx +++ b/kernel/src/bbtkWxBrowser.cxx @@ -4,6 +4,7 @@ #include "bbtkWxBlackBox.h" #include "bbtkConfigurationFile.h" +#include "bbtkUtilities.h" namespace bbtk { @@ -194,7 +195,14 @@ namespace bbtk { std::string url = ConfigurationFile::GetInstance().Get_url(); url += "/bbtkWebSite/menu.html"; - GoTo(url); + if (Utilities::FileExists(url)) + { + GoTo(url); + } + else + { + // what ? + } } //======================================================================== diff --git a/kernel/src/bbtkWxConsole.cxx b/kernel/src/bbtkWxConsole.cxx index a29cfb1..d0e8622 100644 --- a/kernel/src/bbtkWxConsole.cxx +++ b/kernel/src/bbtkWxConsole.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxConsole.cxx,v $ Language: C++ - Date: $Date: 2008/02/08 10:05:38 $ - Version: $Revision: 1.2 $ + Date: $Date: 2008/02/12 12:55:16 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -220,7 +220,9 @@ namespace bbtk // Command page mwxTextHistory = - new wxTextCtrl(mwxPageCommand,0,_T(""),wxDefaultPosition, + new wxTextCtrl(mwxPageCommand, + ID_Text_History, + _T(""),wxDefaultPosition, wxDefaultSize, //HistorySize, wxTE_READONLY | wxTE_MULTILINE ); @@ -234,13 +236,14 @@ namespace bbtk mwxTextHistoryAttr = new wxTextAttr; mwxTextHistoryAttr->SetFont(*FixedFont); mwxTextCommand = - new wxTextCtrl(mwxPageCommand,0,_T(""),wxDefaultPosition, - wxDefaultSize,//CommandSize, - + new wxTextCtrl(mwxPageCommand, + ID_Text_Command, + _T(""),wxDefaultPosition, + wxDefaultSize, wxTE_PROCESS_ENTER - | - wxTE_PROCESS_TAB | wxWANTS_CHARS -// | wxTAB_TRAVERSAL + | wxTE_PROCESS_TAB + | wxWANTS_CHARS + //| wxTAB_TRAVERSAL ); @@ -265,6 +268,7 @@ namespace bbtk // Events connection // COMMAND // ENTER + /* Connect( mwxTextCommand->GetId(), wxEVT_COMMAND_TEXT_ENTER, (wxObjectEventFunction)& WxConsole::OnCommandEnter ); @@ -272,6 +276,7 @@ namespace bbtk wxEVT_CHAR, //wxEVT_COMMAND_TEXT_UPDATED, (wxObjectEventFunction)& WxConsole::OnCommandChar ); + */ // MENU // Connect ( @@ -401,7 +406,11 @@ namespace bbtk void WxConsole::ShowHtmlPage(std::string& page) { // std::cout << "WxConsole::ShowHtmlPage('"<GoTo(page)) + if (mwxHtmlWindow->GoTo(page)) + { + mwxNotebook->ChangeSelection(1); + } + else { // std::cout << "ERROR html"<