msgid "ERR_CANT_BUILD_PRESENTATION"
msgstr "The object can't be built"
+msgid "ERR_CANT_CREATE_ACTOR"
+msgstr "Can't create actor for this presentation"
+
+# Preferences for VISU module (VisuGUI.cxx)
+
msgid "VISU_SCALAR_BAR"
msgstr "Scalar Bar"
msgid "VisuGUI::ERR_ERROR_IN_THE_FILE"
msgstr "Error in the file"
-msgid "ERR_CANT_CREATE_ACTOR"
-msgstr "Can't create actor for this presentation"
+msgid "VisuGUI::ERR_ERROR_DURING_EXPORT"
+msgstr "Error has been occured during exporting to file"
msgid "VisuGUI::ERR_ACTIVATE_VIEW3D"
msgstr "Please activate 3D view before"
OnExportTableToFile()
{
if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
+
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ if (aListIO.Extent() > 0) {
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+ if (anIO->hasEntry()) {
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+ if (!aSObj) return;
+
+ // find table attribute
+ bool isTOR = true;
+ _PTR(GenericAttribute) anAttr;
+
+ if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
+ isTOR = false;
+ if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
+ // if the current SObject is a table title
+ // we take a father contaning the table
+ aSObj = aSObj->GetFather();
+
+ if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
+ isTOR = true;
+ } else {
+ if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
+ return;
+ }
+ }
+ }
+ }
+
+ // get table title in order to have default name of the file
+ QString aTitle;
+ if (isTOR) {
+ _PTR(AttributeTableOfReal) aTabAttr (anAttr);
+ if (!aTabAttr) return;
+ aTitle = aTabAttr->GetTitle();
+ } else {
+ _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
+ if (!aTabAttr) return;
+ aTitle = aTabAttr->GetTitle();
+ }
+ aTitle.simplifyWhiteSpace();
+ aTitle = aTitle.replace(QRegExp(" "), "_");
+
+ // get default path for the file
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+ QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
+ if (aDir.isEmpty()) {
+ aDir = aResourceMgr->stringValue("VISU","InputDir","");
+ if (aDir.isEmpty()) {
+ aDir = getenv("CSF_PATHData");
+ }
+ }
+ QString aPath = Qtx::addSlash(aDir) + aTitle;
+
+ // get name for the file
+ QStringList aFilter;
+ aFilter.append("Table Files (*.xls)");
+
+ QFileInfo aFileInfo =
+ SUIT_FileDlg::getFileName(GetDesktop(this),
+ aPath,
+ aFilter,
+ tr("MEN_EXPORT_TABLE"), // "Export Table To File"
+ false);
+
+ // export
+ QString aFile = aFileInfo.filePath();
+ if (!aFile.isEmpty()) {
+ application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
+ aDir = Qtx::dir(aFile, true);
+ aResourceMgr->setValue("VISU", "OutputDir", aDir);
+
+ try {
+ GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), aFile.latin1());
+ application()->putInfo(aFile + " " + tr("INF_DONE"));
+ } catch(std::exception& ex) {
+ INFOS(ex.what());
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ERROR_DURING_EXPORT") + " " + tr(ex.what()),
+ tr("BUT_OK"));
+ } catch(...) {
+ INFOS(tr("ERR_ERROR_DURING_EXPORT"));
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ERROR_DURING_EXPORT"),
+ tr("BUT_OK") );
+ }
+ }
+ }
+ }
}
void
QApplication::restoreOverrideCursor();
if(aPrs3d){
SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
- int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0);
+ int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
if(!aValue){
if(TDlg* aDlg = new TDlg(theModule)){ // dialog box in creation mode
aDlg->initFromPrsObject(aPrs3d);