Python Script Engine  8.3
GL Studio Editor Python Script API
Editor Class Reference

Module Methods

Methods that can be called on the module.

bool RegisterDragAndDropHandlers (None *dragHandler, None *dropHandler)
 
str MakeValidObjectName (str inputStr)
 
bool IsNameReserved (str inputStr)
 
str ResolvePath (str path)
 
None ClearDragAndDropHandlers ()
 
int Choice (str button0, str button1, str button2, str text)
 
int ChoiceWithDefault (str button0, str button1, str button2, int defaultChoice, str text)
 
bool Question (str s)
 
bool QuestionDefault (str s, bool defaultAnswer)
 
None Error (str s)
 
None MsgBox (str s)
 
str SaveDialog (str caption, str directory, str filters, str defaultSuffix=str())
 
str OpenDialog (str caption, str directory, str filters, bool isCreateFileAllowed=false)
 
str OpenDirectoryDialog (str caption, str directory)
 
list OpenMultiselectDialog (str caption, str directory, str filters)
 
DocumentArrayGetAllDocuments ()
 
None ForceEditorRefresh ()
 
None GenerateCurrentDocument ()
 
None GenerateCurrentDocumentAndChildren ()
 
None GenerateAllDocuments ()
 
None CleanCurrentDocument ()
 
None CleanCurrentDocumentAndChildren ()
 
None CleanAllDocuments ()
 
list GetAvailableCodeGenerators ()
 
str GetActiveCodeGenerator ()
 
bool SetActiveCodeGenerator (str codeGeneratorName)
 
CodeGenerator GetCodeGenerator (str codeGeneratorName)
 
str SetCodeGeneratorOptions (str codeGeneratorOptions)
 
str GetCodePathForCurrentGenerator (Document *doc=nullptr)
 
str GetResourcesPathForCurrentGenerator ()
 
str GetCurrentProjectFileDirectory ()
 
ProjectGetCurrentProject ()
 
None ForceRefreshCurrentProject ()
 
str GetApplicationLanguage ()
 
None GetVersionInfo (int *major, int *minor, int *build)
 
None RegisterAlternateClassPathChooser (PyObject *pyfunc)
 
None UnregisterAlternateClassPathChooser ()
 
None RegisterCatalyzerScriptChooser (PyObject *pyfunc)
 
None UnregisterCatalyzerScriptChooser ()
 
None RegisterIcdGeneratorChooser (PyObject *pyfunc)
 
None UnregisterIcdGeneratorChooser ()
 
None Close ()
 
Document GetCurrentDocument ()
 
Document GetDocumentByName (str docName)
 
Document NewDocument (str filename="")
 
Document OpenDocument (str fileName)
 
None SaveAllDocuments ()
 
None CloseAllDocuments ()
 
str GetVersionInfostr ()
 

Detailed Description

Editor module that contains methods to run on the Editor instance itself.

Member Function Documentation

◆ Choice()

int Choice ( str  button0,
str  button1,
str  button2,
str  text 
)

Creates and shows a pop-up dialog box and displays a text string and up to (3) buttons labeled according to the first three input parameters.

To hide any of the buttons, pass an empty string to the corresponding param. A question icon is displayed. This is equivalent to the fltk "fl_choice" message type.

Parameters
button0The label for button 0 (ESC is shortcut for this Right button)
button1The label for button 1 (RET is shortcut for this Center button)
button2The label for button 2 (left-most button)
textThe text string to display
Returns
Equals 0 if button0 pressed, 1 if button1 pressed, 2 if button2 pressed
Since
GL Studio 6.0.1

◆ ChoiceWithDefault()

int ChoiceWithDefault ( str  button0,
str  button1,
str  button2,
int  defaultChoice,
str  text 
)

Creates and shows a pop-up dialog box and displays a text string and up to (3) buttons labeled according to the first three input parameters.

To hide any of the buttons, pass an empty string to the corresponding param. A question icon is displayed. This is equivalent to the fltk "fl_choice" message type.

Parameters
button0The label for button 0 (ESC is shortcut for this Right button)
button1The label for button 1 (RET is shortcut for this Center button)
button2The label for button 2 (left-most button)
defaultChoiceThe value returned when in command-line mode
textThe text string to display
Returns
Equals 0 if b0 pressed, 1 if b1 pressed, 2 if b2 pressed
Since
GL Studio 6.0.1

◆ CleanAllDocuments()

None CleanAllDocuments ( )

Cleans all of the code for a given document.

◆ CleanCurrentDocument()

None CleanCurrentDocument ( )

Cleans the code for a given document.

◆ CleanCurrentDocumentAndChildren()

None CleanCurrentDocumentAndChildren ( )

Cleans the code for a given document and any referenced children.

◆ ClearDragAndDropHandlers()

None ClearDragAndDropHandlers ( )

Clear all file drag and drop handlers currently added.

◆ Close()

None Close ( )

Close the editor.

Since
GL Studio 7.1.0

◆ CloseAllDocuments()

None CloseAllDocuments ( )

Closes all open documents.

◆ Error()

None Error ( str  s)

Creates and shows a pop-up dialog box and displays a text string and (1) button labeled 'OK'.

An exclamation icon is displayed. This is equivalent to the fltk "fl_alert" message type.

Parameters
sThe text string to display
Since
GL Studio 6.0.1

◆ ForceEditorRefresh()

None ForceEditorRefresh ( )

Force refresh of editor user interface.

◆ ForceRefreshCurrentProject()

None ForceRefreshCurrentProject ( )

To be called when we know we need to refresh the project and its packages.

Since
GL Studio 6.0.1

◆ GenerateAllDocuments()

None GenerateAllDocuments ( )

Generates all of the code for a given document.

◆ GenerateCurrentDocument()

None GenerateCurrentDocument ( )

Generates the code for a given document.

◆ GenerateCurrentDocumentAndChildren()

None GenerateCurrentDocumentAndChildren ( )

Generates all of the code for a given document and any referenced children.

◆ GetActiveCodeGenerator()

str GetActiveCodeGenerator ( )

Get a list of available code generators.

See also
GetAvailableCodeGenerators()
SetActiveCodeGenerator()

◆ GetAllDocuments()

DocumentArray * GetAllDocuments ( )

Get a list of all loaded documents.

Returns
List of loaded documents

◆ GetApplicationLanguage()

str GetApplicationLanguage ( )

Returns the language code that is currently in use.

Returns
the 2-letter language code
Since
GL Studio 6.0.1

◆ GetAvailableCodeGenerators()

list GetAvailableCodeGenerators ( )

Get a list of available code generators.

See also
GetActiveCodeGenerator()
SetActiveCodeGenerator()

◆ GetCodeGenerator()

CodeGenerator GetCodeGenerator ( str  codeGeneratorName)

Gets the code generator object by name.

Parameters
codeGeneratorNameThe name of the code generator to return. Should be one of the strings returned by GetAvailableCodeGenerators().
Returns
non isNULL() on success.
See also
GetAvailableCodeGenerators()
GetActiveCodeGenerator()

◆ GetCodePathForCurrentGenerator()

str GetCodePathForCurrentGenerator ( Document doc = nullptr)

The the code generation output path for the currently active generator.

This can be different from the document specified path based on project settings.

Parameters
docthe document to use when cacluating the path
Returns
the path
Deprecated:
Use Deployment::GetGeneratedCodeRoot() instead.

◆ GetCurrentDocument()

Document GetCurrentDocument ( )

Gets the current document.

Returns
current document ( isNULL on returned value returns true if there is no current doc )

◆ GetCurrentProject()

Project * GetCurrentProject ( )

Returns the project object that is currently in use, or null if there is none.

Since
GL Studio 6.0.1

◆ GetCurrentProjectFileDirectory()

str GetCurrentProjectFileDirectory ( )

Returns the project directory that is currently in use.

Returns
the path to the project file, or empty string if there is none
See also
GetCurrentProject()

◆ GetDocumentByName()

Document GetDocumentByName ( str  docName)

Gets the document with the given name, if open.

Parameters
docNamename of the document to get
Returns
desired document ( isNULL on returned value returns true if there is no document with the given name open )

◆ GetResourcesPathForCurrentGenerator()

str GetResourcesPathForCurrentGenerator ( )

The the resources output path for the currently active generator.

Returns
the path
Deprecated:
Use Deployment::GetGeneratedResourcesRoot() instead.

◆ GetVersionInfo()

None GetVersionInfo ( int *  major,
int *  minor,
int *  build 
)

Returns a tuple of the version info in the form of (major, minor, build).

Parameters
majorThe returned major version.
minorThe returned minor version.
buildThe returned build version.
Since
GL Studio 6.0.1

◆ GetVersionInfostr()

str GetVersionInfostr ( )

Returns a string containing the version info a string concatination of GetVersionInfo()

Returns
a string containing the editor version info
Since
GL Studio 6.0.1

◆ IsNameReserved()

bool IsNameReserved ( str  inputStr)

Check if a string matches any C++ reserved words.

Parameters
inputStra string that will be checked against a list of reserved words.
Returns
true if the string matches a reserved word, false otherwise.
Since
GL Studio 8.3.0

◆ MakeValidObjectName()

str MakeValidObjectName ( str  inputStr)

Make a string a valid C++ identifier.

Invalid characters will be replaced with underscores. If the string starts with a number, a leading underscore is added.

Parameters
inputStra string that will be converted to a valid C++ identifier.
Returns
valid C++ identifier
Exceptions
ifthe inputStr could not be made into a valid C++ identifier.
Since
GL Studio 6.0.1

◆ MsgBox()

None MsgBox ( str  s)

Creates and shows a pop-up dialog box and displays a text string and (1) button labeled 'OK'.

An 'i' (information) icon is displayed. This is equivalent to the fltk "fl_message" message type.

Parameters
sThe text string to display
Since
GL Studio 6.0.1

◆ NewDocument()

Document NewDocument ( str  filename = "")

Creates a new document and makes it the current document.

Parameters
filenameoptional filename to give the new document
Returns
a new document that is the current document

◆ OpenDialog()

str OpenDialog ( str  caption,
str  directory,
str  filters,
bool  isCreateFileAllowed = false 
)

Displays an open dialog.

Parameters
captionThe dialog box title
[in,out]directoryAs input, the starting directory; as output, the returning the chosen directory.
filtersThe filters of the form "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
isCreateFileAllowedIf enabled, allows the file dialog to create new files
Returns
The chosen filename to open (or empty if canceled)
Since
GL Studio 6.0.1

◆ OpenDirectoryDialog()

str OpenDirectoryDialog ( str  caption,
str  directory 
)

Displays an open directory dialog.

Parameters
captionThe dialog box title
[in,out]directoryAs input, the starting directory; as output, the returning the chosen directory.
Returns
The chosen filename to open (or empty if canceled)
Since
GL Studio 6.0.1

◆ OpenDocument()

Document OpenDocument ( str  fileName)

Opens a new document and makes it the current document.

Parameters
fileNamename of file to load
Returns
loaded document ( isNULL on returned value returns true if no doc loaded )

◆ OpenMultiselectDialog()

list OpenMultiselectDialog ( str  caption,
str  directory,
str  filters 
)

Displays an open dialog.

Parameters
captionThe dialog box title.
[in,out]directoryAs input, the starting directory; as output, the returning the chosen directory.
filtersThe filters of the form "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
Returns
The chosen filenames to open (or empty if canceled).
Since
GL Studio 6.0.1

◆ Question()

bool Question ( str  s)

Creates and shows a pop-up dialog box and displays a text string and (2) buttons labeled 'Yes' and 'No'.

A question mark icon is displayed. This is equivalent to the fltk "fl_choice" message type.

Parameters
sThe text string to display
Returns
Equals true if user pressed 'Yes', otherwise false
Since
GL Studio 6.0.1

◆ QuestionDefault()

bool QuestionDefault ( str  s,
bool  defaultAnswer 
)

Creates and shows a pop-up dialog box and displays a text string and (2) buttons labeled 'Yes' and 'No'.

A question mark icon is displayed. This is equivalent to the fltk "fl_choice" message type. This calls ChoiceWithDefault with buttons for "Yes" and "No.

Parameters
sThe text string to display
defaultAnswerThe value returned when in command-line mode
Returns
Equals true if user pressed 'Yes', otherwise false
Since
GL Studio 6.0.1

◆ RegisterAlternateClassPathChooser()

None RegisterAlternateClassPathChooser ( PyObject *  pyfunc)

Register a function that can provide a path to an alternate class header file.

Overwrites any previously registered alternate class path chooser

Parameters
pyfuncthe python function to call. Should take no parameters and return a string which is a path to the alternate class header (either an absolute file path or a path relative to the gls file)
Since
GL Studio 6.0.1

◆ RegisterCatalyzerScriptChooser()

None RegisterCatalyzerScriptChooser ( PyObject *  pyfunc)

Register a function that can provide a path to an Catalyzer Script.

Overwrites any previously registered catalyzer script chooser

Parameters
pyfuncthe python function to call. Should take no parameters and return a string which is a path to catalyzer script (either an absolute file path or a path relative to the gls file)
Since
GL Studio 6.0.1

◆ RegisterDragAndDropHandlers()

bool RegisterDragAndDropHandlers ( None *  dragHandler,
None *  dropHandler 
)

Register file drag and drop handlers.

Parameters
dragHandlerPython callable that takes a filename to see if the drop handler will accept it.
dropHandlerPython callable that takes a filename to handle the drop
Returns
true if the handlers were added.

◆ RegisterIcdGeneratorChooser()

None RegisterIcdGeneratorChooser ( PyObject *  pyfunc)

Register a function that can open the GUI for an ICD Generator.

Overwrites any previously registered ICD Generator chooser

Parameters
pyfuncthe python function to call. Should take no parameters and return None
Since
GL Studio 8.1

◆ ResolvePath()

str ResolvePath ( str  path)

Resolves a path pointing at a referenced package to the path's actual location.

Parameters
paththe path to be resolved
Returns
The path of the file referenced if pointing to a referenced package, otherwise path returned as-is.
Since
GL Studio 6.3.1

◆ SaveAllDocuments()

None SaveAllDocuments ( )

Saves all open documents.

◆ SaveDialog()

str SaveDialog ( str  caption,
str  directory,
str  filters,
str  defaultSuffix = str () 
)

Displays a save dialog.

Parameters
captionThe dialog box title
[in,out]directoryAs input, the starting directory; as output, the returning the chosen directory.
filtersThe filters of the form "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
defaultSuffixthe default extension to add if the user does not provide one. Can be NULL.
Returns
The chosen filename for saving to (or empty if canceled)
Since
GL Studio 6.0.1

◆ SetActiveCodeGenerator()

bool SetActiveCodeGenerator ( str  codeGeneratorName)

Set the current code generator.

Parameters
codeGeneratorNameThe name of the code generator to make active. Should be one of the strings returned by GetAvailableCodeGenerators().
Returns
Indicates if the requested code generator was found. If false, this function had no effect.
See also
GetAvailableCodeGenerators()
GetActiveCodeGenerator()

◆ SetCodeGeneratorOptions()

str SetCodeGeneratorOptions ( str  codeGeneratorOptions)

Pass some options to configure the current code generator.

Parameters
codeGeneratorOptionsThe options in KEY=VALUE pairs separated by spaces.
Returns
str contains a list of failed configuration options. If empty, all applied successfully. If not empty, all that are not here were applied.
Note
This is an advanced function that may be deprecated later in favor of CEI interfaces for the code generators.

◆ UnregisterAlternateClassPathChooser()

None UnregisterAlternateClassPathChooser ( )

Clears out any registered alternate class path chooser so that the default alternate class path chooser is used.

Since
GL Studio 6.0.1

◆ UnregisterCatalyzerScriptChooser()

None UnregisterCatalyzerScriptChooser ( )

Clears out any registered catalyzer script chooser so that the default catalyzer script chooser is used.

Since
GL Studio 6.0.1

◆ UnregisterIcdGeneratorChooser()

None UnregisterIcdGeneratorChooser ( )

Clears out any registered ICD Generator chooser so that the default ICD Generator plugin is used.

Since
GL Studio 8.1

The documentation for this class was generated from the following file: