pqPythonCompleter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
3 #ifndef pqPythonCompleter_h
4 #define pqPythonCompleter_h
5 
6 #include "vtkPython.h"
7 
8 #include "pqPythonModule.h" // needed for PQPYTHON_EXPORT.
9 #include "pqWidgetCompleter.h" // Defines pqWidgetCompleter interface
10 
15 class PQPYTHON_EXPORT pqPythonCompleter : public pqWidgetCompleter
16 {
17 public:
18  pqPythonCompleter(QWidget* parent)
19  : pqWidgetCompleter(parent){};
20 
21 protected:
22  QStringList getCompletions(const QString& prompt) override;
23  QString getCompletionPrefix(const QString& prompt) override;
24 
29  QString getVariableToComplete(const QString& prompt);
30 
34  void appendPyObjectAttributes(PyObject* object, QStringList& results);
35 
42  PyObject* derivePyObject(const QString& pythonObjectName, PyObject* locals);
43 
48  virtual QStringList getPythonCompletions(const QString& pythonObjectName) = 0;
49 };
50 #endif
pqWidgetCompleter
Abstact class for widget completers.
Definition: pqWidgetCompleter.h:16
pqWidgetCompleter::getCompletions
virtual QStringList getCompletions(const QString &prompt)=0
Return a list of strings that could match the given prompt.
pqWidgetCompleter.h
pqPythonCompleter::pqPythonCompleter
pqPythonCompleter(QWidget *parent)
Definition: pqPythonCompleter.h:18
PyObject
struct _object PyObject
pqPythonCompleter
Abstract class for Python completers.
Definition: pqPythonCompleter.h:15
pqWidgetCompleter::getCompletionPrefix
virtual QString getCompletionPrefix(const QString &prompt)=0
Return the part of the prompt that can be completed.