/*!
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();
for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr )
{
- const LightApp_DataSubOwner* subOwner = dynamic_cast<const LightApp_DataSubOwner*>( (*itr).operator->() );
- if ( subOwner )
- if ( subOwner->entry() == QString(IObject->getEntry()) )
- theIndex.Add( subOwner->index() );
+ LightApp_DataSubOwner* subOwner = dynamic_cast<LightApp_DataSubOwner*>( (*itr).operator->() );
+ if ( subOwner && subOwner->entry() == QString(IObject->getEntry()) )
+ theIndex.Add( subOwner->index() );
}
-
}
/*!
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 )
{
It.Initialize(theIndexes);
for(;It.More();It.Next())
remainsOwners.append( new LightApp_DataSubOwner( ioEntry, It.Key() ) );
-
+
bool append = false;
setSelected( remainsOwners, append );
/*!
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;
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()) ) );
aList.append( new LightApp_DataSubOwner( QString(it.Key()->getEntry()), it.Value()( i ) ) );
}
}
-
+
setSelected( aList, append );
}
{
const LightApp_DataSubOwner* subOwner =
dynamic_cast<const LightApp_DataSubOwner*>( (*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 );
*/
void OCCViewer_CreateRestoreViewDlg::deleteSelectedItems()
{
- if( myListBox->count() )
+ QList<QListWidgetItem*> 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 ) );
}
if( !myListBox->count() )
{
- myListBox->clear();
- myListBox->insertItem( 0, "No Items" );
+ clearList();
}
}
{
myListBox->clear();
myListBox->insertItem( 0, "No Items" );
-
myParametersMap.clear();
+
+ //Clear view
+ myCurViewPort->reset();
}
/*!
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
bool isSync() const;
void setIsSync( const bool );
+ bool isSuppressOutput() const;
+ void setIsSuppressOutput( const bool );
+
+
void exec( const QString& );
void execAndWait( const QString& );
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 ) );
}
/*!
myInterp( 0 ),
myCmdInHistory( -1 ),
myEventLoop( 0 ),
- myIsSync( false )
+ myIsSync( false ),
+ myIsSuppressOutput(false)
{
QString fntSet( "" );
QFont aFont = SUIT_Tools::stringToFont( fntSet );
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
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 );
QString myBanner; //!< current banner
QStringList myQueue; //!< python commands queue
bool myIsSync; //!< synchronous mode flag
+ bool myIsSuppressOutput; //!< suppress output flag
};
#endif // PYCONSOLE_EDITOR_H
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);
}
/*!
for ( SelectorList::const_iterator it = mySelectors.begin(); it != mySelectors.end(); ++it )
{
+ if ( !(*it)->isEnabled() )
+ continue;
if ( !type.isEmpty() && (*it)->type() != type )
continue;
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;
}
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;
}
* Purpose : renumber row items
*/
//============================================================================
-void NoteBook_Table::RenamberRowItems(){
+void NoteBook_Table::RenamberRowItems() {
for(int i=0; i<myRows.size();i++){
myRows[i]->GetHeaderItem()->setText(QString::number(i+1));
}