"Load Script" moved from Geometry module to menu File(so, now it is accessible from all modules).
<menu-item label-id="Tools" item-id="5" pos-id="">
<separator pos-id=""/>
<popup-item item-id="5103" pos-id="" label-id="Check Geometry" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="5104" pos-id="" label-id="Load Script" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ********************************* Settings (menubar) ********************************* -->
<menu-item label-id="Outils" item-id="5" pos-id="">
<separator pos-id=""/>
<popup-item item-id="5103" pos-id="" label-id="Check Géométrie" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="5104" pos-id="" label-id="Charger Script" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ********************************* Settings (menubar) ********************************* -->
msgid "GEOM_MEN_IMPORT"
msgstr "Import"
-#: GeometryGUI.cxx:3763
-msgid "GEOM_MEN_LOAD_SCRIPT"
-msgstr "PYTHON Files ( *.py )"
-
#: GeometryGUI.cxx:2931
msgid "GEOM_MEN_ISOS"
msgstr "Select Number Of Isos"
msgid "STB_CHECK_GEOMETRY"
msgstr "Check Geometry"
-msgid "TOP_LOAD_SCRIPT"
-msgstr "Load script"
-
-msgid "MEN_LOAD_SCRIPT"
-msgstr "Load script"
-
-msgid "STB_LOAD_SCRIPT"
-msgstr "Load script"
-
msgid "MEN_PREFERENCES"
msgstr "Preferences"
id == 413 || // MENU SETTINGS - ISOS
id == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES
id == 5103 || // MENU TOOLS - CHECK GEOMETRY
- id == 5104 || // MENU TOOLS - LOAD SCRIPT
id == 8032 || // POPUP VIEWER - COLOR
id == 8033 || // POPUP VIEWER - TRANSPARENCY
id == 8034 || // POPUP VIEWER - ISOS
createGeomAction( 7072, "CHECK_COMPOUND" );
createGeomAction( 5103, "CHECK_GEOMETRY" );
- createGeomAction( 5104, "LOAD_SCRIPT" );
-
+
createGeomAction( 412, "SHADING_COLOR" );
createGeomAction( 413, "ISOS" );
createGeomAction( 414, "STEP_VALUE" );
int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 10 );
createMenu( separator(), toolsId, -1 );
createMenu( 5103, toolsId, -1 );
- createMenu( 5104, toolsId, -1 );
-
+
int prefId = createMenu( tr( "MEN_PREFERENCES" ), -1, -1, 10 );
createMenu( separator(), prefId, -1 );
OnCheckGeometry();
break;
}
- case 5104: // LOAD SCRIPT
- {
- OnLoadScript();
- break;
- }
case 8032: // COLOR - POPUP VIEWER
{
OnColor();
void OnSettingsStep();
void OnRename();
void OnCheckGeometry();
- void OnLoadScript();
// Popup commands
void OnColor();
// Module : GEOM
// $Header$
+#include <PythonConsole_PyConsole.h>
+
#include "GEOMToolsGUI.h"
#include "GeometryGUI.h"
#include "GEOM_Actor.h"
void GEOMToolsGUI::OnCheckGeometry()
{
-/*
- QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor();
- PyEditor->setText("from GEOM_usinggeom import *\n");
- PyEditor->handleReturn();
-*/
-}
-
-void GEOMToolsGUI::OnLoadScript()
-{
-/*
- _PTR(Study) aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties())->IsLocked();
- if ( aLocked ) {
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
- return;
- }
-
- QStringList filtersList;
- filtersList.append(tr("GEOM_MEN_LOAD_SCRIPT"));
- filtersList.append(tr("GEOM_MEN_ALL_FILES"));
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ PythonConsole* pyConsole = app->pythonConsole();
- QString aFile = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), "", filtersList, tr("GEOM_MEN_IMPORT"), true);
- if(!aFile.isEmpty()) {
- QFileInfo file = aFile;
- QApplication::setOverrideCursor(Qt::waitCursor);
- QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor();
-
- QStringList aTextList = QStringList::split(".", file.fileName());
-
- PyEditor->setText("import geompy; geompy.addPath('" + file.dirPath() + "'); from " + aTextList.first() + " import *\n" );
- PyEditor->handleReturn();
- }
- QApplication::restoreOverrideCursor();
-*/
+ if(pyConsole)
+ pyConsole->exec("from GEOM_usinggeom import *");
}
void GEOMToolsGUI::OnColor()