From: vsr Date: Mon, 4 Oct 2010 12:56:08 +0000 (+0000) Subject: Merge from BR_WIN_INDUS_514 04/10/2010 X-Git-Tag: V5_1_5a1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8f7f65621aaf113fef856f1d49a4242d98fcf006;p=modules%2Fgui.git Merge from BR_WIN_INDUS_514 04/10/2010 --- diff --git a/src/LightApp/LightApp_SelectionMgr.cxx b/src/LightApp/LightApp_SelectionMgr.cxx index 397cfaebc..a7b9b17d2 100644 --- a/src/LightApp/LightApp_SelectionMgr.cxx +++ b/src/LightApp/LightApp_SelectionMgr.cxx @@ -176,7 +176,7 @@ void LightApp_SelectionMgr::selectionChanged( SUIT_Selector* theSel ) /*! get map of indexes for the given SALOME_InteractiveObject */ -void LightApp_SelectionMgr::GetIndexes( const Handle(SALOME_InteractiveObject)& IObject, +void LightApp_SelectionMgr::GetIndexes( const Handle(SALOME_InteractiveObject)& IObject, TColStd_IndexedMapOfInteger& theIndex) { theIndex.Clear(); @@ -186,12 +186,10 @@ void LightApp_SelectionMgr::GetIndexes( const Handle(SALOME_InteractiveObject)& for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) { - const LightApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); - if ( subOwner ) - if ( subOwner->entry() == QString(IObject->getEntry()) ) - theIndex.Add( subOwner->index() ); + LightApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); + if ( subOwner && subOwner->entry() == QString(IObject->getEntry()) ) + theIndex.Add( subOwner->index() ); } - } /*! @@ -223,12 +221,12 @@ void LightApp_SelectionMgr::AddOrRemoveIndex( const Handle(SALOME_InteractiveObj bool modeShift) { SUIT_DataOwnerPtrList remainsOwners; - + SUIT_DataOwnerPtrList aList; selected( aList ); - + QString ioEntry (IObject->getEntry()); - + if ( !modeShift ) { for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) { @@ -253,7 +251,7 @@ void LightApp_SelectionMgr::AddOrRemoveIndex( const Handle(SALOME_InteractiveObj It.Initialize(theIndexes); for(;It.More();It.Next()) remainsOwners.append( new LightApp_DataSubOwner( ioEntry, It.Key() ) ); - + bool append = false; setSelected( remainsOwners, append ); @@ -268,7 +266,7 @@ void LightApp_SelectionMgr::AddOrRemoveIndex( const Handle(SALOME_InteractiveObj /*! select 'subobjects' with given indexes */ -void LightApp_SelectionMgr::selectObjects( const Handle(SALOME_InteractiveObject)& IObject, +void LightApp_SelectionMgr::selectObjects( const Handle(SALOME_InteractiveObject)& IObject, TColStd_IndexedMapOfInteger theIndex, bool append ) { SUIT_DataOwnerPtrList aList; @@ -294,7 +292,7 @@ void LightApp_SelectionMgr::selectObjects( MapIOOfMapOfInteger theMapIO, bool ap SUIT_DataOwnerPtrList aList; MapIOOfMapOfInteger::Iterator it(theMapIO); - for ( ; it.More(); it.Next() ) + for ( ; it.More(); it.Next() ) { if ( it.Value().IsEmpty() ) aList.append( new LightApp_DataOwner( QString(it.Key()->getEntry()) ) ); @@ -305,7 +303,7 @@ void LightApp_SelectionMgr::selectObjects( MapIOOfMapOfInteger theMapIO, bool ap aList.append( new LightApp_DataSubOwner( QString(it.Key()->getEntry()), it.Value()( i ) ) ); } } - + setSelected( aList, append ); } @@ -326,13 +324,13 @@ void LightApp_SelectionMgr::selectedSubOwners( MapEntryOfMapOfInteger& theMap ) { const LightApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); - if ( subOwner ) + if ( subOwner ) { -#ifndef WNT +//#ifndef WNT if ( !theMap.IsBound( TCollection_AsciiString(subOwner->entry().toLatin1().data()) ) ) -#else - if ( !theMap.IsBound( subOwner->entry().toLatin1().data() ) ) -#endif +//#else +// if ( !theMap.IsBound( subOwner->entry().toLatin1().data() ) ) +//#endif { anIndexes.Clear(); //Bug 17269: GetIndexes( subOwner->entry(), anIndexes ); diff --git a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx index 574e7de73..95a4a96da 100755 --- a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx +++ b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx @@ -181,25 +181,38 @@ viewAspect OCCViewer_CreateRestoreViewDlg::currentItem() const */ void OCCViewer_CreateRestoreViewDlg::deleteSelectedItems() { - if( myListBox->count() ) + QList selectedItems = myListBox->selectedItems(); + if( myListBox->count() && selectedItems.count()) { int curIndex = -1; - for( int i = 0; i < (int)myListBox->count(); i++ ) - if( myListBox->item( i )->isSelected() && ( myListBox->item( i )->flags() & Qt::ItemIsEditable ) ) + // Iterate by all selected items + for(int i = 0; i < selectedItems.count(); i++) + { + QListWidgetItem* item = selectedItems.at(i); + // get position of the selected item in the list + int position = myListBox->row(item); + + //Calculate current index in case if "item" is last selected item. + if(i == selectedItems.count() - 1) { - QListWidgetItem* anItemToDelete = myListBox->takeItem( i ); - delete anItemToDelete; - for( int j = i; j < (int)myParametersMap.count(); j++ ) - if( j != myParametersMap.count() - 1 ) - myParametersMap[ j ] = myParametersMap[ j + 1 ]; - else - myParametersMap.removeAt( j ); - if( i != myListBox->count() ) - curIndex = i; - else - curIndex = i - 1; - i--; + if(position != myListBox->count() - 1) + curIndex = position; + else + curIndex = position - 1; } + + //Delete item + delete item; + + //Shift parameters in the map + for( int j = position; j < (int)myParametersMap.count(); j++ ) + { + if( j != myParametersMap.count() - 1 ) + myParametersMap[ j ] = myParametersMap[ j + 1 ]; + else + myParametersMap.removeAt( j ); + } + } if( curIndex >= 0 ) { myListBox->setCurrentItem( myListBox->item( curIndex ) ); @@ -208,8 +221,7 @@ void OCCViewer_CreateRestoreViewDlg::deleteSelectedItems() } if( !myListBox->count() ) { - myListBox->clear(); - myListBox->insertItem( 0, "No Items" ); + clearList(); } } @@ -220,8 +232,10 @@ void OCCViewer_CreateRestoreViewDlg::clearList() { myListBox->clear(); myListBox->insertItem( 0, "No Items" ); - myParametersMap.clear(); + + //Clear view + myCurViewPort->reset(); } /*! diff --git a/src/PyConsole/PyConsole_Console.cxx b/src/PyConsole/PyConsole_Console.cxx index bae645157..4abd2af8e 100644 --- a/src/PyConsole/PyConsole_Console.cxx +++ b/src/PyConsole/PyConsole_Console.cxx @@ -128,6 +128,30 @@ void PyConsole_Console::setIsSync( const bool on ) myEditor->setIsSync( on ); } +/*! + \brief Get suppress output flag value. + + \sa setIsSuppressOutput() + \return True if python console output is suppressed. +*/ +bool PyConsole_Console::isSuppressOutput() const +{ + return myEditor->isSuppressOutput(); +} + +/*! + \brief Set suppress output flag value. + + In case if suppress output flag is true, the python + console output suppressed. + + \param on suppress output flag +*/ +void PyConsole_Console::setIsSuppressOutput( const bool on ) +{ + myEditor->setIsSuppressOutput(on); +} + /*! \brief Change the python console's font. \param f new font diff --git a/src/PyConsole/PyConsole_Console.h b/src/PyConsole/PyConsole_Console.h index 0666396fc..8833039fb 100644 --- a/src/PyConsole/PyConsole_Console.h +++ b/src/PyConsole/PyConsole_Console.h @@ -63,6 +63,10 @@ public: bool isSync() const; void setIsSync( const bool ); + bool isSuppressOutput() const; + void setIsSuppressOutput( const bool ); + + void exec( const QString& ); void execAndWait( const QString& ); diff --git a/src/PyConsole/PyConsole_Editor.cxx b/src/PyConsole/PyConsole_Editor.cxx index c622c66a8..54496b36f 100644 --- a/src/PyConsole/PyConsole_Editor.cxx +++ b/src/PyConsole/PyConsole_Editor.cxx @@ -226,7 +226,8 @@ private: void staticCallback( void* data, char* c ) { - QApplication::postEvent( (PyConsole_Editor*)data, new PrintEvent( c ) ); + if(!((PyConsole_Editor*)data)->isSuppressOutput()) + QApplication::postEvent( (PyConsole_Editor*)data, new PrintEvent( c ) ); } /*! @@ -242,7 +243,8 @@ PyConsole_Editor::PyConsole_Editor( PyConsole_Interp* theInterp, myInterp( 0 ), myCmdInHistory( -1 ), myEventLoop( 0 ), - myIsSync( false ) + myIsSync( false ), + myIsSuppressOutput(false) { QString fntSet( "" ); QFont aFont = SUIT_Tools::stringToFont( fntSet ); @@ -296,6 +298,30 @@ void PyConsole_Editor::setIsSync( const bool on ) myIsSync = on; } +/*! + \brief Get suppress output flag value. + + \sa setIsSuppressOutput() + \return True if python console output is suppressed. +*/ +bool PyConsole_Editor::isSuppressOutput() const +{ + return myIsSuppressOutput; +} + +/*! + \brief Set suppress output flag value. + + In case if suppress output flag is true, the python + console output suppressed. + + \param on suppress output flag +*/ +void PyConsole_Editor::setIsSuppressOutput( const bool on ) +{ + myIsSuppressOutput = on; +} + /*! \brief Put the string \a str to the python editor. \param str string to be put in the command line of the editor diff --git a/src/PyConsole/PyConsole_Editor.h b/src/PyConsole/PyConsole_Editor.h index ae381467c..6f8eba127 100644 --- a/src/PyConsole/PyConsole_Editor.h +++ b/src/PyConsole/PyConsole_Editor.h @@ -52,6 +52,9 @@ public: bool isSync() const; void setIsSync( const bool ); + bool isSuppressOutput() const; + void setIsSuppressOutput(const bool); + protected: virtual void dropEvent( QDropEvent* event ); virtual void mouseReleaseEvent( QMouseEvent* event ); @@ -80,6 +83,7 @@ private: QString myBanner; //!< current banner QStringList myQueue; //!< python commands queue bool myIsSync; //!< synchronous mode flag + bool myIsSuppressOutput; //!< suppress output flag }; #endif // PYCONSOLE_EDITOR_H diff --git a/src/Qtx/QtxMainWindow.cxx b/src/Qtx/QtxMainWindow.cxx index 75abd996f..d3cb76621 100644 --- a/src/Qtx/QtxMainWindow.cxx +++ b/src/Qtx/QtxMainWindow.cxx @@ -110,6 +110,9 @@ QtxMainWindow::QtxMainWindow( QWidget* parent, Qt::WindowFlags f ) myMenuBar( 0 ), myStatusBar( 0 ) { + //rnv: Enables tooltips for inactive windows. + //rnv: For details see http://bugtracker.opencascade.com/show_bug.cgi?id=20893 + setAttribute(Qt::WA_AlwaysShowToolTips); } /*! diff --git a/src/SUIT/SUIT_SelectionMgr.cxx b/src/SUIT/SUIT_SelectionMgr.cxx index 042631603..5ab6c9b9d 100755 --- a/src/SUIT/SUIT_SelectionMgr.cxx +++ b/src/SUIT/SUIT_SelectionMgr.cxx @@ -96,6 +96,8 @@ void SUIT_SelectionMgr::selected( SUIT_DataOwnerPtrList& lst, const QString& typ for ( SelectorList::const_iterator it = mySelectors.begin(); it != mySelectors.end(); ++it ) { + if ( !(*it)->isEnabled() ) + continue; if ( !type.isEmpty() && (*it)->type() != type ) continue; diff --git a/src/SalomeApp/SalomeApp_NoteBookDlg.cxx b/src/SalomeApp/SalomeApp_NoteBookDlg.cxx index 061976175..9ab2640d2 100644 --- a/src/SalomeApp/SalomeApp_NoteBookDlg.cxx +++ b/src/SalomeApp/SalomeApp_NoteBookDlg.cxx @@ -301,7 +301,12 @@ bool NoteBook_TableRow::IsValidStringValue(const QString theValue) command += "\", "; } command += ") "; + + //rnv: fix for bug 21947 WinTC5.1.4: Wrong error management of "Salome NoteBook" + bool oldSuppressValue = pyConsole->isSuppressOutput(); + pyConsole->setIsSuppressOutput(true); bool aResult = pyInterp->run(command.c_str()); + pyConsole->setIsSuppressOutput(oldSuppressValue); return !aResult; } @@ -472,7 +477,13 @@ bool NoteBook_Table::IsValid() const command += "\","; } command += ")"; + + //rnv: fix for bug 21947 WinTC5.1.4: Wrong error management of "Salome NoteBook" + bool oldSuppressValue = pyConsole->isSuppressOutput(); + pyConsole->setIsSuppressOutput(true); bool aResult = pyInterp->run(command.c_str()); + pyConsole->setIsSuppressOutput(oldSuppressValue); + return !aResult; } @@ -481,7 +492,7 @@ bool NoteBook_Table::IsValid() const * Purpose : renumber row items */ //============================================================================ -void NoteBook_Table::RenamberRowItems(){ +void NoteBook_Table::RenamberRowItems() { for(int i=0; iGetHeaderItem()->setText(QString::number(i+1)); }