Public Member Functions | Protected Member Functions | List of all members
pqPythonCompleter Class Referenceabstract

Abstract class for Python completers. More...

#include <pqPythonCompleter.h>

Inheritance diagram for pqPythonCompleter:
Inheritance graph
[legend]
Collaboration diagram for pqPythonCompleter:
Collaboration graph
[legend]

Public Member Functions

 pqPythonCompleter (QWidget *parent)
 
- Public Member Functions inherited from pqWidgetCompleter
 pqWidgetCompleter (QWidget *parent)
 
virtual void updateCompletionModel (const QString &prompt)
 This method is called by the client to request an update on the internal completion model, given a text prompt. More...
 
bool getCompleteEmptyPrompts ()
 get/set CompleteEmptyPrompts, indicating whether or not the completer should show anything if an empty prompt is given. More...
 
void setCompleteEmptyPrompts (bool newValue)
 get/set CompleteEmptyPrompts, indicating whether or not the completer should show anything if an empty prompt is given. More...
 

Protected Member Functions

QStringList getCompletions (const QString &prompt) override
 Return a list of strings that could match the given prompt. More...
 
QString getCompletionPrefix (const QString &prompt) override
 Return the part of the prompt that can be completed. More...
 
QString getVariableToComplete (const QString &prompt)
 From a prompt string that can contain multiple tokens, retrieve the last (possibly incomplete) variable name. More...
 
void appendPyObjectAttributes (PyObject *object, QStringList &results)
 Given a PyObject, append all of its attributes in the results list. More...
 
PyObjectderivePyObject (const QString &pythonObjectName, PyObject *locals)
 Given pythonObjectName string in the form "X.Y.Z.T" and script locals, return the most derived PyObject that matches the string. More...
 
virtual QStringList getPythonCompletions (const QString &pythonObjectName)=0
 Given a text prompt, return a list of possible completions. More...
 

Detailed Description

Abstract class for Python completers.

Child classes must implement how Python attributes are retrieved from a given variable name prompt.

Definition at line 15 of file pqPythonCompleter.h.

Constructor & Destructor Documentation

◆ pqPythonCompleter()

pqPythonCompleter::pqPythonCompleter ( QWidget *  parent)
inline

Definition at line 18 of file pqPythonCompleter.h.

Member Function Documentation

◆ getCompletions()

QStringList pqPythonCompleter::getCompletions ( const QString &  prompt)
overrideprotectedvirtual

Return a list of strings that could match the given prompt.

Implements pqWidgetCompleter.

◆ getCompletionPrefix()

QString pqPythonCompleter::getCompletionPrefix ( const QString &  prompt)
overrideprotectedvirtual

Return the part of the prompt that can be completed.

Implements pqWidgetCompleter.

◆ getVariableToComplete()

QString pqPythonCompleter::getVariableToComplete ( const QString &  prompt)
protected

From a prompt string that can contain multiple tokens, retrieve the last (possibly incomplete) variable name.

◆ appendPyObjectAttributes()

void pqPythonCompleter::appendPyObjectAttributes ( PyObject object,
QStringList &  results 
)
protected

Given a PyObject, append all of its attributes in the results list.

◆ derivePyObject()

PyObject* pqPythonCompleter::derivePyObject ( const QString &  pythonObjectName,
PyObject locals 
)
protected

Given pythonObjectName string in the form "X.Y.Z.T" and script locals, return the most derived PyObject that matches the string.

For example, given "X.Y.Z" string and a locals object containing an object X with attribute Z, returns the object X.Y

◆ getPythonCompletions()

virtual QStringList pqPythonCompleter::getPythonCompletions ( const QString &  pythonObjectName)
protectedpure virtual

Given a text prompt, return a list of possible completions.

This method must be implemented in concrete classes.

Implemented in pqPythonCalculatorCompleter, and pqPythonShellCompleter.


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