]> SALOME platform Git repositories - modules/gui.git/blobdiff - src/SalomeApp/SalomeApp_Application.cxx
Salome HOME
Unicode support
[modules/gui.git] / src / SalomeApp / SalomeApp_Application.cxx
index 5779f7b706617fc564186dabe6a896af75c40b20..ec97e8c9d10112e2f392d1c0c8165a6c339f17b5 100644 (file)
@@ -272,7 +272,8 @@ void SalomeApp_Application::start()
 
               script.remove( QRegExp("^python.*[\\s]+") );
               QString cmd = script+" "+args;
-              QString command = QString( "exec(open(\"%1\",encoding='utf-8').read())" ).arg(cmd.trimmed());
+
+              QString command = QString( "exec(open(\"%1\", \"rb\").read())" ).arg(cmd.trimmed());
               pyConsole->exec(command);
             }
           } // end for loop on pyfiles QStringList
@@ -497,7 +498,7 @@ void SalomeApp_Application::onNewWithScript()
   {
     onNewDoc();
 
-    QString command = QString("exec(open(\"%1\",encoding='utf-8').read())").arg(aFile);
+    QString command = QString("exec(open(\"%1\", \"rb\").read())").arg(aFile);
 
 #ifndef DISABLE_PYCONSOLE
     PyConsole_Console* pyConsole = pythonConsole();
@@ -585,6 +586,8 @@ void SalomeApp_Application::onModuleActivation( const QString& modName )
 /*!SLOT. Copy objects to study maneger from selection maneger..*/
 void SalomeApp_Application::onCopy()
 {
+  LightApp_Application::onCopy();
+
   SALOME_ListIO list;
   LightApp_SelectionMgr* mgr = selectionMgr();
   mgr->selectedObjects(list);
@@ -599,11 +602,14 @@ void SalomeApp_Application::onCopy()
   if(it.More())
     {
       _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
-      try {
-        stdDS->Copy(so);
-        onSelectionChanged();
-      }
-      catch(...) {
+      if( so )
+      {
+        try {
+          stdDS->Copy(so);
+          onSelectionChanged();
+        }
+        catch(...) {
+        }
       }
     }
 }
@@ -611,6 +617,8 @@ void SalomeApp_Application::onCopy()
 /*!SLOT. Paste objects to study maneger from selection manager.*/
 void SalomeApp_Application::onPaste()
 {
+  LightApp_Application::onPaste();
+
   SALOME_ListIO list;
   LightApp_SelectionMgr* mgr = selectionMgr();
   mgr->selectedObjects(list);
@@ -632,12 +640,15 @@ void SalomeApp_Application::onPaste()
   if(it.More())
     {
       _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
-      try {
-        stdDS->Paste(so);
-        updateObjectBrowser( true );
-        updateActions(); //SRN: BugID IPAL9377, case 3
-      }
-      catch(...) {
+      if( so )
+      {
+        try {
+          stdDS->Paste(so);
+          updateObjectBrowser( true );
+          updateActions(); //SRN: BugID IPAL9377, case 3
+        }
+        catch(...) {
+        }
       }
     }
 }
@@ -924,7 +935,8 @@ void SalomeApp_Application::onLoadScript( )
 
   if ( !aFile.isEmpty() )
   {
-    QString command = QString("exec(open(\"%1\",encoding='utf-8').read())").arg(aFile);
+
+    QString command = QString("exec(open(\"%1\", \"rb\").read())").arg(aFile);
 
 #ifndef DISABLE_PYCONSOLE
     PyConsole_Console* pyConsole = pythonConsole();
@@ -1958,7 +1970,8 @@ bool SalomeApp_Application::onRestoreStudy( const QString& theDumpScript,
   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
 
   // load study from the temporary directory
-  QString command = QString( "exec(open(\"%1\",encoding='utf-8').read())" ).arg( theDumpScript );
+
+  QString command = QString( "exec(open(\"%1\" ,\"rb\").read())" ).arg( theDumpScript );
 
 #ifndef DISABLE_PYCONSOLE
   PyConsole_Console* pyConsole = app->pythonConsole();