1. Controlling MXW through Python: Difference between revisions

From MXWendler Wiki
Jump to navigation Jump to search
Hwendler (talk | contribs)
No edit summary
Hwendler (talk | contribs)
No edit summary
Line 12: Line 12:
* '''mxw_main.py'''
* '''mxw_main.py'''


The file '''mxw_plugin.ini''' defines the registration of the plugin
The file '''mxw_plugin.ini''' defines the registration of the plugin. The following fields are valid:
{| class="wikitable" style="margin:auto"
|+ Caption text
|-
! Header text !! Header text !! Header text
|-
| Example || Example || Example
|-
| Example || Example || Example
|-
| Example || Example || Example
|}
 
[mxw_plugin]                            ; must be here
plugin_version = 1                      ; must be V1 (as of 2023)
plugin_script_language = Python        ; must be Python (as of 2023)
plugin_menu_parent = AI
plugin_menu_name = NeuronalNet(Dlib) Face Detect Plugin
plugin_grid_name = Face Detect Plugin
plugin_grid_bg_color = 0.950000 0.050000 0.450000 1.000000 ; set plugin color.
plugin_tooltip = This plugin triggers the playlist when it finds a Face using a neuronal net (Dlib)
 
<syntaxhighlight lang="python" line>
def quick_sort(arr):
less = []
pivot_list = []
more = []
if len(arr) <= 1:
return arr
else:
pass
‎</syntaxhighlight>

Revision as of 18:05, 3 December 2023

Python is used in MXW trough a plugin interface. Specified program paths are searched for plugins which are registered, and then loaded through the user interface.

As of version 7.2., plugins are available in the playlist. There are two paths searched during program startup, the program folder and the user folder:

  • (Program folder)/plugins/playlist/python/
  • ~.StageDesigner/plugins/playlist/python/ (Unix)
  • ~.StageDesigner/plugins/playlist/python/ (Windows)

Each plugin resides in a folder. Inside this folder, two files have to be present,

  • mxw_plugin.ini
  • mxw_main.py

The file mxw_plugin.ini defines the registration of the plugin. The following fields are valid:

Caption text
Header text Header text Header text
Example Example Example
Example Example Example
Example Example Example

[mxw_plugin]  ; must be here plugin_version = 1  ; must be V1 (as of 2023) plugin_script_language = Python  ; must be Python (as of 2023) plugin_menu_parent = AI plugin_menu_name = NeuronalNet(Dlib) Face Detect Plugin plugin_grid_name = Face Detect Plugin plugin_grid_bg_color = 0.950000 0.050000 0.450000 1.000000 ; set plugin color. plugin_tooltip = This plugin triggers the playlist when it finds a Face using a neuronal net (Dlib)

def quick_sort(arr):
	less = []
	pivot_list = []
	more = []
	if len(arr) <= 1:
		return arr
	else:
		pass