\hypertarget{a09704}{}\section{Python\+Interpreter Class Reference}
\label{a09704}\index{Python\+Interpreter@{Python\+Interpreter}}


This class provides Open\+Flippers Python interpreter.  




{\ttfamily \#include $<$Open\+Flipper/\+Python\+Interpreter/\+Python\+Interpreter.\+hh$>$}

Inheritance diagram for Python\+Interpreter\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{a09704}
\end{center}
\end{figure}
\subsection*{Signals}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{a09704_ac25ad3dcd6f881a999d51e4db9deb935}\label{a09704_ac25ad3dcd6f881a999d51e4db9deb935}} 
void \hyperlink{a09704_ac25ad3dcd6f881a999d51e4db9deb935}{log} (\hyperlink{a00035_a595b2880f3ae74561ba390e3fd8c0e7c}{Logtype} \+\_\+type, Q\+String \+\_\+message)
\begin{DoxyCompactList}\small\item\em Log with O\+UT,W\+A\+RN or E\+RR as type. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
bool \hyperlink{a09704_a360aba89d85bb741bc09f33b6ceb6b52}{run\+Script} (Q\+String \+\_\+script)
\begin{DoxyCompactList}\small\item\em Run a script. Output is passed to the standard logging facilities of Open\+Flipper. \end{DoxyCompactList}\item 
Q\+String \hyperlink{a09704_a3976fea1a9b295547f2f85d29c547a19}{run\+Script\+Output} (Q\+String \+\_\+script)
\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \hyperlink{a09704}{Python\+Interpreter} $\ast$ \hyperlink{a09704_ac36db5db9fa5381871f8b007f5e2fe42}{get\+Instance} ()
\begin{DoxyCompactList}\small\item\em Creates or returns an instance of the interpreter. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{a09704_ac014169f0f768b7a43254143e7bc6822}{Python\+Interpreter} ()
\begin{DoxyCompactList}\small\item\em private constructor because of singleton \end{DoxyCompactList}\item 
void \hyperlink{a09704_a6585bd89796bb3835f32fa7491c0eee0}{init\+Python} ()
\begin{DoxyCompactList}\small\item\em Initialize Open\+Flipper Python Interpreter. \end{DoxyCompactList}\item 
void \hyperlink{a09704_aeeced5c4a4d1caa67bb7d7b37ffb7c5b}{reset\+Interpreter} ()
\begin{DoxyCompactList}\small\item\em Resets the interpreter and all states. \end{DoxyCompactList}\item 
bool \hyperlink{a09704_ababf4003d95c6328338d08f415a71f17}{modules\+Initialized} ()
\item 
void \hyperlink{a09704_a2bb324516c0be3c03c00ea70c932915d}{py\+Output} (const char $\ast$w)
\begin{DoxyCompactList}\small\item\em Callback to redirect cout log to Open\+Flipper logger. \end{DoxyCompactList}\item 
void \hyperlink{a09704_aae714ffb90c905fae62affe56c691144}{py\+Error} (const char $\ast$w)
\begin{DoxyCompactList}\small\item\em Callback to redirect cerr log to Open\+Flipper logger. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{a09704_a21ead9a2d8d358ef9040f1f90394bc3c}\label{a09704_a21ead9a2d8d358ef9040f1f90394bc3c}} 
bool {\bfseries external\+Logging\+\_\+}
\item 
\mbox{\Hypertarget{a09704_a00145c28a6217001be7e2abf5151fe18}\label{a09704_a00145c28a6217001be7e2abf5151fe18}} 
Q\+String {\bfseries Log\+Err}
\item 
\mbox{\Hypertarget{a09704_ad1d8800c098ac473bd3977cf8dd1e99f}\label{a09704_ad1d8800c098ac473bd3977cf8dd1e99f}} 
Q\+String {\bfseries Log\+Out}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
This class provides Open\+Flippers Python interpreter. 



Definition at line 49 of file Python\+Interpreter.\+hh.



\subsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{a09704_ac014169f0f768b7a43254143e7bc6822}\label{a09704_ac014169f0f768b7a43254143e7bc6822}} 
\index{Python\+Interpreter@{Python\+Interpreter}!Python\+Interpreter@{Python\+Interpreter}}
\index{Python\+Interpreter@{Python\+Interpreter}!Python\+Interpreter@{Python\+Interpreter}}
\subsubsection{\texorpdfstring{Python\+Interpreter()}{PythonInterpreter()}}
{\footnotesize\ttfamily Python\+Interpreter\+::\+Python\+Interpreter (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



private constructor because of singleton 



Definition at line 89 of file Python\+Interpreter.\+cc.



\subsection{Member Function Documentation}
\mbox{\Hypertarget{a09704_ac36db5db9fa5381871f8b007f5e2fe42}\label{a09704_ac36db5db9fa5381871f8b007f5e2fe42}} 
\index{Python\+Interpreter@{Python\+Interpreter}!get\+Instance@{get\+Instance}}
\index{get\+Instance@{get\+Instance}!Python\+Interpreter@{Python\+Interpreter}}
\subsubsection{\texorpdfstring{get\+Instance()}{getInstance()}}
{\footnotesize\ttfamily \hyperlink{a09704}{Python\+Interpreter} $\ast$ Python\+Interpreter\+::get\+Instance (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Creates or returns an instance of the interpreter. 

There will only be one instance of the \hyperlink{a09704}{Python\+Interpreter} to ensure that we only run one context.

\begin{DoxyReturn}{Returns}

\end{DoxyReturn}


Definition at line 78 of file Python\+Interpreter.\+cc.

\mbox{\Hypertarget{a09704_a6585bd89796bb3835f32fa7491c0eee0}\label{a09704_a6585bd89796bb3835f32fa7491c0eee0}} 
\index{Python\+Interpreter@{Python\+Interpreter}!init\+Python@{init\+Python}}
\index{init\+Python@{init\+Python}!Python\+Interpreter@{Python\+Interpreter}}
\subsubsection{\texorpdfstring{init\+Python()}{initPython()}}
{\footnotesize\ttfamily void Python\+Interpreter\+::init\+Python (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Initialize Open\+Flipper Python Interpreter. 



Definition at line 104 of file Python\+Interpreter.\+cc.

\mbox{\Hypertarget{a09704_ababf4003d95c6328338d08f415a71f17}\label{a09704_ababf4003d95c6328338d08f415a71f17}} 
\index{Python\+Interpreter@{Python\+Interpreter}!modules\+Initialized@{modules\+Initialized}}
\index{modules\+Initialized@{modules\+Initialized}!Python\+Interpreter@{Python\+Interpreter}}
\subsubsection{\texorpdfstring{modules\+Initialized()}{modulesInitialized()}}
{\footnotesize\ttfamily bool Python\+Interpreter\+::modules\+Initialized (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}

\+: Why does this work? 

Definition at line 99 of file Python\+Interpreter.\+cc.

\mbox{\Hypertarget{a09704_aae714ffb90c905fae62affe56c691144}\label{a09704_aae714ffb90c905fae62affe56c691144}} 
\index{Python\+Interpreter@{Python\+Interpreter}!py\+Error@{py\+Error}}
\index{py\+Error@{py\+Error}!Python\+Interpreter@{Python\+Interpreter}}
\subsubsection{\texorpdfstring{py\+Error()}{pyError()}}
{\footnotesize\ttfamily void Python\+Interpreter\+::py\+Error (\begin{DoxyParamCaption}\item[{const char $\ast$}]{w }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Callback to redirect cerr log to Open\+Flipper logger. 


\begin{DoxyParams}{Parameters}
{\em w} & Log string \\
\hline
\end{DoxyParams}


Definition at line 330 of file Python\+Interpreter.\+cc.

\mbox{\Hypertarget{a09704_a2bb324516c0be3c03c00ea70c932915d}\label{a09704_a2bb324516c0be3c03c00ea70c932915d}} 
\index{Python\+Interpreter@{Python\+Interpreter}!py\+Output@{py\+Output}}
\index{py\+Output@{py\+Output}!Python\+Interpreter@{Python\+Interpreter}}
\subsubsection{\texorpdfstring{py\+Output()}{pyOutput()}}
{\footnotesize\ttfamily void Python\+Interpreter\+::py\+Output (\begin{DoxyParamCaption}\item[{const char $\ast$}]{w }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Callback to redirect cout log to Open\+Flipper logger. 


\begin{DoxyParams}{Parameters}
{\em w} & Log string \\
\hline
\end{DoxyParams}


Definition at line 320 of file Python\+Interpreter.\+cc.

\mbox{\Hypertarget{a09704_aeeced5c4a4d1caa67bb7d7b37ffb7c5b}\label{a09704_aeeced5c4a4d1caa67bb7d7b37ffb7c5b}} 
\index{Python\+Interpreter@{Python\+Interpreter}!reset\+Interpreter@{reset\+Interpreter}}
\index{reset\+Interpreter@{reset\+Interpreter}!Python\+Interpreter@{Python\+Interpreter}}
\subsubsection{\texorpdfstring{reset\+Interpreter()}{resetInterpreter()}}
{\footnotesize\ttfamily void Python\+Interpreter\+::reset\+Interpreter (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Resets the interpreter and all states. 



Definition at line 220 of file Python\+Interpreter.\+cc.

\mbox{\Hypertarget{a09704_a360aba89d85bb741bc09f33b6ceb6b52}\label{a09704_a360aba89d85bb741bc09f33b6ceb6b52}} 
\index{Python\+Interpreter@{Python\+Interpreter}!run\+Script@{run\+Script}}
\index{run\+Script@{run\+Script}!Python\+Interpreter@{Python\+Interpreter}}
\subsubsection{\texorpdfstring{run\+Script()}{runScript()}}
{\footnotesize\ttfamily bool Python\+Interpreter\+::run\+Script (\begin{DoxyParamCaption}\item[{Q\+String}]{\+\_\+script }\end{DoxyParamCaption})}



Run a script. Output is passed to the standard logging facilities of Open\+Flipper. 


\begin{DoxyParams}{Parameters}
{\em \+\_\+script} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\end{DoxyReturn}


Definition at line 233 of file Python\+Interpreter.\+cc.

\mbox{\Hypertarget{a09704_a3976fea1a9b295547f2f85d29c547a19}\label{a09704_a3976fea1a9b295547f2f85d29c547a19}} 
\index{Python\+Interpreter@{Python\+Interpreter}!run\+Script\+Output@{run\+Script\+Output}}
\index{run\+Script\+Output@{run\+Script\+Output}!Python\+Interpreter@{Python\+Interpreter}}
\subsubsection{\texorpdfstring{run\+Script\+Output()}{runScriptOutput()}}
{\footnotesize\ttfamily Q\+String Python\+Interpreter\+::run\+Script\+Output (\begin{DoxyParamCaption}\item[{Q\+String}]{\+\_\+script }\end{DoxyParamCaption})}

\textbackslash{} brief run a script and return the output as a Q\+String


\begin{DoxyParams}{Parameters}
{\em \+\_\+script} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\end{DoxyReturn}


Definition at line 309 of file Python\+Interpreter.\+cc.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
Open\+Flipper/\+Python\+Interpreter/Python\+Interpreter.\+hh\item 
Open\+Flipper/\+Python\+Interpreter/Python\+Interpreter.\+cc\end{DoxyCompactItemize}
