#include "SalomeApp_Preferences.h"
#include "SalomeApp_PreferencesDlg.h"
#include "SalomeApp_StudyPropertiesDlg.h"
+#include "SalomeApp_CheckFileDlg.h"
#include "SalomeApp_GLSelector.h"
#include "SalomeApp_OBSelector.h"
SUIT_Desktop* desk = desktop();
SUIT_ResourceMgr* resMgr = resourceMgr();
-
+
+ // Dump study
+ createAction( DumpStudyId, tr( "TOT_DESK_FILE_DUMP_STUDY" ), QIconSet(),
+ tr( "MEN_DESK_FILE_DUMP_STUDY" ), tr( "PRP_DESK_FILE_DUMP_STUDY" ),
+ 0, desk, false, this, SLOT( onDumpStudy() ) );
+
// Load script
- createAction( LoadScriptId, tr( "TOT_DESK_LOADSCRIPT" ), QIconSet(),
- tr( "MEN_DESK_LOADSCRIPT" ), tr( "PRP_DESK_LOADSCRIPT" ),
+ createAction( LoadScriptId, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), QIconSet(),
+ tr( "MEN_DESK_FILE_LOAD_SCRIPT" ), tr( "PRP_DESK_FILE_LOAD_SCRIPT" ),
0, desk, false, this, SLOT( onLoadScript() ) );
// Properties
}
connect( modGroup, SIGNAL( selected( QAction* ) ), this, SLOT( onModuleActivation( QAction* ) ) );
-
-
int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
+ createMenu( DumpStudyId, fileMenu, 10, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
- createMenu( LoadScriptId, fileMenu, 15, -1 );
+ createMenu( LoadScriptId, fileMenu, 10, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
createMenu( PropertiesId, fileMenu, 10, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
if(!stdDS) return;
QAction* qaction;
-
- for ( SALOME_ListIteratorOfListIO it( list ); it.More(); it.Next() )
+ //Varibales isEnabledCopy and isEnabledPaste are used for multi selection.
+ bool isEnabledCopy = true;
+ bool isEnabledPaste = true;
+
+ for ( SALOME_ListIteratorOfListIO it( list ); it.More() && (isEnabledCopy || isEnabledPaste); it.Next() )
{
_PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
- qaction = action(EditCutId);
- if( studyMgr()->CanCopy(so) ) {
- qaction->setEnabled(true);
- qaction = action(EditCopyId);
- qaction->setEnabled(true);
- }
- else {
- qaction->setEnabled(false);
- qaction = action(EditCopyId);
+
+ qaction = action(EditCopyId);
+ if( isEnabledCopy && studyMgr()->CanCopy(so) ) qaction->setEnabled(true);
+ else {
+ isEnabledCopy = false;
qaction->setEnabled(false);
}
+
qaction = action(EditPasteId);
- if( studyMgr()->CanPaste(so) ) qaction->setEnabled(true);
- else qaction->setEnabled(false);
+ if( isEnabledPaste && studyMgr()->CanPaste(so) ) qaction->setEnabled(true);
+ else {
+ isEnabledPaste = false;
+ qaction->setEnabled(false);
+ }
}
}
updateObjectBrowser( true );
}
+
+void SalomeApp_Application::onOpenWith()
+{
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ SALOME_ListIO aList;
+ SalomeApp_SelectionMgr* mgr = selectionMgr();
+ mgr->selectedObjects(aList);
+ if (aList.Extent() > 1) return;
+ Handle(SALOME_InteractiveObject) aIObj = aList.First();
+ QString aModuleName(aIObj->getComponentDataType());
+ QString aModuleTitle = moduleTitle(aModuleName);
+ activateModule(aModuleTitle);
+ QApplication::restoreOverrideCursor();
+}
+
void SalomeApp_Application::setActiveStudy( SUIT_Study* study )
{
CAM_Application::setActiveStudy( study );
a->setEnabled( activeStudy() );
}
+ // Dump study menu
+ QAction* a = action( DumpStudyId );
+ if ( a )
+ a->setEnabled( activeStudy() );
+
// Load script menu
- QAction* a = action( LoadScriptId );
+ a = action( LoadScriptId );
if ( a )
a->setEnabled( activeStudy() );
if( a )
a->setEnabled( activeStudy() );
- a = action(EditCutId);
- a->setEnabled(false);
a = action(EditCopyId);
a->setEnabled(false);
a = action(EditPasteId);
saveWindowsGeometry();
}
+void SalomeApp_Application::onDumpStudy( )
+{
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ if ( !appStudy ) return;
+ _PTR(Study) aStudy = appStudy->studyDS();
+
+ QStringList aFilters;
+ aFilters.append(tr("PYTHON_FILES_FILTER"));
+
+ SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( desktop(), false, tr("PUBLISH_IN_STUDY"), true, true);
+ fd->setCaption(tr("TOT_DESK_FILE_DUMP_STUDY"));
+ fd->setFilters( aFilters );
+ fd->SetChecked(true);
+ fd->exec();
+ QString aFileName = fd->selectedFile();
+ bool toPublish = fd->IsChecked();
+ delete fd;
+
+ if(!aFileName.isEmpty()) {
+ QFileInfo aFileInfo(aFileName);
+ aStudy->DumpStudy(aFileInfo.dirPath(true), aFileInfo.baseName(), toPublish);
+ }
+}
+
void SalomeApp_Application::onLoadScript( )
{
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
filtersList.append(tr("PYTHON_FILES_FILTER"));
filtersList.append(tr("ALL_FILES_FILTER"));
- QString aFile = SUIT_FileDlg::getFileName( desktop(), "", filtersList, tr( "TOT_DESK_LOADSCRIPT" ), true, true );
+ QString aFile = SUIT_FileDlg::getFileName( desktop(), "", filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true );
if ( !aFile.isEmpty() )
{
return SUIT_FileDlg::getExistingDirectory( parent, initial, caption, true );
}
+QStringList SalomeApp_Application::getOpenFileNames( const QString& initial, const QString& filters,
+ const QString& caption, QWidget* parent )
+{
+ if ( !parent )
+ parent = desktop();
+ QStringList fls = QStringList::split( ";;", filters, false );
+ return SUIT_FileDlg::getOpenFileNames( parent, initial, fls, caption, true );
+}
+
void SalomeApp_Application::contextMenuPopup( const QString& type, QPopupMenu* thePopup, QString& title )
{
CAM_Application::contextMenuPopup( type, thePopup, title );
thePopup->insertSeparator();
thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) );
+ thePopup->insertItem( tr( "MEN_OPENWITH" ), this, SLOT( onOpenWith() ) );
}
void SalomeApp_Application::updateObjectBrowser( const bool updateModels )