From b9a13f644213de9e25c70b900d985f3b22c02ed6 Mon Sep 17 00:00:00 2001 From: asv Date: Fri, 24 Dec 2004 13:26:26 +0000 Subject: [PATCH] An improvement for adding a library node: it will use addNode() function, so creation of a PythonEditPane and LibDlg must take Service::myX, myY as arguments for future modification (on Add node command). --- src/SUPERVGUI/SUPERVGUI_Service.cxx | 24 +++++++++++++----------- src/SUPERVGUI/SUPERVGUI_Service.h | 7 +++++-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/SUPERVGUI/SUPERVGUI_Service.cxx b/src/SUPERVGUI/SUPERVGUI_Service.cxx index 0a92e1a..ad7a195 100644 --- a/src/SUPERVGUI/SUPERVGUI_Service.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Service.cxx @@ -169,18 +169,18 @@ SUPERVGUI_Service::SUPERVGUI_Service(SALOME_NamingService* ns): myStackWidget = new QWidgetStack(aPythonPane); // other pane - myScriptPane = new SUPERVGUI_PythonEditPane( myStackWidget, true ); + myScriptPane = new SUPERVGUI_PythonEditPane( myStackWidget, true, myX, myY ); myOtherId = myStackWidget->addWidget(myScriptPane); // loop pane QTabWidget* aLoopTabPane = new QTabWidget(myStackWidget); - myInitPane = new SUPERVGUI_PythonEditPane( myStackWidget, true ); + myInitPane = new SUPERVGUI_PythonEditPane( myStackWidget, true, myX, myY ); aLoopTabPane->addTab(myInitPane, "Init"); - myMorePane = new SUPERVGUI_PythonEditPane( myStackWidget, true ); + myMorePane = new SUPERVGUI_PythonEditPane( myStackWidget, true, myX, myY ); aLoopTabPane->addTab(myMorePane, "More"); - myNextPane = new SUPERVGUI_PythonEditPane( myStackWidget, true ); + myNextPane = new SUPERVGUI_PythonEditPane( myStackWidget, true, myX, myY ); aLoopTabPane->addTab(myNextPane, "Next"); myLoopId = myStackWidget->addWidget(aLoopTabPane); @@ -652,9 +652,10 @@ void SUPERVGUI_Service::tabChanged(QWidget* theWidget) { //***************************************************** // Pane for Python script editing //***************************************************** -SUPERVGUI_PythonEditPane::SUPERVGUI_PythonEditPane( QWidget* theParent, const bool isNodeCreation ) +SUPERVGUI_PythonEditPane::SUPERVGUI_PythonEditPane( QWidget* theParent, const bool isNodeCreation, int& theX, int& theY ) : myIsWithLibrary( isNodeCreation ), - QFrame( theParent ) + QFrame( theParent ), + myX( theX ), myY( theY ) { QGridLayout* aEditLayout = new QGridLayout( this, 2, 8, 0, 6 ); @@ -881,7 +882,7 @@ void SUPERVGUI_PythonEditPane::autoIndentLine() { * This slot opens a dialog box which then "lives" by itself.. */ void SUPERVGUI_PythonEditPane::library() { - SUPERVGUI_LibDlg* aDlg = new SUPERVGUI_LibDlg( this ); + SUPERVGUI_LibDlg* aDlg = new SUPERVGUI_LibDlg( this, myX, myY ); aDlg->exec(); } @@ -895,20 +896,21 @@ SUPERVGUI_EditPythonDlg::SUPERVGUI_EditPythonDlg( bool isLoop ) setCaption(tr("TIT_FUNC_PYTHON")); resize( 500, 250 ); QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 4); + int a,b; // dummies for PythonEditPane, not used, since library = false and myX, myY are not used in PythonEditPane if (isLoop) { QTabWidget* aLoopTabPane = new QTabWidget(this); - myInitPane = new SUPERVGUI_PythonEditPane( this, false ); // library == false, since no creation of a node is needed here + myInitPane = new SUPERVGUI_PythonEditPane( this, false, a, b ); // library == false, since no creation of a node is needed here aLoopTabPane->addTab(myInitPane, "Init"); - myMorePane = new SUPERVGUI_PythonEditPane( this, false ); + myMorePane = new SUPERVGUI_PythonEditPane( this, false, a, b ); aLoopTabPane->addTab(myMorePane, "More"); - myNextPane = new SUPERVGUI_PythonEditPane( this, false ); + myNextPane = new SUPERVGUI_PythonEditPane( this, false, a, b ); aLoopTabPane->addTab(myNextPane, "Next"); aMainLayout->addWidget(aLoopTabPane); } else { - myEditPane = new SUPERVGUI_PythonEditPane( this, false ); + myEditPane = new SUPERVGUI_PythonEditPane( this, false, a, b ); aMainLayout->addWidget(myEditPane); } QGroupBox* aBtnBox = new QGroupBox( this ); diff --git a/src/SUPERVGUI/SUPERVGUI_Service.h b/src/SUPERVGUI/SUPERVGUI_Service.h index 0bba98c..1d9a557 100644 --- a/src/SUPERVGUI/SUPERVGUI_Service.h +++ b/src/SUPERVGUI/SUPERVGUI_Service.h @@ -44,7 +44,7 @@ class SUPERVGUI_PythonEditPane: public QFrame { Q_OBJECT public: - SUPERVGUI_PythonEditPane( QWidget* theParent, const bool isNodeCreation ); + SUPERVGUI_PythonEditPane( QWidget* theParent, const bool isNodeCreation, int& theX, int& theY ); ~SUPERVGUI_PythonEditPane() {}; QString getFuncName(); @@ -80,6 +80,9 @@ private: // in readFunction() QStringList myPyFunctions; + int& myX; // comes from SUPERVGUI_Service + int& myY; // comes from SUPERVGUI_Service + }; /*! @@ -120,7 +123,7 @@ private slots: void loadGraph(); private: - QListView* components; + QListView* components; SALOME_NamingService* naming; int myX, myY; QWidgetStack* myStackWidget; -- 2.39.2