]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Transfer a command "Load Script" to Python console pop-up menu
authorvsv <vsv@opencascade.com>
Wed, 10 Oct 2018 15:39:54 +0000 (18:39 +0300)
committervsv <vsv@opencascade.com>
Wed, 10 Oct 2018 15:39:54 +0000 (18:39 +0300)
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index 8a73756f2b9bb5c0ebfa7c2f1b3dd2d71145c642..5418b3e25c4d525a1eb09d5d93cbc211d96ffa53 100755 (executable)
@@ -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 <PyConsole_Console.h>
-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();
index 186d66eb8d86d5403612bf64ecae0c683159a4b9..b25938005a21f9ef06f57dd2fdaf6f83407eab23 100755 (executable)
@@ -393,8 +393,6 @@ signals:
 
   /// Open preferences dialog box
   void onPreferences();
-
-  void onFileExec();
 #endif
 
   /// A slot calleon toggle of auto-compute button