Skip to content
Snippets Groups Projects
Commit 2b52357b authored by Valerio Mariani's avatar Valerio Mariani
Browse files

Added stop script command

For debugging purposes
parent f4caabf1
Branches
Tags
No related merge requests found
......@@ -79,6 +79,7 @@ void export_Gosty()
.def("Instance", &GostyApp::Instance,
return_value_policy<reference_existing_object>()).staticmethod("Instance")
.def("SetAppTitle", &GostyApp::SetAppTitle)
.def("StopScript",&GostyApp::StopScript)
.def("GetPyShell", &GostyApp::GetPyShell,
return_value_policy<reference_existing_object>())
.add_property("py_shell", make_function(&GostyApp::GetPyShell,
......
......@@ -25,6 +25,7 @@
#include <ost/gui/tools/tool_options_win.hh>
#include <ost/gui/perspective.hh>
#include <ost/gui/main_area.hh>
#include <ost/gui/python_shell/python_interpreter.hh>
#include <QApplication>
......@@ -118,6 +119,13 @@ PythonShell* GostyApp::GetPyShell()
return py_shell_;
}
void GostyApp::StopScript()
{
PythonInterpreter::Instance().StopScript();
}
GLWin* GostyApp::GetGLWin()
{
if (gl_win_==NULL) {
......
......@@ -105,6 +105,11 @@ public:
/// All subsequent calls will return the same MessageWidget instance.
MessageWidget* GetMessageWidget();
/// \brief stop script execution
///
/// Stops the execution of the script.
void StopScript();
#if OST_IMG_ENABLED
/// \brief create new DataViewer
///
......
......@@ -83,6 +83,10 @@ void PythonInterpreter::Start()
emit WakeWorker();
}
void PythonInterpreter::StopScript()
{
PyErr_SetInterrupt();
}
unsigned int PythonInterpreter::RunScript(const QString& fname)
......
......@@ -82,6 +82,9 @@ public:
///
/// \sa Stop
void Start();
/// \brief stop script execution
void StopScript();
public slots:
......
......@@ -138,6 +138,10 @@ def _SplitIDSel(name):
return name[:pos], name[pos+1:-1]
return name, ''
def stop():
gui.GostyApp.Instance().StopScript()
loading_list=[]
script_argv=[]
images=[]
......
......@@ -10,6 +10,9 @@ def show_help(option, opt, value, parser):
def interactive_flag(option, opt, value, parser):
pass
def stop():
sys.exit(0)
usage = 'usage: ost [ost options] [script to execute] [script parameters]'
class OstOptionParser(optparse.OptionParser):
def __init__(self, **kwargs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment