MLAB Class Reference
[Scripting]

List of all members.

Public Types

enum  macAuthorizationError {
  macErrAuthorizationUnknown = -1, macErrAuthorizationSuccess = 0, macErrAuthorizationCanceled = 1, macErrAuthorizationDenied = 2,
  macErrAuthorizationToolExecuteFailure = 3, macErrAuthorizationToolEnvironmentError = 4
}

Public Slots

Dialogs
void about (MLABWidgetControl *parent=NULL)
QString getMultiLineText (const QString &text, const QString &title, bool richtext, MLABWidgetControl *parent=NULL)
QColor showColorDialog (const QString &initialColor, MLABWidgetControl *parent=NULL)
QColor showColorDialog (const QColor &initialColor=Qt::white, MLABWidgetControl *parent=NULL)
int showCritical (const QString &text, const QString &title, const QStringList &buttonTexts, int defaultButtonNumber)
int showCritical (const QString &text, const QString &detail, const QString &title, const QStringList &buttonTexts, int defaultButtonNumber, MLABWidgetControl *parent=NULL)
void showCritical (const QString &text, const QString &title=MEVISLAB_TITLESTRING)
void showCritical (const QString &text, const QString &detail, const QString &title, MLABWidgetControl *parent=NULL)
int showInformation (const QString &text, const QString &title, const QStringList &buttonTexts, int defaultButtonNumber)
int showInformation (const QString &text, const QString &detail, const QString &title, const QStringList &buttonTexts, int defaultButtonNumber, MLABWidgetControl *parent=NULL)
void showInformation (const QString &text, const QString &title=MEVISLAB_TITLESTRING)
void showInformation (const QString &text, const QString &detail, const QString &title, MLABWidgetControl *parent=NULL)
void showMultiLineText (const QString &text, const QString &title, bool richtext, MLABWidgetControl *parent=NULL)
int showQuestion (const QString &text, const QString &title, const QStringList &buttonTexts, int defaultButtonNumber)
int showQuestion (const QString &text, const QString &detail, const QString &title, const QStringList &buttonTexts, int defaultButtonNumber, MLABWidgetControl *parent=NULL)
int showWarning (const QString &text, const QString &title, const QStringList &buttonTexts, int defaultButtonNumber)
int showWarning (const QString &text, const QString &detail, const QString &title, const QStringList &buttonTexts, int defaultButtonNumber, MLABWidgetControl *parent=NULL)
void showWarning (const QString &text, const QString &title=MEVISLAB_TITLESTRING)
void showWarning (const QString &text, const QString &detail, const QString &title, MLABWidgetControl *parent=NULL)
MeVisLab module introspection
QStringList allInventorModules ()
QStringList allMacroModules ()
QStringList allMLModules ()
QStringList allModules ()
QStringList allModulesForPackageIdentifier (const QString &packageIdentifier)
QStringList findModuleGroups ()
QMap< QString, QVariant > getFileFormatLoader (const QString &filename)
QVariantMap getModuleDependencies (const QStringList &moduleNames, bool includeModuleDirectories=true, QStringList ignoredPackages=QStringList()<< "MeVis/ThirdParty")
QStringList inventorModules ()
QStringList macroModules ()
QStringList mlModules ()
QMap< QString, QVariant > moduleInfo (const QString &module)
QStringList modules ()
Global state utility functions
QDateTime buildDate ()
void clearMLCache ()
QString compilerInfo ()
QString computerModelInfo ()
QString detailedSystemId ()
int getCacheAndLockedMemorySizeInKB ()
int getCacheAndLockedMemorySizeLimitInKB ()
QString getenv (const QString &str)
bool hasVariable (const QString &name)
bool isDebug ()
bool isLinux ()
bool isMacOS ()
bool isModuleProfilingEnabled ()
bool isStandaloneApplication ()
bool isUnix ()
bool isWindows ()
QString readKey (const QString &application, const QString &key)
void setModuleProfilingEnabled (bool enabled)
void setVariable (const QString &name, const QString &value)
QString standaloneApplicationName ()
QString systemId ()
QString systemInfo ()
QString variable (const QString &name)
bool variableIsTrue (const QString &name)
void writeKey (const QString &application, const QString &key, const QString &value)
void writeRegistry ()
Misc methods
void copyToPasteboard (const QString &string)
QString cryptString (const QString &data, const QString &password)
QString cryptString (const QString &data)
QString dateToString (QDateTime date, const QString &format)
QString decryptString (const QString &data, const QString &password)
QString decryptString (const QString &data)
QString doubleToString (double value, const QString &format)
QString escapeString (const QString &value)
QStringList getProgramFromWindowsRegistry (const QString &type, const QString &key, const QString &subkey)
bool hasFeature (const QString &feature)
QString hashStringMD5 (const QString &data)
QString hashStringMD5Latin1 (const QString &data)
void help (const QString &name)
void help (QObject *o)
void help ()
QString intToString (int value, const QString &format)
MLABFieldlastClickedOutputField ()
QString licenseFileName ()
bool qobjectInherits (QObject *object, const QString &classname)
QString readWindowsRegistry (const QString &type, const QString &key, const QString &subkey)
QString stringToEncodedUrlString (const QString &string)
bool valueIsTrue (const QString &val)
Event processing
QPoint cursorPos ()
MLABWidgetControlenterModalClickGrabber ()
void exit (int code)
MLABWidgetControlmdlControlAtCurrentCursorPosition ()
MLABWidgetControlmdlControlAtGlobalPosition (int x, int y)
MLABWidgetControlmdlControlAtGlobalPosition (const QPoint &globalPosition)
void msleep (int msecs)
void processEvents (bool allowUserInput)
void processEvents ()
void processInventorQueue ()
void removeOverrideCursor ()
void removeWaitCursor ()
void setOverrideCursor (const QString &filename, int hotspotx, int hotspoty)
void setOverrideCursor (const QString &filename)
void setOverrideCursor (const QPixmap &pixmap)
void setWaitCursor ()
bool shouldStop ()
void sleep (int secs)
void terminate ()
void usleep (int usecs)
Printing
void deletePrinter (MLABScriptPrinter *process)
MLABScriptPrinter * newPrinter ()
Running commands as external processes
void deleteProcess (MLABScriptProcess *process)
bool editFile (const QString &abspath)
bool macIsApplicationRunning (const QString &bundleId)
QMap< QString, QVariant > macRunPrivilegedCommand (const QString &command, const QStringList &arguments, const QString &securityEventId=QString(), const QString &prompt=QString())
MLABScriptProcess * newProcess ()
bool openFile (const QString &abspath, int lineno=-1)
bool openUrl (const QString &abspath)
bool runActionOnFile (const QString &action, const QString &abspath)
bool runCommand (const QString &command, const QStringList &arguments, const QString &workingDir=QString())
bool runCommandDetached (const QString &command, const QStringList &arguments=QStringList(), const QString &workingDirectory=QString(), bool makeFrontmost=true)
bool runCommandInConsole (const QString &command, const QStringList &arguments, const QString &workingDir, const QString &standardIn, const QString &title, MLABWidgetControl *parent=NULL)
QMap< QString, QVariant > runCommandStdInOut (const QString &command, const QStringList &arguments, const QString &workingDir=QString(), const QString &standardIn=QString())
MDL (Module Definition Language) parsing
void deleteTreeValidator (MLABTreeValidator *treeValidator)
MLABTreenewTree (const QString &name, const QString &value)
MLABTreenewTree ()
MLABTreeValidatornewTreeValidator (MLABTree *validatorDefinition)
MLABTreereadTreeFromFile (const QString &filename, bool replaceVars)
MLABTreereadTreeFromString (const QString &str, bool replaceVars)
bool writeTreeToFile (MLABTree *tree, const QString &filename)
QString writeTreeToString (MLABTree *tree)
User Activity measurement
bool isUserActive ()
void resetUserActivity ()
void setUserActivityThreshold (int seconds)
Logging to console
void log (const QString &text)
void logError (const QString &text)
void logErrorHTML (const QString &text)
void logFixed (const QString &text)
void logHTML (const QString &text)
void logWarning (const QString &text)
void logWarningHTML (const QString &text)
Running MeVisLab Macro Modules as applications
MLABApplicationRunnerrunApplication (const QString &name, const QStringList &args, MLABWidgetControl *parent)
MLABApplicationRunnerrunApplication (const QString &name, const QStringList &args)
MLABApplicationRunnerrunApplication (const QString &name)
Sign files
bool signFiles (const QStringList &files, const QString &filter, bool crypt, const QString &license)
bool signFiles (const QStringList &files, const QString &filter, bool crypt)
bool signFilesRecursive (const QString &path, const QString &filter, bool crypt, const QString &license)
bool signFilesRecursive (const QString &path, const QString &filter, bool crypt)
Dragging
You can optionally specify an icon to show while dragging.

If you don't give a hotspot location for the icon, it will be in the center of the icon.

bool startColorDrag (const QColor &color, const QPixmap &icon=QPixmap(), int hotSpotX=-1, int hotSpotY=-1)
bool startFieldDrag (MLABField *field, const QPixmap &icon=QPixmap(), int hotSpotX=-1, int hotSpotY=-1)
bool startFileDrag (const QString &file, const QPixmap &icon=QPixmap(), int hotSpotX=-1, int hotSpotY=-1)
bool startFileDrag (const QStringList &files, const QPixmap &icon=QPixmap(), int hotSpotX=-1, int hotSpotY=-1)
bool startImageDrag (const QImage &image, const QPixmap &icon=QPixmap(), int hotSpotX=-1, int hotSpotY=-1)
bool startImageDrag (const QPixmap &pixmap, const QPixmap &icon=QPixmap(), int hotSpotX=-1, int hotSpotY=-1)
bool startModuleDrag (MLABModule *mod, const QPixmap &icon=QPixmap(), int hotSpotX=-1, int hotSpotY=-1)
bool startNewModuleDrag (const QString &mod, const QPixmap &icon=QPixmap(), int hotSpotX=-1, int hotSpotY=-1)
bool startObjectDrag (QObject *object, const QPixmap &icon=QPixmap(), int hotSpotX=-1, int hotSpotY=-1)
bool startTextDrag (const QString &text, const QPixmap &icon=QPixmap(), int hotSpotX=-1, int hotSpotY=-1)


Detailed Description

An instance of this class is available as global "MLAB" object in Scripting.

Member Enumeration Documentation

Mac OS X authorization error codes.

Enumerator:
macErrAuthorizationUnknown  An unknown failure occured.
macErrAuthorizationSuccess  The authorization succeeded.
macErrAuthorizationCanceled  The authorization was cancelled by the user.
macErrAuthorizationDenied  The authorization was denied.
macErrAuthorizationToolExecuteFailure  The specified program could not be executed.
macErrAuthorizationToolEnvironmentError  Privileged helper tool is invalid or an invalid status was returned during execution of the privileged helper tool.


Member Function Documentation

void MLAB::about ( MLABWidgetControl parent = NULL  )  [slot]

show about screen

QStringList MLAB::allInventorModules (  )  [slot]

get all known inventor modules (even when not visible to the user)

QStringList MLAB::allMacroModules (  )  [slot]

get all known macro modules (even when not visible to the user)

QStringList MLAB::allMLModules (  )  [slot]

get all known ml modules (even when not visible to the user)

QStringList MLAB::allModules (  )  [slot]

get all known modules (even when not visible to the user)

QStringList MLAB::allModulesForPackageIdentifier ( const QString &  packageIdentifier  )  [slot]

get all modules contained in the specified package

QDateTime MLAB::buildDate (  )  [slot]

get the build date of MLAB

void MLAB::clearMLCache (  )  [slot]

clear the complete ML Cache

QString MLAB::compilerInfo (  )  [slot]

get information about the used compiler

QString MLAB::computerModelInfo (  )  [slot]

get information about the computer model (e.g. for diagnostic purposes)

void MLAB::copyToPasteboard ( const QString &  string  )  [slot]

copy string to pasteboard

QString MLAB::cryptString ( const QString &  data,
const QString &  password 
) [slot]

crypt given string and encode into base64 string

QString MLAB::cryptString ( const QString &  data  )  [slot]

crypt given string and encode into base 64 string (with internal default password)

QPoint MLAB::cursorPos (  )  [slot]

get the global cursor position

QString MLAB::dateToString ( QDateTime  date,
const QString &  format 
) [slot]

convert date to string with given format

TODO: explain format in more detail Examples: dd.MM.yyyy 21.05.2001 ddd MMMM d yy Tue May 21 01 hh:mm:ss.zzz 14:13:09.042 h:m:s ap 2:13:9 pm

QString MLAB::decryptString ( const QString &  data,
const QString &  password 
) [slot]

decrypt given base64 encoded string and return decrypted string, returns empty string on error

QString MLAB::decryptString ( const QString &  data  )  [slot]

decrypt given base64 encoded string and return decrypted string (with internal default password), returns empty string on error

void MLAB::deletePrinter ( MLABScriptPrinter *  process  )  [slot]

delete a MLABPrinter object

void MLAB::deleteProcess ( MLABScriptProcess *  process  )  [slot]

delete a MLABProcess object (does NOT kill a started process, use kill() instead)

void MLAB::deleteTreeValidator ( MLABTreeValidator treeValidator  )  [slot]

delete the tree validator

QString MLAB::detailedSystemId (  )  [slot]

get the current system identification MLAB is running on

returns the following string depending on the system mlab is running on:

  • "windows [95|98|Me|NT|2000|XP]" (on windows)
  • "macos [10.5.6|unknown] [i386|x86_64|unknown] [(cpu count)]" (on macintosh)
  • "linux [system releaseversion]" (on any linux system, using uname)
  • "unknown" (on any other system)

if you want to get specific system information, use detailedSystemId()

QString MLAB::doubleToString ( double  value,
const QString &  format 
) [slot]

convert double to string with given format (format is as in printf, e.g. 5.4f)

bool MLAB::editFile ( const QString &  abspath  )  [slot]

opens the file with an external program (in edit mode)

MLABWidgetControl* MLAB::enterModalClickGrabber (  )  [slot]

enters a global event mode, where MeVisLab catches mouse clicks on controls and returns the control the mouse click happended in (NULL is returned when the user presses the escape key or clicks onto a widget that is not inside of a control)

QString MLAB::escapeString ( const QString &  value  )  [slot]

escapes the given string so that RichText elements in the text are visible as literal text.

The result can savely be logged via the log() function.

void MLAB::exit ( int  code  )  [slot]

exit the hard way, scripting still goes on after this, its better to use terminate()

QStringList MLAB::findModuleGroups (  )  [slot]

returns a list of known module groups in the form "group":"number of modules":"names of modules"

int MLAB::getCacheAndLockedMemorySizeInKB (  )  [slot]

returns the cache and locked memory size of the memory manager in KB

int MLAB::getCacheAndLockedMemorySizeLimitInKB (  )  [slot]

returns the cache and locked memory size limit of the memory manager in KB

QString MLAB::getenv ( const QString &  str  )  [slot]

get the value of the environment variable

QMap<QString, QVariant> MLAB::getFileFormatLoader ( const QString &  filename  )  [slot]

get the file format loader for the extension of the given filename

If a loader exists, this method returns a map with the following keys:

  • module : the module that can handle the extension
  • filenameField : the field that should be set with the filename

If no loader exists, the map is empty.

QVariantMap MLAB::getModuleDependencies ( const QStringList &  moduleNames,
bool  includeModuleDirectories = true 
) [slot]

returns a dictionary containing all files and directories on which the given macro modules depend

the dictionary contains string lists for the keys:

  • "dirs"
  • "dlls"
  • "files"
  • "modules"
  • "scriptFiles"
    Parameters:
    includeModuleDirectories specifies if the directories in which the module definitions exist are included
    ignoredPackages can be specified to ignore dependencies from certain packages

QString MLAB::getMultiLineText ( const QString &  text,
const QString &  title,
bool  richtext,
MLABWidgetControl parent = NULL 
) [slot]

get multi line requester which returns the text

QStringList MLAB::getProgramFromWindowsRegistry ( const QString &  type,
const QString &  key,
const QString &  subkey 
) [slot]

Reads the windows key, where type may be one of CLASSES_ROOT, LOCAL_MACHINE, CURRENT_USER, USERS, and returns a list of strings where the first string is the program name and the remaining strings are arguments.

If the list is empty, no program was found. The returned list items do not contain any quotes.

bool MLAB::hasFeature ( const QString &  feature  )  [slot]

check if license has a given feature

QString MLAB::hashStringMD5 ( const QString &  data  )  [slot]

returns the md5 hash string for the given data string (converted from Unicode to UTF8)

QString MLAB::hashStringMD5Latin1 ( const QString &  data  )  [slot]

returns the md5 hash string for the given data string (converted from Unicode to Latin1)

bool MLAB::hasVariable ( const QString &  name  )  [slot]

check existence of global pref variable (from mevislab prefs and registry)

void MLAB::help ( const QString &  name  )  [slot]

give scripting help for the given class name (if available)

void MLAB::help ( QObject *  o  )  [slot]

give scripting help for the given object (if available)

void MLAB::help (  )  [slot]

give scripting help for the MLAB object itself

QString MLAB::intToString ( int  value,
const QString &  format 
) [slot]

convert integer to string with given format (format is as in printf, e.g. x)

QStringList MLAB::inventorModules (  )  [slot]

get all known inventor modules (that are visible to the user)

bool MLAB::isDebug (  )  [slot]

check if MLAB is compiled in debug/release mode

bool MLAB::isLinux (  )  [slot]

returns if system is Linux

bool MLAB::isMacOS (  )  [slot]

returns if system is Mac OS X

bool MLAB::isModuleProfilingEnabled (  )  [slot]

returns if module profiling is enabled

bool MLAB::isStandaloneApplication (  )  [slot]

returns if MeVisLab runs a macro as standalone application

bool MLAB::isUnix (  )  [slot]

returns if system is Linux or Mac OS X

bool MLAB::isUserActive (  )  [slot]

check wether the user is currently active (within the threshold)

bool MLAB::isWindows (  )  [slot]

returns if system is Windows

MLABField* MLAB::lastClickedOutputField (  )  [slot]

get last clicked output field in the mlab networks (might be null)

QString MLAB::licenseFileName (  )  [slot]

get the absolute path to the license that MeVisLab is currently using

void MLAB::log ( const QString &  text  )  [slot]

log to console

void MLAB::logError ( const QString &  text  )  [slot]

log error to console

void MLAB::logErrorHTML ( const QString &  text  )  [slot]

log error to console (using HTML)

void MLAB::logFixed ( const QString &  text  )  [slot]

log to console, using a fixed size font and replacing spaces with  

void MLAB::logHTML ( const QString &  text  )  [slot]

log to console (using HTML)

void MLAB::logWarning ( const QString &  text  )  [slot]

log warning to console

void MLAB::logWarningHTML ( const QString &  text  )  [slot]

log warning to console (using HTML)

bool MLAB::macIsApplicationRunning ( const QString &  bundleId  )  [slot]

Check whether a specific application specified by its bundle id is already running (Mac OS X only).

QStringList MLAB::macroModules (  )  [slot]

get all known macro modules (that are visible to the user)

QMap<QString, QVariant> MLAB::macRunPrivilegedCommand ( const QString &  command,
const QStringList &  arguments,
const QString &  securityEventId = QString(),
const QString &  prompt = QString() 
) [slot]

execute given command with access to restricted areas of the operating system if user is authorized. Use with care (Mac OS X only)

calling the function multiple times will reuse an existing authorization reference if and only if the securityEventId is still the same. The same security event id should only be used to authorize calls that "belong together", in the sense that the user should consider them a single security event. If they are meant to be separate, so that a user could meaningfully approve one but decline another, you should use a different security event id. An empty security event id will generate a new, unique security event id.

MLABWidgetControl* MLAB::mdlControlAtCurrentCursorPosition (  )  [slot]

Returns the MDL control that is located at the current cursor position (or NULL if there is none).

MLABWidgetControl* MLAB::mdlControlAtGlobalPosition ( int  x,
int  y 
) [slot]

Returns the MDL control that is located at the given global screen position (or NULL if there is none).

MLABWidgetControl* MLAB::mdlControlAtGlobalPosition ( const QPoint &  globalPosition  )  [slot]

Returns the MDL control that is located at the given global screen position (or NULL if there is none).

QStringList MLAB::mlModules (  )  [slot]

get all known ML modules (that are visible to the user)

QMap<QString, QVariant> MLAB::moduleInfo ( const QString &  module  )  [slot]

get info for given module, the returned array contains the tag=value keys from the module definition

The module type is given as type=[MLModule|InventorModule|MacroModule]. The module name is given as name=NAME. The module distribution is given as distrib=[mevis|std|none]. The module filename+linenumber are given as file=abspath lineno=4711 If module is not found, the array is empty.

QStringList MLAB::modules (  )  [slot]

get all known modules (that are visible to the user)

void MLAB::msleep ( int  msecs  )  [slot]

causes MLAB to sleep msecs milli seconds

MLABScriptPrinter* MLAB::newPrinter (  )  [slot]

create a new process, see MLABPrinter class for its API

you have to delete the returned pointer later on with deletePrinter

MLABScriptProcess* MLAB::newProcess (  )  [slot]

create a new process, see MLABProcess class for its API

you have to delete the returned pointer later on with deleteProcess

MLABTree* MLAB::newTree ( const QString &  name,
const QString &  value 
) [slot]

create a new tree element

MLABTree* MLAB::newTree (  )  [slot]

create a new tree element

MLABTreeValidator* MLAB::newTreeValidator ( MLABTree validatorDefinition  )  [slot]

create a new tree validator from given MDL validator definition

bool MLAB::openFile ( const QString &  abspath,
int  lineno = -1 
) [slot]

opens the file with an external program (in open mode)

bool MLAB::openUrl ( const QString &  abspath  )  [slot]

opens the given url with an external program

void MLAB::processEvents ( bool  allowUserInput  )  [slot]

process events

if user input is allowed be careful with side effects, since the user can e.g. press a button and execute another script etc.

void MLAB::processEvents (  )  [slot]

process events (user events are filtered, just redrawing and timers are processed)

void MLAB::processInventorQueue (  )  [slot]

process delay queue of OpenInventor

This is needed if you want to make sure that all pending OpenInventor notifications are processed.

bool MLAB::qobjectInherits ( QObject *  object,
const QString &  classname 
) [slot]

returns true if the given qobject inherits from given classname

QString MLAB::readKey ( const QString &  application,
const QString &  key 
) [slot]

read an application specific key for its value, e.g. "ILabNeuro","FileDialogPath"

This method can be used to easily store machine/user dependend settings in the registry. Returns an empty string if the key is not set.

MLABTree* MLAB::readTreeFromFile ( const QString &  filename,
bool  replaceVars 
) [slot]

parses the given MDL file, returns an empty tree on error

MLABTree* MLAB::readTreeFromString ( const QString &  str,
bool  replaceVars 
) [slot]

parses the given MDL file, returns an empty tree on error

QString MLAB::readWindowsRegistry ( const QString &  type,
const QString &  key,
const QString &  subkey 
) [slot]

reads the windows key, type may be one of CLASSES_ROOT, LOCAL_MACHINE, CURRENT_USER, USERS

void MLAB::removeOverrideCursor (  )  [slot]

remove the last override cursor

void MLAB::removeWaitCursor (  )  [slot]

remove the global wait cursor

void MLAB::resetUserActivity (  )  [slot]

resets the user activity measurement

bool MLAB::runActionOnFile ( const QString &  action,
const QString &  abspath 
) [slot]

run given abstract action on given absolute file path (this does the same as opening files in MeVisLab, e.g.

it can "open" .mlab files, .def files etc.)

The command execcuted by the given action depends on the settings in your mevislab.prefs file. On Windows, the default behaviour is using ShellExecute(), so the command is the same as clicking "open","edit","explore"... on the file in the Explorer.

Available commands:

  • "open" opens a file
  • "edit" opens a file for edititing (e.g. for HTML there is a difference in opening for viewing and for editing)
  • "explore" opens a directory explorer
  • "windowsDefault" does the default action (like double clicking on a file in explorer) WINDOWS ONLY!

MLABApplicationRunner* MLAB::runApplication ( const QString &  name,
const QStringList &  args,
MLABWidgetControl parent 
) [slot]

like above but with a given parent application window

MLABApplicationRunner* MLAB::runApplication ( const QString &  name,
const QStringList &  args 
) [slot]

run the application given by name

The arguments are given as an array of strings. All arguments are optional. Possible entries are:

  • "name" "WINDOWNAME" - run a named window, instead of the default window of the module
  • "style" "STYLENAME" - root style to use, e.g. Application, Panel or custom style
  • "noshow" - don't show the window of the application
  • "fullscreen" - show the window fullscreen withoput window bar
  • "maximized" - run in fullscreen mode (not when modal!)
  • "childwindow" - run as child window of MeVisLab (or of the passes application window as parent, see next method)
  • "modal" - run as a modal dialog
  • "popup" - show the application as a popup window

MLABApplicationRunner* MLAB::runApplication ( const QString &  name  )  [slot]

run a macro module as application

bool MLAB::runCommand ( const QString &  command,
const QStringList &  arguments,
const QString &  workingDir = QString() 
) [slot]

run given executable command with given arguments array and return if successfull

Parameters:
command executable, may be absolute path or local in PATH environment
arguments list of arguments passed to command
workingDir working directory passed to command
Returns:
returns true if successfull
TODO: example code This command runs synchronously, so the command was definitely executed when this function returns If you need more control on the command, use the MLABProcess class instead.

bool MLAB::runCommandDetached ( const QString &  command,
const QStringList &  arguments = QStringList(),
const QString &  workingDirectory = QString(),
bool  makeFrontmost = true 
) [slot]

run given executable command with given arguments array in a new process and detach from it.

return if launch has been successfull

Parameters:
command executable, may be absolute path or local in PATH environment
arguments list of arguments passed to command (can be empty list)
workingDirectory,command will be started in this directory (uses current directory if none is given)
makeFrontmost,make application frontmost on Mac OS X if set 'true' (default)
Returns:
returns true if successfull

bool MLAB::runCommandInConsole ( const QString &  command,
const QStringList &  arguments,
const QString &  workingDir,
const QString &  standardIn,
const QString &  title,
MLABWidgetControl parent = NULL 
) [slot]

runs the given command in a console window.

This method returns immediately, stdout+stderr are going to the console. the window must be closed by the user. If an error occures the processError(QProcess*,QProcess::ProcessError) signal is emitted

example:

    MLAB.runCommandInConsole("eatDicom", ["-help"], "", "", "Running eatDicom")

QMap<QString, QVariant> MLAB::runCommandStdInOut ( const QString &  command,
const QStringList &  arguments,
const QString &  workingDir = QString(),
const QString &  standardIn = QString() 
) [slot]

run given command, passing additional stdin text and returning a map with the result and the stdout

This command runs synchronously. The result is a map that contains:

  • ok (true if call succeeded)
  • status (exit status if call succeeded)
  • stdout (stdoutput of the started process)
  • stderr (stderror of the started process)
  • error (error code if call failed, doesn't exist otherwise)

Example:

    var result = MLAB.runCommandStdInOut("cat",[""],"","test data...")
    if (result.ok) {
      MLAB.log("result: " + result.status + " " + result.stdout + " " + result.stderr);
    }

void MLAB::setModuleProfilingEnabled ( bool  enabled  )  [slot]

sets if module profiling is enabled

void MLAB::setOverrideCursor ( const QString &  filename,
int  hotspotx,
int  hotspoty 
) [slot]

set the global override cursor to the given pixmap file and set the hotspot

void MLAB::setOverrideCursor ( const QString &  filename  )  [slot]

set the global override cursor to the given pixmap file

void MLAB::setOverrideCursor ( const QPixmap &  pixmap  )  [slot]

set the global override cursor to the given pixmap

void MLAB::setUserActivityThreshold ( int  seconds  )  [slot]

sets the global user activity threshold in seconds, this also resets the user activity measurement

void MLAB::setVariable ( const QString &  name,
const QString &  value 
) [slot]

set value of global pref variable (only transient, will be default on next restart)

void MLAB::setWaitCursor (  )  [slot]

show the global wait cursor (be sure to call removeWaitCursor the same number of times as setWaitCursor)

bool MLAB::shouldStop (  )  [slot]

global break checking which can be called from the scripting to allow pressing buttons which have the globalStop tag set to true.

Returns:
returns true if a stop button was pressed

QColor MLAB::showColorDialog ( const QString &  initialColor,
MLABWidgetControl parent = NULL 
) [slot]

get QColor from color dialog, initialColor is given as name (e.g. "white") or in hexadecimal notation (e.g. "#44cc88")

QColor MLAB::showColorDialog ( const QColor &  initialColor = Qt::white,
MLABWidgetControl parent = NULL 
) [slot]

get QColor from color dialog

int MLAB::showCritical ( const QString &  text,
const QString &  title,
const QStringList &  buttonTexts,
int  defaultButtonNumber 
) [slot]

show a critical error panel with given parameters, for details see showQuestion(), defaultButtonNumber gives the default button starting from 0

int MLAB::showCritical ( const QString &  text,
const QString &  detail,
const QString &  title,
const QStringList &  buttonTexts,
int  defaultButtonNumber,
MLABWidgetControl parent = NULL 
) [slot]

show a critical error panel with given parameters, for details see showQuestion(), defaultButtonNumber gives the default button starting from 0

void MLAB::showCritical ( const QString &  text,
const QString &  title = MEVISLAB_TITLESTRING 
) [slot]

show a critical message box with ok button

void MLAB::showCritical ( const QString &  text,
const QString &  detail,
const QString &  title,
MLABWidgetControl parent = NULL 
) [slot]

show a critical message box with graphically separated details and ok button

int MLAB::showInformation ( const QString &  text,
const QString &  title,
const QStringList &  buttonTexts,
int  defaultButtonNumber 
) [slot]

show an information panel with given parameters, for details see showQuestion(), defaultButtonNumber gives the default button starting from 0

int MLAB::showInformation ( const QString &  text,
const QString &  detail,
const QString &  title,
const QStringList &  buttonTexts,
int  defaultButtonNumber,
MLABWidgetControl parent = NULL 
) [slot]

show an information panel with given parameters, for details see showQuestion(), defaultButtonNumber gives the default button starting from 0

void MLAB::showInformation ( const QString &  text,
const QString &  title = MEVISLAB_TITLESTRING 
) [slot]

show an information message box with ok button

void MLAB::showInformation ( const QString &  text,
const QString &  detail,
const QString &  title,
MLABWidgetControl parent = NULL 
) [slot]

show an information message box with graphically separated details and ok button

void MLAB::showMultiLineText ( const QString &  text,
const QString &  title,
bool  richtext,
MLABWidgetControl parent = NULL 
) [slot]

show window with multi line text

int MLAB::showQuestion ( const QString &  text,
const QString &  title,
const QStringList &  buttonTexts,
int  defaultButtonNumber 
) [slot]

show a question panel with given parameters, defaultButtonNumber gives the default button starting from 0

int MLAB::showQuestion ( const QString &  text,
const QString &  detail,
const QString &  title,
const QStringList &  buttonTexts,
int  defaultButtonNumber,
MLABWidgetControl parent = NULL 
) [slot]

show a question panel with given parameters

Returns:
number of pressed button, starting with 0
Parameters:
text text to show
detail detailed information to show (e.g. a file or directory name)
title window title to show
buttonTexts list of button texts to show on the buttons, e.g. ["Ok","Cancel"] or ["Retry","Abort","Ignore"]. Please use the following standard button texts if at all possible (Ensures display of buttons in right order on any platform / Esc detection): Ok, Open, Save, Cancel, Close, Discard, Apply, Reset, Restore Defaults, Help, Save All, Yes, Yes To All, No, No To All, Abort, Retry, Ignore
defaultButtonNumber button that is used when user presses return, starting from 0 for the first button
parent parent window, e.g. ctx.window(), the dialog becomes becomes modal relative to parent or application modal if NULL Script example:
      i = MLAB.showQuestion("How about some coffee?", "I've got a new espresso machine", "MeVisLab", ["Yes", "No", "Cancel"], 0);
      switch (i) {
        case 0:  // handle "Yes"
          break;
        case 1:  // handle "No"
          break;
        case 2:  // handle "Cancel" / Pressing of Esc
          break;
      }

int MLAB::showWarning ( const QString &  text,
const QString &  title,
const QStringList &  buttonTexts,
int  defaultButtonNumber 
) [slot]

show a warning message panel with given parameters, for details see showQuestion(), defaultButtonNumber gives the default button starting from 0

int MLAB::showWarning ( const QString &  text,
const QString &  detail,
const QString &  title,
const QStringList &  buttonTexts,
int  defaultButtonNumber,
MLABWidgetControl parent = NULL 
) [slot]

show a warning message panel with given parameters, for details see showQuestion(), defaultButtonNumber gives the default button starting from 0

void MLAB::showWarning ( const QString &  text,
const QString &  title = MEVISLAB_TITLESTRING 
) [slot]

show a warning message box with ok button

void MLAB::showWarning ( const QString &  text,
const QString &  detail,
const QString &  title,
MLABWidgetControl parent = NULL 
) [slot]

show a warning message box with graphically separated details and ok button

bool MLAB::signFiles ( const QStringList &  files,
const QString &  filter,
bool  crypt,
const QString &  license 
) [slot]

signs the files (absolute filenames) with the license file given as license

bool MLAB::signFiles ( const QStringList &  files,
const QString &  filter,
bool  crypt 
) [slot]

signs the files (absolute filenames) with the license that MeVisLab was started with

bool MLAB::signFilesRecursive ( const QString &  path,
const QString &  filter,
bool  crypt,
const QString &  license 
) [slot]

signs the files with the license file given as license

bool MLAB::signFilesRecursive ( const QString &  path,
const QString &  filter,
bool  crypt 
) [slot]

signs the files with the license that MeVisLab was started with

void MLAB::sleep ( int  secs  )  [slot]

causes MLAB to sleep secs seconds

QString MLAB::standaloneApplicationName (  )  [slot]

get the name of the Macro module that is running as a MeVisLabApp standalone application (or empty string if MeVisLab itself is running)

bool MLAB::startObjectDrag ( QObject *  object,
const QPixmap &  icon = QPixmap(),
int  hotSpotX = -1,
int  hotSpotY = -1 
) [slot]

Start dragging a QObject.

QString MLAB::stringToEncodedUrlString ( const QString &  string  )  [slot]

convert a string Url to an encoded URL string (using xx encoding)

QString MLAB::systemId (  )  [slot]

get the current system identification MLAB is running on

returns the following string depending on the system mlab is running on:

  • windows
  • macos
  • linux
  • unknown (on any other system)

if you want to get specific system information, use systemIdDetail()

QString MLAB::systemInfo (  )  [slot]

get a detailed info string about the system, should not be used for checking purposes, use systemId() or detailedSystemId() instead.

void MLAB::terminate (  )  [slot]

terminate the whole MeVisLab application, note that scripting goes on after this call and MLAB closes in the next event processing

void MLAB::usleep ( int  usecs  )  [slot]

causes MLAB to sleep usecs micro seconds

bool MLAB::valueIsTrue ( const QString &  val  )  [slot]

check if string value is true in the MeVisLab sense

QString MLAB::variable ( const QString &  name  )  [slot]

get value of global pref variable (read from mevislab prefs and registry)

bool MLAB::variableIsTrue ( const QString &  name  )  [slot]

returns true if variable has YES/TRUE/1 as value, else false

void MLAB::writeKey ( const QString &  application,
const QString &  key,
const QString &  value 
) [slot]

write a permanent key/value pair for the given application

This method can be used to easily retrieve machine/user settings information from the registry. If you want to immediately save you settings, you have to call writeRegistry() after your writeKey() calls

void MLAB::writeRegistry (  )  [slot]

to make sure that settings set via setRegistryKey() are stored immediately, call this method

bool MLAB::writeTreeToFile ( MLABTree tree,
const QString &  filename 
) [slot]

writes the given tree to a file

QString MLAB::writeTreeToString ( MLABTree tree  )  [slot]

writes the given tree to a file


Generated on Sat Sep 3 18:38:02 2011 for MeVisLab Scripting Reference by  doxygen 1.5.8