Call the "Create project" window in external python file
Quote from Leo Tsunami Studio on 30. October 2020, 14:02Hi!
I'm trying to create a script to store a new prism project directly in our pipe directory (ex: P:/ __PROD__/"CLIENT"/WORK/"Prism project name/)
Is there any way to call the "create project" window in our external python file?
The point would be to insert the "project path" and "project name" directly from our external python file.I'm a beginner Python user, sorry if this doesn't make any sense.
Thank's,
Léo
Hi!
I'm trying to create a script to store a new prism project directly in our pipe directory (ex: P:/ __PROD__/"CLIENT"/WORK/"Prism project name/)
Is there any way to call the "create project" window in our external python file?
The point would be to insert the "project path" and "project name" directly from our external python file.
I'm a beginner Python user, sorry if this doesn't make any sense.
Thank's,
Léo
Quote from RichardF on 30. October 2020, 15:03Hey Léo,
your question makes totally sense 🙂
Here is an example how you can open the dialog from an external python script and set the path:
import sys sys.path.append("C:/Prism/Scripts") import PrismCore # create dialog pcore = PrismCore.create() window = pcore.projects.createProjectDialog() window.e_name.setText("projectName") window.e_path.setText("P:/ __PROD__/CLIENT/WORK/Prism project name/") # to open GUIs the PySide eventloop has to be started from PySide2.QtWidgets import * QApplication.instance().exec_()Note: I made a small improvement to Prism to make the above example work. You need Prism v1.3.0.45 for it. For previous Prism versions the code would be slightly different.
Hey Léo,
your question makes totally sense 🙂
Here is an example how you can open the dialog from an external python script and set the path:
import sys sys.path.append("C:/Prism/Scripts") import PrismCore # create dialog pcore = PrismCore.create() window = pcore.projects.createProjectDialog() window.e_name.setText("projectName") window.e_path.setText("P:/ __PROD__/CLIENT/WORK/Prism project name/") # to open GUIs the PySide eventloop has to be started from PySide2.QtWidgets import * QApplication.instance().exec_()
Note: I made a small improvement to Prism to make the above example work. You need Prism v1.3.0.45 for it. For previous Prism versions the code would be slightly different.
Quote from Leo Tsunami Studio on 30. October 2020, 16:03It works perfectly well!! 😀
Many thank's
It works perfectly well!! 😀
Many thank's
Quote from maelfr on 18. April 2021, 16:04Hi Richard, is it possible to call createProject with default values without opening the dialog window ? I seem to remember seeing it somewhere in the forum but could not find it again ^^
The goal would be the same as Leo's: integrate prism project creation in our pipeline tools but without opening prism GUI.
thanks !
Hi Richard, is it possible to call createProject with default values without opening the dialog window ? I seem to remember seeing it somewhere in the forum but could not find it again ^^
The goal would be the same as Leo's: integrate prism project creation in our pipeline tools but without opening prism GUI.
thanks !
Quote from Leo Tsunami Studio on 19. April 2021, 10:39Hi mael!
I guess you can call createProject fonction instead of createProjectDialog.
Try something like this:import sys sys.path.append("C:/Prism/Scripts") import PrismCore name = "NameOfYourProject" path = "Path/to/your/project" pcore = PrismCore.create() pcore.projects.createProject(name=name,path=path, settings=None)
Hi mael!
I guess you can call createProject fonction instead of createProjectDialog.
Try something like this:
import sys sys.path.append("C:/Prism/Scripts") import PrismCore name = "NameOfYourProject" path = "Path/to/your/project" pcore = PrismCore.create() pcore.projects.createProject(name=name,path=path, settings=None)