MeVisLab Scripting Reference
MLABMacroModule Class Reference

Inherits MLABModule.

Public Slots

Scripting methods
QVariant object ()
MLABNoteItemaddNote (const QString &title=QString(), const QString &text=QString())
MLABNoteItemaddReSTNote (const QString &title=QString(), const QString &reSTText=QString())
QList< MLABNoteItem * > notes ()
QList< MLABNetworkModelItemGroup * > groups ()
MLABNetworkModelItemGroupgroup (const QString &groupName)
virtual void storeMacroModulePersistentFields (MLABTree *tree)
virtual void restoreMacroModulePersistentFields (MLABTree *tree)
Status methods
virtual bool isLocalMacro ()
virtual bool isNetworkDocumentMacro ()
virtual bool isAdHocMacro ()
- Public Slots inherited from MLABModule
void copyInstanceName ()
void editInstanceNameWithRequester ()
void editModuleHelp ()
QString exampleNetworkFile ()
QStringList exampleNetworkFiles ()
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 ()
void restoreDefaultValues ()
void showContextMenu ()
void showDLLDependency ()
void showExampleNetwork ()
void showHtmlHelp ()
void showModuleInNetwork (bool openNetworkTabAfterCurrentNetworkTab=false)
void showScriptConsole ()
void updateModuleHelp ()
MLABMacroModuleparentMacro () const
MLABMacroModuleparent ()
MLABMacroModuleapplicationMacro (bool shouldWarnIfNotMacro=true)
bool isDescendentOf (MLABModule *module)
bool isDescendentOfNetwork (MLABNetwork *network)
MLABNetworkparentNetwork () const
MLABNetworkowner ()
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)
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())
QStringList inputs ()
QStringList outputs ()
QStringList parameters ()
QList< MLABField * > inputFields ()
QList< MLABField * > outputFields ()
QList< MLABField * > parameterFields ()
bool isValid ()
void setNonPersistent ()
virtual bool isPersistent ()
QString type () const
virtual bool isRemote ()
virtual bool isLocalMacro ()
bool shouldAvoidSideEffects () const
virtual QString fullName ()
QRect frame () const
void setFrame (const QRect &frame)
void setFrameTopLeft (int x, int y)
void setFrameCenter (int x, int y)
virtual bool isSelected () const
void setSelected (bool flag, bool notifyModuleListener=true)
void setSingleSelected ()
MLABPackagepackage ()
MLABPackagegetPackage ()
MLABWindowControlshowWindow (MLABWindowControl *parent=NULL)
MLABWindowControlshowWindow (const QString &name, MLABWindowControl *parent=NULL)
MLABWindowControlshowWindowFromString (const QString &string, MLABWindowControl *parent=NULL)
MLABWindowControlshowWindowFromFile (const QString &file, MLABWindowControl *parent=NULL)
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

Public Member Functions

void emitInternalNetworkOpened ()
virtual void forceReload ()
virtual bool isMacroModule ()
virtual MLABModulemodule (const QString &name)
virtual MLABNetworknetwork ()
virtual void reload ()
virtual bool shouldReload ()

Detailed Description

Defines a MacroModule with own fields and an optional internal network.

Most scripting functionality is available via the base class MLABModule, but MLABMacroModule provides some additional scripting functions.

Member Function Documentation

MLABNoteItem* MLABMacroModule::addNote ( const QString &  title = QString(),
const QString &  text = QString() 

Creates a new note item in the internal network.

MLABNoteItem* MLABMacroModule::addReSTNote ( const QString &  title = QString(),
const QString &  reSTText = QString() 

Creates a new note item in the internal network with ReST text.

void MLABMacroModule::emitInternalNetworkOpened ( )

Emits when the internal network is opened.

virtual void MLABMacroModule::forceReload ( )

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

Reimplemented from MLABModule.

MLABNetworkModelItemGroup* MLABMacroModule::group ( const QString &  groupName)

Returns a group by its name.

QList<MLABNetworkModelItemGroup*> MLABMacroModule::groups ( )

Returns all groups.

virtual bool MLABMacroModule::isAdHocMacro ( )

Returns whether the macro is a network document module.

virtual bool MLABMacroModule::isLocalMacro ( )

Returns whether the macro is a local macro module.

virtual bool MLABMacroModule::isMacroModule ( )

Returns whether this module is a macro module.

Reimplemented from MLABModule.

virtual bool MLABMacroModule::isNetworkDocumentMacro ( )

Returns whether the macro is a network document module.

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

Searches for module with given name.

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


mod = ctx.module("ImageLoad")

Reimplemented from MLABModule.

virtual MLABNetwork* MLABMacroModule::network ( )

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

Reimplemented from MLABModule.

QList<MLABNoteItem*> MLABMacroModule::notes ( )

Returns all notes.

QVariant MLABMacroModule::object ( )

Get access to the underlying Python object associated with this macro module.

The idea of this method is to provide a public Python API to your macro module to facilitate direct calls to the underlying Python code. To associate a Python object with the macro module, assign it to the global object variable in your python code. This is equivalent to calling scriptVariable("__object__"). If the underlying object is not set, an empty QVariant is returned, which results in a Python None object. Note that basic Python types like dict are translated to Qt types, so if you want to make sure that your API object is returned as a Python object, you need to create your own Python class and assign an instance of it to object and not use a basic Python type. Note: If you keep a reference to the returned Python object, it will be reference counted by your code and thus it may live longer than the macro module itself. This can be a problem if you access the object after the macro itself has already been deleted.

virtual void MLABMacroModule::reload ( )

Reloads the module.

Reimplemented from MLABModule.

virtual void MLABMacroModule::restoreMacroModulePersistentFields ( MLABTree tree)

Restores the persistent fields from the tree.

virtual bool MLABMacroModule::shouldReload ( )

Returns whether the module should be reloaded.

Reimplemented from MLABModule.

virtual void MLABMacroModule::storeMacroModulePersistentFields ( MLABTree tree)

Stores the persistent fields to the tree.