1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Adrien Bruneton (CEA/DEN)
20 // Created on: 4 avr. 2013
23 #ifndef PYCONSOLE_ENHINTERP_H_
24 #define PYCONSOLE_ENHINTERP_H_
26 #include "PyConsole.h"
29 #include "PyConsole_Interp.h"
35 * Enhanced Python interpreter used for auto-completion.
36 * This extends PyConsole_Interp with an API wrapping the Python dir() command nicely.
38 class PYCONSOLE_EXPORT PyConsole_EnhInterp: public PyConsole_Interp
42 : PyConsole_Interp(), _last_matches(0), _doc_str("")
45 virtual ~PyConsole_EnhInterp() {}
47 const std::vector<QString>& getLastMatches() const { return _last_matches; }
48 const QString & getDocStr() const { return _doc_str; }
50 virtual int runDirCommand(const QString& dirArgument, const QString& startMatch);
51 virtual void clearCompletion();
54 /** Hard coded list of Python keywords */
55 static const std::vector<QString> PYTHON_KEYWORDS;
57 /** Last computed matches */
58 std::vector<QString> _last_matches;
59 /** Doc string of the first match - when only one match it will be displayed by the Editor*/
62 virtual int runDirAndExtract(const QString& dirArgument, const QString & startMatch,
63 std::vector<QString> & result, bool discardSwig=true) const;
67 #endif /* PYCONSOLE_ENHINTERP_H_ */