From 31ac2284e014d6966f86ce46d8b409708b7e4b5c Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 10 Oct 2018 18:39:54 +0300 Subject: [PATCH] Transfer a command "Load Script" to Python console pop-up menu --- src/XGUI/XGUI_Workshop.cpp | 23 ----------------------- src/XGUI/XGUI_Workshop.h | 2 -- 2 files changed, 25 deletions(-) diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 8a73756f2..5418b3e25 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -498,11 +498,6 @@ void XGUI_Workshop::initMenu() aCommand->setChecked(ModelAPI_Session::get()->isAutoUpdateBlocked()); aCommand->connectTo(this, SLOT(onAutoApply(bool))); - - aCommand = aGroup->addFeature("EXEC_CMD", tr("Launch script"), tr("Launch Python script file"), - QIcon(":pictures/assembly.png"), QKeySequence()); - aCommand->connectTo(this, SLOT(onFileExec())); - aCommand = aGroup->addFeature("PREF_CMD", tr("Preferences"), tr("Edit preferences"), QIcon(":pictures/preferences.png"), QKeySequence::Preferences); aCommand->connectTo(this, SLOT(onPreferences())); @@ -2829,24 +2824,6 @@ void XGUI_Workshop::moveOutFolder(bool isBefore) updateCommandStatus(); } -#ifndef HAVE_SALOME -#include -void XGUI_Workshop::onFileExec() -{ - QString aScript = QFileDialog::getOpenFileName(myMainWindow, tr("Open script"), - QString(), "Python script (*.py)"); - - if (!aScript.isNull()) { - PyConsole_Console* aConsole = myMainWindow->pythonConsole(); - aConsole->execAndWait(QString("f = open('%1', 'rb')").arg(aScript)); - QString aExecStr = - QString("exec(compile(f.read(), '%1', 'exec'))").arg(aScript); - aConsole->execAndWait(aExecStr); - aConsole->execAndWait("f.close()"); - } -} -#endif - void XGUI_Workshop::onAutoApply(bool isToggle) { SessionPtr aMgr = ModelAPI_Session::get(); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 186d66eb8..b25938005 100755 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -393,8 +393,6 @@ signals: /// Open preferences dialog box void onPreferences(); - - void onFileExec(); #endif /// A slot calleon toggle of auto-compute button -- 2.39.2