Join our discord community

Please or Register to create posts and topics.

Call the "Create project" window in external python file

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

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.

It works perfectly well!! 😀

Many thank's

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 !

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)


merci Léo 🙂

 

De nada 😉