diff --git a/modules/gui/src/file_browser.cc b/modules/gui/src/file_browser.cc index ca7092684382517d25fdc7128b215e05f147ee4f..96f87677e44f8ac5fc23535110286ca0fb207ca2 100644 --- a/modules/gui/src/file_browser.cc +++ b/modules/gui/src/file_browser.cc @@ -112,7 +112,8 @@ void FileBrowser::Init(const QString& path) view_->setRootIndex(model_->index(path)); view_->setAttribute(Qt::WA_MacShowFocusRect, false); view_->setContextMenuPolicy(Qt::CustomContextMenu); - connect(view_,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(ShowContextMenu(const QPoint&))); + connect(view_,SIGNAL(customContextMenuRequested(const QPoint&)),this, + SLOT(ShowContextMenu(const QPoint&))); UpdateMenu(path); QVBoxLayout* l=new QVBoxLayout(this); diff --git a/modules/gui/src/file_loader.cc b/modules/gui/src/file_loader.cc index b013bdfdf39b894d673849c7062a1627ddff166e..2517e7909fab832081850a496d7e01f4f255117b 100644 --- a/modules/gui/src/file_loader.cc +++ b/modules/gui/src/file_loader.cc @@ -371,7 +371,8 @@ void FileLoader::RunScript(const QString& filename) pi.RunCommand("sys.argv.append('"+QFileInfo(filename).fileName()+"')"); pi.RunCommand("_dir=os.getcwd()"); pi.RunCommand("os.chdir('"+QFileInfo(filename).absolutePath()+"')"); - pi.RunCommand("execfile('"+QFileInfo(filename).fileName()+"')"); + pi.RunScript(QFileInfo(filename).fileName()); + //pi.RunCommand("execfile('"+QFileInfo(filename).fileName()+"')"); pi.RunCommand("os.chdir(_dir)"); pi.RunCommand("del(_dir)"); pi.RunCommand("sys.argv=_sys_argv_backup"); diff --git a/modules/gui/src/python_shell/python_interpreter_worker.cc b/modules/gui/src/python_shell/python_interpreter_worker.cc index 494df6c0bca61cd5b4a67791d55128c7d27a5ab9..b89859142642c21d4fc6f624b9727aa27d35dc81 100644 --- a/modules/gui/src/python_shell/python_interpreter_worker.cc +++ b/modules/gui/src/python_shell/python_interpreter_worker.cc @@ -32,7 +32,8 @@ PythonInterpreterWorker::PythonInterpreterWorker(): parse_expr_cmd_(), repr_(), main_namespace_(), - current_id_() + current_id_(), + awake_(false) { Py_InitializeEx(1); parse_expr_cmd_=bp::import("parser").attr("expr"); @@ -52,10 +53,14 @@ PythonInterpreterWorker::PythonInterpreterWorker(): void PythonInterpreterWorker::Wake() { + if (awake_) return; + + awake_=true; while (!exec_queue_.isEmpty()){ std::pair<unsigned int, QString> pair=exec_queue_.dequeue(); run_command_(pair); } + awake_=false; } unsigned int PythonInterpreterWorker::AddCommand(const QString& command) diff --git a/modules/gui/src/python_shell/python_interpreter_worker.hh b/modules/gui/src/python_shell/python_interpreter_worker.hh index 77295ca8612f5877555408774a41f1a945f56de9..7d38dd544b040c86a19106751bf4813fe165dd1f 100644 --- a/modules/gui/src/python_shell/python_interpreter_worker.hh +++ b/modules/gui/src/python_shell/python_interpreter_worker.hh @@ -46,6 +46,7 @@ protected: bp::object repr_; bp::dict main_namespace_; unsigned int current_id_; + bool awake_; }; }} //ns