MeVisLab Scripting Reference
MLABModule Class Reference
Inheritance diagram for MLABModule:
MLABFieldOwner MLABMLModule MLABMacroModule MLABInventorModule MLABRemoteModule

Public Slots

void copyInstanceName ()
 
void editInstanceNameWithRequester ()
 
void editModuleHelp ()
 
QString exampleNetworkFile ()
 
QStringList exampleNetworkFiles ()
 
virtual void forceReload ()
 
QString getMLABFile ()
 
QString getModuleDefinitionFolder ()
 
QString getModuleHelpFile ()
 
QString getModuleSourcesFolder ()
 
QStringList getScriptSourceFiles ()
 
bool hasModuleHelp ()
 
bool isDefinedInsideProject () const
 
bool isLazyLoading () const
 
MLABTreemdlTree ()
 
void openMLABFile ()
 
void openModuleDefinition ()
 
void openScriptSourceFiles ()
 
virtual void reload ()
 
void restoreDefaultValues ()
 
virtual bool shouldReload ()
 
void showContextMenu ()
 
void showDLLDependency ()
 
void showExampleNetwork ()
 
void showHtmlHelp ()
 
void showModuleInNetwork (bool openNetworkTabAfterCurrentNetworkTab=false)
 
void showScriptConsole ()
 
void updateModuleHelp ()
 
Access to owning and internal network/macros.
MLABMacroModuleparentMacro () const
 
MLABMacroModuleparent ()
 
MLABMacroModuleapplicationMacro (bool shouldWarnIfNotMacro=true)
 
bool isDescendentOf (MLABModule *module)
 
bool isDescendentOfNetwork (MLABNetwork *network)
 
MLABNetworkparentNetwork () const override
 
MLABNetworkowner ()
 
virtual MLABNetworknetwork ()
 
virtual bool isMacroModule ()
 
Scripting access to fields, modules, and controls.


void createScriptingContext (const QString &language)
 
bool hasFunction (const QString &functionName)
 
QVariant scriptVariable (const QString &name)
 
void setScriptVariable (const QString &name, const QVariant &value)
 
void deleteScriptVariable (const QString &name)
 
QVariant call (const QString &function, const QVariantList &args)
 
QVariant call (const QString &function)
 
QVariant call (const QString &function, QObject *obj)
 
QObject * callWithObjectReturn (const QString &function, const QVariantList &args)
 
QObject * callWithObjectReturn (const QString &function)
 
QObject * callWithObjectReturn (const QString &function, QObject *obj)
 
int callLater (double seconds, const QVariant &function, const QVariantList &args=QVariantList())
 
int callWithInterval (double seconds, const QVariant &function, const QVariantList &args=QVariantList())
 
void callOnGUIThread (const QVariant &function, const QVariantList &args=QVariantList())
 
QStringList callableFunctions ()
 
QStringList deprecatedFieldNames (const QString &fieldName)
 
QStringList deprecatedFieldNames (MLABField *field)
 
QVariantMap deprecatedFieldNames ()
 
void removeTimer (int id)
 
void removeTimers ()
 
QObject * commandHandler (const QString &name)
 
bool connectField (const QString &dst, const QString &src)
 
bool disconnectField (const QString &input)
 
virtual void clearCache ()
 
virtual MLABFieldfield (const QString &name)
 
bool hasField (const QString &name)
 
virtual MLABModulemodule (const QString &name)
 
bool hasModule (const QString &name)
 
QStringList modules ()
 
QList< MLABModule * > modulesAsObjects ()
 
virtual MLABModuleaddModule (const QString &name)
 
virtual MLABModuleaddLocalModule (const QString &name)
 
virtual MLABModuleaddMacroModuleFromString (const QString &string)
 
virtual MLABModuleaddMacroModuleFromFile (const QString &file)
 
virtual MLABModuleaddRemoteModule (const QString &name)
 
virtual MLABWidgetControlcontrol (const QString &name)
 
bool hasControl (const QString &name)
 
MLABWidgetControlcontrolDebug (const QString &name)
 
virtual void closeWindow ()
 
MLABWindowControlwindow ()
 
QString unexpandFilename (const QString &file)
 
QString expandFilename (const QString &file, bool doCleanPath=true)
 
QString localPath ()
 
QString networkPath ()
 
void log (const QString &msg)
 
void logFixed (const QString &text)
 
void logHTML (const QString &msg)
 
void logWarning (const QString &msg)
 
void logError (const QString &msg)
 
int currentWindowID ()
 
int setCurrentWindowID (int windowID)
 
void remove ()
 
void py_delete ()
 
void removeUndoable ()
 
QMap< QString, QVariant > getDependency ()
 
bool exportWindows (const QStringList &windowNames=QStringList()<< "_default")
 
bool callRemoteFunction (const QString &functionName, const QVariantList &arguments=QVariantList(), const QVariant &replyHandler=QVariant())
 
QString translate (const QString &text, const QString &disambiguation=QString())
 
Information about the module.
QStringList inputs ()
 
QStringList outputs ()
 
QStringList parameters ()
 
QList< MLABField * > inputFields ()
 
QList< MLABField * > outputFields ()
 
QList< MLABField * > parameterFields ()
 
bool isValid ()
 
void setNonPersistent ()
 
bool isPersistent () override
 
QString type () const
 
virtual bool isRemote ()
 
virtual bool isLocalMacro ()
 
bool shouldAvoidSideEffects () const
 
QString fullName () override
 
QRect frame () const
 
void setFrame (const QRect &frame)
 
void setFrameTopLeft (int x, int y)
 
void setFrameCenter (int x, int y)
 
bool isSelected () const override
 
void setSelected (bool flag, bool notifyModuleListener=true)
 
void setSingleSelected ()
 
MLABPackagepackage ()
 
MLABPackagegetPackage ()
 
Showing windows of the module
MLABWindowControlshowWindow (MLABWindowControl *parent=nullptr)
 
MLABWindowControlshowWindow (const QString &name, MLABWindowControl *parent=nullptr)
 
MLABWindowControlshowWindowFromString (const QString &string, MLABWindowControl *parent=nullptr)
 
MLABWindowControlshowWindowFromFile (const QString &file, MLABWindowControl *parent=nullptr)
 
MLABWindowControlshowAutomaticWindow ()
 
int showModalDialog (const QString &name, const QString &title)
 
int showModalDialog (const QString &name)
 
int showModalDialog ()
 
int showModalDialog (const QString &name, MLABWindowControl *parent)
 
int showModalDialogFromString (const QString &mdlString, const QString &title)
 
int showModalDialogFromString (const QString &mdlString)
 
int showModalDialogFromString (const QString &mdlString, MLABWindowControl *parent)
 
int showModalDialogFromFile (const QString &file, const QString &title)
 
int showModalDialogFromFile (const QString &file)
 
int showModalDialogFromFile (const QString &file, MLABWindowControl *parent)
 
MLABWindowControlcreateWindow ()
 
MLABWindowControlcreateWindow (MLABWindowControl *parent)
 
MLABWindowControlcreateWindow (const QString &name)
 
MLABWindowControlcreateWindow (const QString &name, MLABWindowControl *parent)
 
MLABWindowControlcreateWindowFromFile (const QString &file)
 
MLABWindowControlcreateWindowFromFile (const QString &file, MLABWindowControl *parent)
 
MLABWindowControlcreateWindowFromString (const QString &string)
 
MLABWindowControlcreateWindowFromString (const QString &string, MLABWindowControl *parent)
 
MLABWindowControlcreateBorderlessWindow (const QString &name, MLABWindowControl *parent)
 
MLABWindowControlcreatePopupWindow (const QString &name, MLABWindowControl *parent)
 
MLABWindowControlcreateModalDialog (const QString &name, MLABWindowControl *parent)
 
bool hasWindow (const QString &name)
 
void closeAllWindows (bool emitDestroyedCommandImmediately=false)
 
void reshowClosedWindows ()
 
virtual MLABWindowControlshowParameterWindow ()
 
void updateLayout ()
 
void createConnectors ()
 
MLABFieldListeneraddFieldListener (MLABField *field, const QVariant &script, bool init)
 
void removeFieldListener (MLABFieldListener *listener)
 
QString groupName () const
 
void addToGroup (const QString &name)
 
- Public Slots inherited from MLABFieldOwner
virtual bool isSelected () const =0
 
virtual bool isPersistent ()=0
 
virtual MLABNetworkparentNetwork () const =0
 
virtual QString fullName ()=0
 

Friends

class MLABNetwork
 

Detailed Description

Baseclass for modules in an MLABNetwork.

All scripts contexts in MLAB have a global "context" variable (alias: "ctx") which can be accessed from the script. This context variable always points to an MLABModule, either an MLABMacroModule, MLABMLModule, or MLABInventorModule. All methods given in this documentation can be called by:

ctx.methodName(arg1,arg2,...);

Typical used methods in a module are:

Utility functions:

Methods concerning windows (panels):

Less typical methods in a module are:

MDL reference: Module

Member Function Documentation

◆ addFieldListener

MLABFieldListener* MLABModule::addFieldListener ( MLABField field,
const QVariant &  script,
bool  init 
)
slot

Adds a field listener to the module at runtime.

The passed in script can be a string or a callable Python object (e.g., a function or instance method). For example, if you have a scripting function called myFieldChanged(), then you can register it like this:

ctx.addFieldListener(anyModule.field("anyField"), "myFieldChanged", False)
Parameters
fieldThe field to attach to.
scriptThe script is executed in the context the module you call this method on.
initIf this flag is true, the myFieldChanged function is called and the current field value is propagated.

◆ addLocalModule

virtual MLABModule* MLABModule::addLocalModule ( const QString &  name)
virtualslot

Same as above, but local macro modules take precedence over modules from the MLAB database.

◆ addMacroModuleFromFile

virtual MLABModule* MLABModule::addMacroModuleFromFile ( const QString &  file)
virtualslot

Adds a new module from a string to the internal network temporarily.

The module type will be MacroFromFile.

(This should only be used for application specific macros that should not be visible in the global MLAB database and that are generated on the fly in Scripting, the module is not persistent when you save the network.)

◆ addMacroModuleFromString

virtual MLABModule* MLABModule::addMacroModuleFromString ( const QString &  string)
virtualslot

Adds a new module from a string to the internal network temporarily.

The module type will be MacroFromString.

(This should only be used for very small macros that are generated on the fly in Scripting, the module is not persistent when you save the network.)

◆ addModule

virtual MLABModule* MLABModule::addModule ( const QString &  name)
virtualslot

Adds a new module to the internal network (return null or new module).

The module can be a name from the MLAB database or a local macro (if the module is a local macro module, looks for networkPath() + "name.script").

◆ addRemoteModule

virtual MLABModule* MLABModule::addRemoteModule ( const QString &  name)
inlinevirtualslot

Adds a new module executed by a worker instance of MeVisLab in another process.

Some restrictions on GUI scripting and allowed input and output field types apply.

This does not work for local modules or OpenInventor modules.

References addRemoteModule().

Referenced by addRemoteModule().

◆ addToGroup

void MLABModule::addToGroup ( const QString &  name)
slot

Adds the module to the given group (if the name does not exist, a new group with that name is created).

If the name is empty, the module is moved to the top network level.

◆ applicationMacro

MLABMacroModule* MLABModule::applicationMacro ( bool  shouldWarnIfNotMacro = true)
slot

Returns the MacroModule which is the top most in the parent chain, being the started application.

◆ call [1/3]

QVariant MLABModule::call ( const QString &  function)
slot

Like call() method, but without arguments.

◆ call [2/3]

QVariant MLABModule::call ( const QString &  function,
const QVariantList &  args 
)
slot

Calls the given function inside of the module, the method can be global or fully qualified (e.g. someobject.somefunction), arguments are a Python list of values (these args can not be objects or classes)

◆ call [3/3]

QVariant MLABModule::call ( const QString &  function,
QObject *  obj 
)
slot

Like call() method, but with object as argument.

◆ callableFunctions

QStringList MLABModule::callableFunctions ( )
slot

Returns a list of callable scripting functions (callable with call()).

◆ callLater

int MLABModule::callLater ( double  seconds,
const QVariant &  function,
const QVariantList &  args = QVariantList() 
)
slot

Like call() method but calls after the given number of seconds.

If seconds is 0, it is guaranteed that the call is done AFTER the current event loop. The passed in function can be a string or a callable Python object (e.g. a function or instance method).

Returns
Returns a unique timer id that can be used with removeTimer() to stop the timer.

◆ callOnGUIThread

void MLABModule::callOnGUIThread ( const QVariant &  function,
const QVariantList &  args = QVariantList() 
)
slot

Calls the given function (a Python function object or the name of a function) asynchronously on the GUI / main thread.

This method needs to be used when you want to talk to the GUI thread from another Python thread.

◆ callRemoteFunction

bool MLABModule::callRemoteFunction ( const QString &  functionName,
const QVariantList &  arguments = QVariantList(),
const QVariant &  replyHandler = QVariant() 
)
slot

Calls a function on a remote client.

If this module is not running in a worker process, then an error is printed.

Parameters
functionNameThe name of the function.
argumentsThe argument list. This is optional.
replyHandlerA callable that is called with the reply argument list as parameters. This is optional.
Returns
Returns true if the module is managed by a remote connection and the sendGenericRequest() signal was emitted, false otherwise.

◆ callWithInterval

int MLABModule::callWithInterval ( double  seconds,
const QVariant &  function,
const QVariantList &  args = QVariantList() 
)
slot

Like call() method but calls repeatedly in the given interval.

To stop the timer, use the kill() method on the returned timer object. The passed in function can be a string or a callable Python object (e.g. a function or instance method).

Returns
Returns a unique timer id that can be used with removeTimer() to stop the timer.

◆ callWithObjectReturn [1/3]

QObject* MLABModule::callWithObjectReturn ( const QString &  function)
slot

Like call() method, but with object as return value.

◆ callWithObjectReturn [2/3]

QObject* MLABModule::callWithObjectReturn ( const QString &  function,
const QVariantList &  args 
)
slot

Like call() method, but with object as return value.

◆ callWithObjectReturn [3/3]

QObject* MLABModule::callWithObjectReturn ( const QString &  function,
QObject *  obj 
)
slot

Like call() method, but with object as return value.

◆ clearCache

virtual void MLABModule::clearCache ( )
virtualslot

Clears the ML cache of all output fields of this module and also of all modules inside of the internal network if it is a macro network.

◆ closeAllWindows

void MLABModule::closeAllWindows ( bool  emitDestroyedCommandImmediately = false)
slot

Closes all windows (you can reshow the windows at the same screen positions by calling reshowClosedWindows).

◆ closeWindow

virtual void MLABModule::closeWindow ( )
virtualslot

Closes current window (depending on current window).

◆ commandHandler

QObject* MLABModule::commandHandler ( const QString &  name)
slot

Returns the command handler named name, if name is empty returns the first unnamed commandHandler.

◆ connectField

bool MLABModule::connectField ( const QString &  dst,
const QString &  src 
)
slot

Connects input field dst to output field src, fields are given by their string name.

(Note: this is a shortcut to MLABField connectFrom().)

◆ control

virtual MLABWidgetControl* MLABModule::control ( const QString &  name)
virtualslot

Searches for control with given name (in current active window, see currentWindowID()).

Searches for a control which must be declared in the current active window by the MDL tag "instanceName" (alias: "name"). Note that control() will only return the correct control if the script code is called from somewhere in the MDL GUI, NOT when you try to call it from commands of the MDL Commands section or from the scripting console.

Example:

Button {
title = "Button1"
name = button1
command = "*py: ctx.control("button1").setTitle("SomeText") *"
}

When called from a scripting console, the method will automatically use controlDebug() and return the first control it finds with that name in any of the opened windows.

◆ controlDebug

MLABWidgetControl* MLABModule::controlDebug ( const QString &  name)
slot

Like hasControl(), but ignores the current window context and searches through all open window.

This method is for debugging in the Scripting console, because control() will not return a control that is not in the correct window context.

◆ copyInstanceName

void MLABModule::copyInstanceName ( )
slot

Copy the instance name to the clipboard.

◆ createBorderlessWindow

MLABWindowControl* MLABModule::createBorderlessWindow ( const QString &  name,
MLABWindowControl parent 
)
slot

Creates a borderless window that is a child of the given window (if window is omitted, it will have no parent).

This function can be used to create information windows that are shown/hidden by the application and can not be moved/closed by the user. Note that the window is not shown after creation, you have to call show() to make it visible and you can use one of the methods of MLABWindowControl to place it at the correct position e.g. move() or moveTo().

◆ createConnectors

void MLABModule::createConnectors ( )
slot

Creates the field connectors of the visual by communicating with the module listener.

If the module listener is NULL, nothing is done.

◆ createModalDialog

MLABWindowControl* MLABModule::createModalDialog ( const QString &  name,
MLABWindowControl parent 
)
slot

Creates a modal dialog that is a child of the given window (if window is omitted, it will have no parent).

Note that the window is not shown after creation, you have to call MLABWindowControl::exec() on the window to show it (exec() then returns the accept/reject code).

◆ createPopupWindow

MLABWindowControl* MLABModule::createPopupWindow ( const QString &  name,
MLABWindowControl parent 
)
slot

Creates a popup window that is a child of the given (if window is omitted, it will have no parent).

Note that the window is not shown after creation, you have to call show() to make it visible and you can use one of the methods of MLABWindowControl to place it at the correct position e.g. move() or moveTo().

◆ createScriptingContext

void MLABModule::createScriptingContext ( const QString &  language)
slot

Creates scripting context for given language if not already done.

◆ createWindow [1/4]

MLABWindowControl* MLABModule::createWindow ( )
slot

Creates the module's default window (the first window found in the tree, or with the name _default).

Creating does not show the window, use methods from MLABWindowControl to show the window after creation. If window was already created, this method returns the pointer to the old instantiated window.

◆ createWindow [2/4]

MLABWindowControl* MLABModule::createWindow ( const QString &  name)
slot

Creates window with name (_default, _automatic and _viewer are special names that can be used).

Creating does not show the window, use methods from MLABWindowControl to show the window after creation. If window was already created, this method returns the pointer to the old instantiated window.

◆ createWindow [3/4]

MLABWindowControl* MLABModule::createWindow ( const QString &  name,
MLABWindowControl parent 
)
slot

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createWindow [4/4]

MLABWindowControl* MLABModule::createWindow ( MLABWindowControl parent)
slot

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createWindowFromFile [1/2]

MLABWindowControl* MLABModule::createWindowFromFile ( const QString &  file)
slot

Creates window which is read from file.

◆ createWindowFromFile [2/2]

MLABWindowControl* MLABModule::createWindowFromFile ( const QString &  file,
MLABWindowControl parent 
)
slot

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createWindowFromString [1/2]

MLABWindowControl* MLABModule::createWindowFromString ( const QString &  string)
slot

Creates window which is parsed from the given string.

◆ createWindowFromString [2/2]

MLABWindowControl* MLABModule::createWindowFromString ( const QString &  string,
MLABWindowControl parent 
)
slot

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ currentWindowID

int MLABModule::currentWindowID ( )
slot

Returns the currently active window id.

◆ deleteScriptVariable

void MLABModule::deleteScriptVariable ( const QString &  name)
slot

Deletes the script variable from the script context.

◆ deprecatedFieldNames [1/3]

QVariantMap MLABModule::deprecatedFieldNames ( )
slot

Returns a dictionary of deprecated names for all fields.

◆ deprecatedFieldNames [2/3]

QStringList MLABModule::deprecatedFieldNames ( const QString &  fieldName)
slot

Returns a list of deprecated names for the given field name.

◆ deprecatedFieldNames [3/3]

QStringList MLABModule::deprecatedFieldNames ( MLABField field)
slot

Returns a list of deprecated names for the given field.

◆ disconnectField

bool MLABModule::disconnectField ( const QString &  input)
slot

Disconnects input field from output field (input field is given as string name).

(Note: this is a shortcut to MLABField disconnect().)

◆ editInstanceNameWithRequester

void MLABModule::editInstanceNameWithRequester ( )
slot

Edits the instance name with a requester.

◆ editModuleHelp

void MLABModule::editModuleHelp ( )
slot

Opens an existing .mhelp module help file with information of the current module.

If it does not exist, it will be created.

◆ exampleNetworkFile

QString MLABModule::exampleNetworkFile ( )
slot

Returns the path to first example network (may be empty).

◆ exampleNetworkFiles

QStringList MLABModule::exampleNetworkFiles ( )
slot

Returns the paths to all example networks (may be empty).

◆ expandFilename

QString MLABModule::expandFilename ( const QString &  file,
bool  doCleanPath = true 
)
slot

Expands variable strings starting with $(...) in given filename.

Trailing (back-)slashes are removed if the result is a directory.

This function supports:

  • LOCAL - local path of def/script file this module is defined in
  • NETWORK - local path of network file this module instance is in
  • MLAB_xxx_yyy - where xxx is an existing package group and yyy an existing package name
  • DemoDataPath - path to MeVisLab DemoData

and all variables that are given in mevislab.prefs file. If doCleanPath is set multiple directory separators are removed and any '.' and '..' is resolved.

◆ exportWindows

bool MLABModule::exportWindows ( const QStringList &  windowNames = QStringList()<< "_default")
slot

Makes the given window and relevant fields available to remote clients by exporting the fields and MDL window definitions.

This function will do nothing if this module is not running in a worker process. It must be called on the application module, otherwise it has no effect.

Parameters
windowNamesAn optional list of windows to export. If it is omitted, then the default window of this module will be exported. The names may contain dots to specify windows of sub modules.
Returns
Returns true if the module is managed by a module server connection and the exportWindowDefinitions() signal was emitted, false otherwise.

◆ field

virtual MLABField* MLABModule::field ( const QString &  name)
virtualslot

Searches for field with given name in dotted notation.

Searches the field by its name. The name can be the name of a field in this module, or a field in the internal network of the macro module. If an internal field is accessed, the name is constructed with the module's instanceName, "." and the field name.

Example for a simple module field and an internal field:

field1 = ctx.field("somefield")
field2 = ctx.field("somemodule.somefield")

See MLABField and its derived classes to learn what methods are available on fields.

You can also access field in the parent module of the current module. And you can go up with "parent:" and go done with "." as you wish. This is an advanced feature and should only be used if really needed because it breaks encapsulation!

Example for a parent module's field:

parentField1 = ctx.field("parent:somefield")
parentField2 = ctx.field("parent:somemodule.somefield")

◆ forceReload

virtual void MLABModule::forceReload ( )
virtualslot

Reloads the module, also makes sure that the MDL files are re-read in the global tree.

Reimplemented in MLABMacroModule.

◆ frame

QRect MLABModule::frame ( ) const
slot

Returns the frame of module (world coords) on network sheet.

◆ fullName

QString MLABModule::fullName ( )
overrideslot

Returns the full name (type + instanceName) for debugging only.

◆ getDependency

QMap<QString, QVariant> MLABModule::getDependency ( )
slot

Returns the dependency of the module.

map contains string lists for the keys:

  • "dirs"
  • "dlls"
  • "modules"

◆ getMLABFile

QString MLABModule::getMLABFile ( )
slot

Returns the path to .mlab file (may not be existent).

◆ getModuleDefinitionFolder

QString MLABModule::getModuleDefinitionFolder ( )
slot

Returns the path to module definition folder.

◆ getModuleHelpFile

QString MLABModule::getModuleHelpFile ( )
slot

Returns the module help file (.mhelp) for the module (may not be existent).

◆ getModuleSourcesFolder

QString MLABModule::getModuleSourcesFolder ( )
slot

Returns the path to module sources folder.

◆ getPackage

MLABPackage* MLABModule::getPackage ( )
inlineslot

Returns access to the package of the module (may be NULL if not registered with any package, e.g.

a local macro module) this method is the same as package()

◆ getScriptSourceFiles

QStringList MLABModule::getScriptSourceFiles ( )
slot

Returns the absolute paths to source files of this module.

◆ groupName

QString MLABModule::groupName ( ) const
inlineslot

Returns the group to which the module belongs.

Do not return a reference to the group name, because only None will be returned in Python then.

◆ hasControl

bool MLABModule::hasControl ( const QString &  name)
slot

Returns whether a control with name exists in the current context.

◆ hasField

bool MLABModule::hasField ( const QString &  name)
slot

Returns whether the module has this field and it can be read by field().

◆ hasFunction

bool MLABModule::hasFunction ( const QString &  functionName)
slot

Checks whether the module has the given script function to call with MLABModule::call.

◆ hasModule

bool MLABModule::hasModule ( const QString &  name)
slot

Returns whether the module exists in the network.

◆ hasModuleHelp

bool MLABModule::hasModuleHelp ( )
slot

returns whether the module has a mhelp file

◆ hasWindow

bool MLABModule::hasWindow ( const QString &  name)
slot

Checks whether a window with the given name is defined.

◆ inputFields

QList<MLABField*> MLABModule::inputFields ( )
slot

Returns a list of all input fields as scriptable objects.

◆ inputs

QStringList MLABModule::inputs ( )
slot

Returns the input fields (as list of field names).

◆ isDefinedInsideProject

bool MLABModule::isDefinedInsideProject ( ) const
slot

Returns true if the module is defined in a self-contained project.

◆ isDescendentOf

bool MLABModule::isDescendentOf ( MLABModule module)
slot

Returns whether this module is a descendant of the given module.

That means that this module is inside the given module (macro) in any recursion level.

◆ isDescendentOfNetwork

bool MLABModule::isDescendentOfNetwork ( MLABNetwork network)
slot

Returns whether this module is a descendant of the given network.

That means that this module is inside the given network in any recursion level.

◆ isLazyLoading

bool MLABModule::isLazyLoading ( ) const
inlineslot

Checks whether this module loads lazily (only available for macro modules).

◆ isLocalMacro

virtual bool MLABModule::isLocalMacro ( )
inlinevirtualslot

Returns whether this module is a local macro module.

◆ isMacroModule

virtual bool MLABModule::isMacroModule ( )
inlinevirtualslot

Returns whether this module is a macro module.

Reimplemented in MLABMacroModule.

◆ isPersistent

bool MLABModule::isPersistent ( )
inlineoverrideslot

Returns whether the module is persistent and will be written to a *.mlab file if saved or copied.

◆ isRemote

virtual bool MLABModule::isRemote ( )
inlinevirtualslot

Returns whether the module is remotely executed in a worker instance.

Reimplemented in MLABRemoteModule.

◆ isSelected

◆ isValid

bool MLABModule::isValid ( )
inlineslot

Returns whether this module is valid.

◆ localPath

QString MLABModule::localPath ( )
slot

returns the local path of module's def/script file.

◆ log

void MLABModule::log ( const QString &  msg)
slot

Logs a message for this module.

◆ logError

void MLABModule::logError ( const QString &  msg)
slot

Logs an error message for this module.

◆ logFixed

void MLABModule::logFixed ( const QString &  text)
slot

Logs a message for this module, using a fixed size font and replacing spaces with   .

◆ logHTML

void MLABModule::logHTML ( const QString &  msg)
slot

Logs a message for this module (using HTML).

◆ logWarning

void MLABModule::logWarning ( const QString &  msg)
slot

Logs a warning message for this module.

◆ mdlTree

MLABTree* MLABModule::mdlTree ( )
inlineslot

Returns the current MDL definition tree of this module.

◆ module

virtual MLABModule* MLABModule::module ( const QString &  name)
virtualslot

Searches for module with given name.

Searches for a module with a given instanceName inside the internal network of this module.

Example:

mod = ctx.module("ImageLoad")

Reimplemented in MLABMacroModule.

◆ modules

QStringList MLABModule::modules ( )
slot

Returns the instanceNames of all modules in the network.

◆ modulesAsObjects

QList<MLABModule*> MLABModule::modulesAsObjects ( )
slot

Returns a list of all modules in the network as scriptable objects.

◆ network

virtual MLABNetwork* MLABModule::network ( )
inlinevirtualslot

Returns the internal network (used in MacroModules, do not mix this up with parentNetwork()! ).

Reimplemented in MLABMacroModule.

◆ networkPath

QString MLABModule::networkPath ( )
slot

Returns the local path of network the module instance is in (may be empty if network was not saved).

◆ openMLABFile

void MLABModule::openMLABFile ( )
slot

Opens the associated .mlab file in a new network window (if an .mlab file exists).

◆ openModuleDefinition

void MLABModule::openModuleDefinition ( )
slot

Opens the module definition of the module in a text editor.

◆ openScriptSourceFiles

void MLABModule::openScriptSourceFiles ( )
slot

Opens all script source files in associated editor.

◆ outputFields

QList<MLABField*> MLABModule::outputFields ( )
slot

Returns a list of all output fields as scriptable objects.

◆ outputs

QStringList MLABModule::outputs ( )
slot

Returns the output fields (as list of field names).

◆ owner

MLABNetwork* MLABModule::owner ( )
inlineslot

Deprecated, please use parentNetwork() instead.

References MLABFieldOwner::parentNetwork().

◆ package

MLABPackage* MLABModule::package ( )
slot

Returns access to the package of the module (may be NULL if not registered with any package, e.g. a local macro module).

◆ parameterFields

QList<MLABField*> MLABModule::parameterFields ( )
slot

Returns a list of all parameter fields as scriptable objects.

◆ parameters

QStringList MLABModule::parameters ( )
slot

Returns the parameter fields (as list of field names).

◆ parent

MLABMacroModule* MLABModule::parent ( )
inlineslot

Deprecated, since this is an overload of the QObject::parent() call, please use parentMacro() instead.

◆ parentMacro

MLABMacroModule* MLABModule::parentMacro ( ) const
slot

Returns the parent MacroModule (this can be used to call scripting methods on the owning MacroModule).

◆ parentNetwork

MLABNetwork* MLABModule::parentNetwork ( ) const
overrideslot

Returns the owning parent network.

◆ reload

virtual void MLABModule::reload ( )
virtualslot

Reloads the module.

Reimplemented in MLABRemoteModule, and MLABMacroModule.

◆ remove

void MLABModule::remove ( )
slot

Removes this module from the network, this will cause an immediate deletion of the module.

◆ removeFieldListener

void MLABModule::removeFieldListener ( MLABFieldListener listener)
slot

Removes the given field listener.

◆ removeTimer

void MLABModule::removeTimer ( int  id)
slot

Removes (stops) the given timer (id is from callLater or callWithTimer, the timer must be created in this context).

◆ removeTimers

void MLABModule::removeTimers ( )
slot

Removes (stops) all timers inside of this context (this is automatically called on reload and remove of the module).

◆ removeUndoable

void MLABModule::removeUndoable ( )
slot

Removes this module from the network and put it into the undo history (the module will not be deleted immediately).

◆ reshowClosedWindows

void MLABModule::reshowClosedWindows ( )
slot

Re-shows panels that have been previously closed.

◆ restoreDefaultValues

void MLABModule::restoreDefaultValues ( )
slot

Restore default values of fields (if possible)

◆ scriptVariable

QVariant MLABModule::scriptVariable ( const QString &  name)
slot

Returns the given variable from scripting.

◆ setCurrentWindowID

int MLABModule::setCurrentWindowID ( int  windowID)
slot

Sets the currently active window id (returns old id).

◆ setFrame

void MLABModule::setFrame ( const QRect &  frame)
slot

Sets the frame of module (world coords) on network sheet, typically one should better use setFrameTopLeft() or setFrameCenter(), to update the layout of the module, call updateLayout().

◆ setFrameCenter

void MLABModule::setFrameCenter ( int  x,
int  y 
)
slot

Sets the frame center of the module (in world coords) on network sheet, module is moved to given center, the size is kept.

◆ setFrameTopLeft

void MLABModule::setFrameTopLeft ( int  x,
int  y 
)
slot

Sets the frame topleft of the module (in world coords) on network sheet, module is moved to given topleft position, the size is kept.

◆ setNonPersistent

void MLABModule::setNonPersistent ( )
inlineslot

Sets that the module is not persistent, so it will not be written to *.mlab files (and not be copy/pastable).

◆ setScriptVariable

void MLABModule::setScriptVariable ( const QString &  name,
const QVariant &  value 
)
slot

Sets the given variable in the script context to the given value.

◆ setSelected

void MLABModule::setSelected ( bool  flag,
bool  notifyModuleListener = true 
)
slot

◆ setSingleSelected

void MLABModule::setSingleSelected ( )
slot

Sets only this module selected (deselects all other modules first).

◆ shouldAvoidSideEffects

bool MLABModule::shouldAvoidSideEffects ( ) const
slot

Returns whether this module should not cause any side effects (for example printing into the console, initializing singletons, creating database connections).

Modules created for auto completion in MATE have this flag set to true.

◆ shouldReload

virtual bool MLABModule::shouldReload ( )
virtualslot

Returns whether the module should be reloaded.

Reimplemented in MLABRemoteModule, and MLABMacroModule.

◆ showAutomaticWindow

MLABWindowControl* MLABModule::showAutomaticWindow ( )
slot

Shows the module's automatic window showing all fields of the module.

◆ showContextMenu

void MLABModule::showContextMenu ( )
slot

Shows the context menu for this module.

◆ showDLLDependency

void MLABModule::showDLLDependency ( )
slot

Runs external program to show the dependencies of this module's DLL.

◆ showExampleNetwork

void MLABModule::showExampleNetwork ( )
slot

Shows example network.

◆ showHtmlHelp

void MLABModule::showHtmlHelp ( )
slot

Shows HTML help (and creates the file to avoid old docs).

◆ showModalDialog [1/4]

int MLABModule::showModalDialog ( )
slot

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ showModalDialog [2/4]

int MLABModule::showModalDialog ( const QString &  name)
slot

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ showModalDialog [3/4]

int MLABModule::showModalDialog ( const QString &  name,
const QString &  title 
)
slot

Shows modal dialog (returns 1 on accept and 0 on cancel).

Rhe shown dialog can be closed by calling

ctx.window()->accept()

to close and accept (return value 1)

ctx.window()->reject()

to close and reject (return value 0) or you can call

ctx.window()->done(int result)

where the result gets returned to the caller of showModalDialog().

◆ showModalDialog [4/4]

int MLABModule::showModalDialog ( const QString &  name,
MLABWindowControl parent 
)
slot

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ showModalDialogFromFile [1/3]

int MLABModule::showModalDialogFromFile ( const QString &  file)
slot

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ showModalDialogFromFile [2/3]

int MLABModule::showModalDialogFromFile ( const QString &  file,
const QString &  title 
)
slot

Show a modal dialog which is read from file.

◆ showModalDialogFromFile [3/3]

int MLABModule::showModalDialogFromFile ( const QString &  file,
MLABWindowControl parent 
)
slot

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ showModalDialogFromString [1/3]

int MLABModule::showModalDialogFromString ( const QString &  mdlString)
slot

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ showModalDialogFromString [2/3]

int MLABModule::showModalDialogFromString ( const QString &  mdlString,
const QString &  title 
)
slot

Shows a modal dialog which is parsed from the given string.

◆ showModalDialogFromString [3/3]

int MLABModule::showModalDialogFromString ( const QString &  mdlString,
MLABWindowControl parent 
)
slot

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ showModuleInNetwork

void MLABModule::showModuleInNetwork ( bool  openNetworkTabAfterCurrentNetworkTab = false)
slot

Selects and shows the module in its network, showing the network (or internal network) in MeVisLab IDE.

◆ showParameterWindow

virtual MLABWindowControl* MLABModule::showParameterWindow ( )
virtualslot

Shows the default window as a panel.

◆ showScriptConsole

void MLABModule::showScriptConsole ( )
slot

Shows a scripting console for this context.

◆ showWindow [1/2]

MLABWindowControl* MLABModule::showWindow ( const QString &  name,
MLABWindowControl parent = nullptr 
)
slot

Shows window with name (_default, _automatic and _viewer are special names that can be used).

◆ showWindow [2/2]

MLABWindowControl* MLABModule::showWindow ( MLABWindowControl parent = nullptr)
slot

Shows the module's default window (the first window found in the tree, or with the name _default).

◆ showWindowFromFile

MLABWindowControl* MLABModule::showWindowFromFile ( const QString &  file,
MLABWindowControl parent = nullptr 
)
slot

Shows window created from file.

◆ showWindowFromString

MLABWindowControl* MLABModule::showWindowFromString ( const QString &  string,
MLABWindowControl parent = nullptr 
)
slot

Shows window created from string.

◆ translate

QString MLABModule::translate ( const QString &  text,
const QString &  disambiguation = QString() 
)
slot

Translates the given text (considering the modules type).

See the MDL reference for more information about translations: Translations.

◆ type

QString MLABModule::type ( ) const
slot

Returns the type of contained object (as string).

◆ unexpandFilename

QString MLABModule::unexpandFilename ( const QString &  file)
slot

Unexpands a filename string containing variables starting with $(...) (see expandFilename() for details).

◆ updateLayout

void MLABModule::updateLayout ( )
slot

Updates the layout of module (string position, connectors, etc.).

If the module listener is NULL, nothing is done.

◆ updateModuleHelp

void MLABModule::updateModuleHelp ( )
slot

Updates an existing .mhelp module help file with information of the current module.

If it does not exist, it will be created.

◆ window

MLABWindowControl* MLABModule::window ( )
slot

Returns the current window (depending on current window).