Tulip  4.2.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
PythonShellWidget.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 
20 /**
21  *
22  * This file is part of Tulip (www.tulip-software.org)
23  *
24  * Authors: David Auber and the Tulip development Team
25  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
26  *
27  * Tulip is free software; you can redistribute it and/or modify
28  * it under the terms of the GNU Lesser General Public License
29  * as published by the Free Software Foundation, either version 3
30  * of the License, or (at your option) any later version.
31  *
32  * Tulip is distributed in the hope that it will be useful,
33  * but WITHOUT ANY WARRANTY; without even the implied warranty of
34  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
35  * See the GNU General Public License for more details.
36  *
37  */
38 
39 #ifndef PYTHONSHELLWIDGET_H_
40 #define PYTHONSHELLWIDGET_H_
41 
42 #include <QtCore/QVector>
43 
44 #include <tulip/PythonCodeEditor.h>
45 
46 class QKeyEvent;
47 
48 namespace tlp {
49 
50 class TLP_PYTHON_SCOPE PythonShellWidget : public PythonCodeEditor {
51 
52  Q_OBJECT
53 
54  QString _currentPs;
55  QString _currentCodeLines;
56 
57  QVector<QString> _history;
58  int _currentHistoryPos;
59 
60 public :
61 
62  explicit PythonShellWidget(QWidget *parent = 0);
63 
64 protected:
65 
66  void keyPressEvent(QKeyEvent * e);
67 
68  bool isCursorOnLastLine();
69 
70  void executeCurrentLines();
71 
72  void showEvent(QShowEvent * event);
73 
74 public slots:
75 
76  void insert(const QString &txt, const bool atEnd = false);
77 
78 protected slots:
79 
80  void updateAutoCompletionList(bool dotContext=false);
81 
82 };
83 
84 }
85 
86 #endif /* PYTHONSHELLWIDGET_H_ */