Skip to content
Snippets Groups Projects
Commit 3381a06c authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Add a closed method to the Python environment in MantidPlot

This allows it to closer mimic a file-like object.
parent 0d87a244
No related branches found
No related tags found
No related merge requests found
...@@ -66,8 +66,10 @@ public: ...@@ -66,8 +66,10 @@ public:
// -------------------------- Print/error message handling ------------------ // -------------------------- Print/error message handling ------------------
/// Connects the python stdout to a Qt signal /// Connects the python stdout to a Qt signal
inline void write(const QString &text) { emit print(text); } inline void write(const QString &text) { emit print(text); }
/// 'Fake' method needed for IPython import /// Simulate file-like object (required for IPython)
inline void flush() {} inline void flush() {}
/// Simulate file-like object (required for colorama)
inline bool closed() { return false; }
/// Is the given code complete /// Is the given code complete
bool compilesToCompleteStatement(const QString & code) const; bool compilesToCompleteStatement(const QString & code) const;
......
...@@ -52,8 +52,10 @@ public: ...@@ -52,8 +52,10 @@ public:
~PythonScripting(); ~PythonScripting();
/// Write text to std out /// Write text to std out
void write(const QString &text) { emit print(text); } void write(const QString &text) { emit print(text); }
/// 'Fake' method needed for IPython import /// Simulate file-like object (required for IPython)
void flush() {} inline void flush() {}
/// Simulate file-like object (required for colorama)
inline bool closed() { return false; }
/// 'Fake' method needed for IPython import /// 'Fake' method needed for IPython import
void set_parent(PyObject*) {} void set_parent(PyObject*) {}
......
...@@ -1287,8 +1287,10 @@ class PythonScripting ...@@ -1287,8 +1287,10 @@ class PythonScripting
%End %End
public: public:
void write(const QString&); void write(const QString&);
// 'Fake' methods needed for IPython import // Simulate file-like object (required for IPython)
void flush(); void flush();
// Simulate file-like object (required for colorama)
bool closed();
void set_parent(SIP_PYOBJECT); void set_parent(SIP_PYOBJECT);
private: private:
PythonScripting(const PythonScripting&); PythonScripting(const PythonScripting&);
...@@ -1300,8 +1302,10 @@ class PythonScript ...@@ -1300,8 +1302,10 @@ class PythonScript
%End %End
public: public:
void write(const QString&); void write(const QString&);
// 'Fake' method needed for IPython import // Simulate file-like object (required for IPython)
void flush(); void flush();
// Simulate file-like object (required for colorama)
bool closed();
// Line number trace // Line number trace
void lineNumberChanged(SIP_PYOBJECT,int); void lineNumberChanged(SIP_PYOBJECT,int);
private: private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment