Repository navigation
Using the Python Scripting Interface
MPRUN provides a powerful Python Scripting Interface (PSI) to interact with its internal application functions.
Warning
Having a good understanding of the Python programming language is essential if you want to really take advantage of the PSI. It’s okay if you don’t know Python though, as you can still download other people’s Python scripts.
You can access MPRUN’s types and objects simply by inputting mprun and using the access modifier .
All GUI is written in PyQt, so a knowledge of the Qt framework can really help!
MPRUN has types for accessing GUI widgets and functions, here is a full list:
-
mprun.panel_container: the right QToolBox containing all panels (properties panel, libraries panel, etc.) -
mprun.left_toolbar: the left QToolBar containing all tool button QActions (select tool, pan tool, etc.) -
mprun.top_toolbarthe top QToolBar containing edit button QActions (align tools, layer tools, etc.) -
mprun.menubar: the QMenuBar containing all sub menus (file, tools, etc.) -
mprun.scene: the main QGraphicsScene containing all items -
mprun.view: the main QGraphicsView encapsulatingmprun.scene
After you have seen all types, you can start using them. Let’s create an example script:
# No need to import mprun, as it is executed at run time
my_widget = QPushButton(mprun, ‘This is a test’)
mprun.toolbar.addWidget(my_widget)This will create a button on the left toolbar that says “This is a test”
Since the GUI is written in PyQt, and assuming you have a knowledge in Python and Qt, start developing! You can create your own dialogs using mprun as the parent window, or even make panels and extend the functionality of MPRUN. The cool thing about the PSI is you won’t be able to break the code, or create irreversible changes. If you mess up, just restart it!
This is a place for people to solve issues, learn, or get developer advice related to MPRUN. You can also add more pages and documentation to this wiki by cloning it with https://github.com/ktechhydle/mprun_repo.wiki.git.