Tulip  6.0.0
Large graphs analysis and drawing
PythonIDEInterface.h
1 /*
2  *
3  * This file is part of Tulip (https://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
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 ///@cond DOXYGEN_HIDDEN
21 #ifndef PYTHONIDEINTERFACE_H
22 #define PYTHONIDEINTERFACE_H
23 
24 #include <QString>
25 #include <QStringList>
26 #include <QFrame>
27 
28 #include <tulip/tulipconf.h>
29 
30 namespace tlp {
31 class GraphHierarchiesModel;
32 class TulipProject;
33 
34 // this class defines the interface between the Graph Perspective
35 // and the Python IDE
36 class TLP_QT_SCOPE PythonIDEInterface : public QFrame {
37 public:
38  static QString compiledVersion(bool full = false);
39 #ifdef WIN32
40  static QString getPythonHome();
41 #endif
42 
43  virtual ~PythonIDEInterface() {}
44 
45  virtual bool projectNeedsPythonIDE(TulipProject *project) = 0;
46  virtual bool hasUnsavedFiles() = 0;
47  virtual void readProject(tlp::TulipProject *project) = 0;
48  virtual void clearPythonCodeEditors() = 0;
49  virtual bool isCurrentScriptExecuting() = 0;
50  virtual void executeCurrentScript() = 0;
51  virtual void stopCurrentScript() = 0;
52  virtual void pauseCurrentScript() = 0;
53  virtual void deleteStaticResources() = 0;
54 
55  // this class is used to really create a Python IDE
56  // it must be derived in the tulip-python library
57  // to ensure a usable PythonIDE exists
58  class TLP_QT_SCOPE Builder {
59  friend PythonIDEInterface;
60 
61  public:
62  Builder();
63 
64  protected:
65  virtual PythonIDEInterface *newIDE(GraphHierarchiesModel *model) = 0;
66  virtual void loadPlugins() = 0;
67  };
68 
69  // indicates if a Python IDE can be build
70  static bool exists();
71  // build a PythonIDE
72  static PythonIDEInterface *newIDE(GraphHierarchiesModel *model);
73  // ensure python plugins loading before Python IDE instantiation
74  static void loadPlugins();
75 };
76 
77 } // namespace tlp
78 
79 #endif // PYTHONIDEINTERFACE_H
80 ///@endcond