Personal tools
You are here: Home Forum Use Can a module be created under Windows?

Can a module be created under Windows?

Up to Use

Can a module be created under Windows?

Posted by Matthias Zenker at September 17. 2014
Hi,

I have posted this question as follow-up of another thread, but maybe I have better chances to get an answer if I open a new one...

The general question is: Is it currently possible to create a Salomé module under Windows, and if so, how?

More specifically:

1. Is there documentation and/or a tutorial on module creation for beginners? Or a sample Windows module that could be taken as starting point?

2. I want to add some dialogs, maybe a menu, and call external programs. Can this be done with a Python module which might be easier to build (no C/C++ compiler needed)?

3. What would it take to create a module from an existing C++ program (with GUI) under Windows?

4. Is there any documentation on the ParaVis module that could teach me how this has been done?

5. Is there a way to use existing qt design files for GUI building in a Salomé module?

I would appreciate answers to any part of the above... :)

Thanks,

Matthias

Re: Can a module be created under Windows?

Posted by Vadim SANDLER at September 17. 2014

Hello Matthias,

In general, there is no difference on what platform the module is implemented - on Linux or on Windows; the workflow is standard. You thus can follow the procedure described in the SALOME Tutorial.

The only difference concerns the build procedure. Existing SALOME Tutorial is based on Linux platform, so the build procedure is described mainly for Linux (cmake, make, make install). On Windows, to build a module, you can use the same approach (from command line), or use the script which comes with SALOME SDK archives (compile.bat, compile.py) - just customize it for your module.

1. Is there documentation and/or a tutorial on module creation for beginners? Or a sample Windows module that could be taken as starting point?

Refer to SALOME Tutorial.

2. I want to add some dialogs, maybe a menu, and call external programs. Can this be done with a Python module which might be easier to build (no C/C++ compiler needed)?

You can use PyQt for this purpose.

3. What would it take to create a module from an existing C++ program (with GUI) under Windows?

You need to implement a "wrapper" around C++ program, following architecture of SALOME platform.

4. Is there any documentation on the ParaVis module that could teach me how this has been done?

ParaVis module is just a wrapping around the ParaView application (more precisely, its libraries). Unfortunately, there is no good documentation on this module, I can only suggest to learn the source code.

5. Is there a way to use existing qt design files for GUI building in a Salomé module?

Sure, why no? As SALOME is based on Qt, this can be done easily. Indeed, there is no strict rules about how the GUI should be implemented for a module: you can code dialogs manually from scratch, or create forms in the designer (such approach is, in particular, used in SALOME Geometry module). In Python module, the same can be done with PyQt.

 

I would appreciate answers to any part of the above... :)

Regards,
Vadim.

Re: Can a module be created under Windows?

Posted by Matthias Zenker at September 17. 2014
Thank you! I will study the Salomé tutorial...

Matthias

Re: Can a module be created under Windows?

Posted by Matthias Zenker at September 17. 2014
Hi Vadim,

I have found an old post here where it is said that one can make a module just consisting of some python code, without the whole directory structure and build process outlined in the tutorial. I tried to get the minimal Python module posted there to work, but didn't succeed - Salomé doesn't give an error message, but just does not seem to load the module. Either I am doing something wrong, or it just doesn't work that way (ít is said to be tested under Salomé 5).

Can such a minimal module still be built that way? If so, how do I activate it?

And - is there a Python programmer's tutorial/manual/reference where all available Salomé-specific functions are listed?

Thanks,

Matthias

Re: Can a module be created under Windows?

Posted by Matthias Zenker at September 17. 2014
Wrong syntax for the url of the old post - here it is: http://www.salome-platform.org/forum/forum_11/335660793

Re: Can a module be created under Windows?

Posted by Vadim SANDLER at September 17. 2014

Hello Matthias,

SALOME has been obviously significantly changed since series 5x, but what is demonstrated in the mentioned thread still works. You only need to perform an additional small step: add a directory with this mininal module to the PYTHONPATTH variable, for example:

export PYTHONPATH=/tmp/aaa_dir:${PYTHONPATH}

and then run SALOME as described in that post.

For good example of implementing modules with Python, you can refer to the PYHELLO (http://docs.salome-platform.org/latest/gui/PYHELLO/index.html) and PYLIGHT sample modules.

Regards,
Vadim.

Re: Can a module be created under Windows?

Posted by Matthias Zenker at September 17. 2014
Hi Vadim,

it doesn't seem to work.

BTW I am under Windows 7 64bit, Salomé 7.4.0.

What I have done:

Copy the files AAAGUI.py and SalomeApp.xml to a directory AAA under %SALOME_HOME%\Modules

Edit the env_launch.bat script which is called by run_salome.bat: add AAA to the list of modules, so that it now reads

SET m_list=(LIBBATCH KERNEL GUI GEOM MED SMESH YACS JOBMANAGER PARAVIS HEXABLOCK HEXABLOCKPLUGIN NETGENPLUGIN GHS3DPLUGIN HEXOTICPLUGIN GHS3DPRLPLUGIN BLSURFPLUGIN ATOMGEN ATOMIC ATOMSOLV PYCALCULATOR CALCULATOR COMPONENT LIGHT PYLIGHT RANDOMIZER SIERPINSKY PYHELLO HELLO AAA)

Add the following two lines:

SET PYTHONPATH=%AAA_ROOT_DIR%;%PYTHONPATH%

SET SalomeAppConfig=%AAA_ROOT_DIR%

launch the command

unr_salome --modules=GEOM,AAA

in a DOS box from the %SALOME_HOME% directory.

Result: Salome starts without error message, but loads only the GEOM module.

So I am still doing something wrong...

Matthias

P.S.: Is there a Python programming manual for Salomé...? :)

Re: Can a module be created under Windows?

Posted by Matthias Zenker at September 17. 2014
Sorry, the command is of course run_salome --modules=GEOM,AAA

Sometimes an edit function for own posts would be practical...

Re: Can a module be created under Windows?

Posted by Vadim SANDLER at September 17. 2014

Hello Matthias,

Actually, on Windows this works too. You just don't need to set AAA_ROOT_DIR variable to make this working :)

Edit your env_launch.bat again, to remove "SET AAA_ROOT_DIR=..." and correct other staff to point to the correct dir path...

SET PYTHONPATH=%SALOME_ROOT_DIR%MODULES\AAA;%PYTHONPATH%
SET SalomeAppConfig=%SALOME_ROOT_DIR%MODULES\AAA

...and... Bingo!

I did not check what's the reason of this trick. Most likely there's a check somewhere in the launch procedure if MODULE>_ROOT_DIR variable is properly set (to the directory that follows "standard" SALOME module layout) that prevents module button appearing in the desktop. And when <MODULE>_ROOT_DIR variable is not set at all, this check is NOT performed. This seems to be a bug, I think I need to fix it to disallow the module button appear in this case too :)

Regards,
Vadim.

Re: Can a module be created under Windows?

Posted by Vadim SANDLER at September 17. 2014

Previously Matthias Zenker wrote:

Sometimes an edit function for own posts would be practical...

Yes, it would be good, but unfortunately, I don't know how to do this easily with Ploneboard used as a Forum engine here :(

 

Re: Can a module be created under Windows?

Posted by Matthias Zenker at September 17. 2014
Hi Vadim,

thank you for your help - it works now!

I also had to close the current DOS box and open a new one since the set command apparently does not use a subshell (AFAIR this is different in Linux), so the old setting persists...

It is a bit strange to me that even though I have copied the AAA module to the standard Salomé module directory (i.e. %SALOME_HOME%\Modules\AAA) and all the other modules get their XXX_ROOT_DIR set exactly the same way, the AAA module only loads if the AAA_ROOT_DIR is not set.

Anyway, now I can explore the possibilities of module creation under Python.

I dare to ask again if there is a Python manual or programming reference for Salomé... :)

Thank you!

Matthias

Re: Can a module be created under Windows?

Posted by Erwan ADAM at October 11. 2014

Hi Matthias and Vadim,

Previously Vadim SANDLER wrote:

Hello Matthias,

...
...and... Bingo!
...Regards,

Vadim.

Please to see that this old piece of code is still useful to someone :) !

E.A.

 

 

Powered by Ploneboard
Document Actions