Salome HOME
Unicode support
authorrnv <rnv@opencascade.com>
Fri, 13 Jul 2018 06:45:54 +0000 (09:45 +0300)
committerrnv <rnv@opencascade.com>
Fri, 13 Jul 2018 06:45:54 +0000 (09:45 +0300)
1  2 
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_VTKSelector.cxx
src/OCCViewer/OCCViewer_ViewPort3d.cxx
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/Qtx/Qtx.cxx
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx
src/SVTK/SVTK_ViewWindow.cxx
src/SalomeApp/SalomeApp_Application.cxx
src/VTKViewer/VTKViewer_PolyDataMapper.cxx

index ad5debdbcb2e8d8e2ae44ea20e38782ff1d015e8,c451c3734a8038a115ae768e6d1d90b9e5be1fa1..ae03b893e602ddc15f590ac7437098e8a7163255
@@@ -658,8 -610,8 +658,8 @@@ void LightApp_Application::createAction
      QString helpSubMenu;                                             // help submenu name (empty if not needed)
      QString modName = moduleName( aModule );                         // module name
      if ( modName.isEmpty() ) modName = aModule;                      // for KERNEL and GUI
 -    QString rootDir = QString( "%1_ROOT_DIR" ).arg( modName );       // module root dir variable
 -    QString modDir  = getenv( rootDir.toUtf8().constData() );      // module root dir
 +    QString rootDir = QString( "%1_ROOT_DIR" ).arg( modName );       // module root dir env variable
-     QString modDir  = getenv( rootDir.toLatin1().constData() );      // module root dir path
++    QString modDir  = getenv( rootDir.toUtf8().constData() );      // module root dir path
      QString docSection;
      if (resMgr->hasValue( modName, "documentation" ) )
        docSection = resMgr->stringValue(modName, "documentation");
index 5d2a918eda2a8f31224045edbf8c4fa23ad60d10,70db9624fa29aab715200b7910c4fbb30dfb4e8d..697344247f0383dfb8a8a2047377e6acd11e4dca
@@@ -237,11 -236,9 +237,11 @@@ LightApp_VTKSelecto
  
                anAppendList.Append(anIO);
                aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false);
 -            }else if(const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>(aDataOwner)){
 -              Handle(SALOME_InteractiveObject) anIO = 
 +            }
 +            else if(const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>(aDataOwner))
 +            {
 +              Handle(SALOME_InteractiveObject) anIO =
-                 new SALOME_InteractiveObject(anOwner->entry().toLatin1(),"");
+                 new SALOME_InteractiveObject(anOwner->entry().toUtf8(),"");
                aSelector->AddIObject(anIO);
                anAppendList.Append(anIO);
              }
diff --cc src/Qtx/Qtx.cxx
Simple merge
index c2daba5045dcc4cf43307be95d073df0957c7a20,3a63b154fb6b911ba5061346828a6bb8f95dab44..4936481184bf686fba076786a0cc933421ffcecb
@@@ -663,71 -663,71 +663,71 @@@ void SVTK_ViewWindow::setBackground( co
        int textureMode = bgData.texture( fileName );
        QFileInfo fi( fileName );
        if ( !fileName.isEmpty() && fi.exists() ) {
 -      // read texture from file
 -      QString extension = fi.suffix().toLower();
 -      vtkImageReader2* aReader = 0;
 -      if ( extension == "jpg" || extension == "jpeg" )
 -        aReader = vtkJPEGReader::New();
 -      else if ( extension == "bmp" )
 -        aReader = vtkBMPReader::New();
 -      else if ( extension == "tif" || extension == "tiff" )
 -        aReader = vtkTIFFReader::New();
 -      else if ( extension == "png" )
 -        aReader = vtkPNGReader::New();
 -      else if ( extension == "mhd" || extension == "mha" )
 -        aReader = vtkMetaImageReader::New();           
 -      if ( aReader ) {
 -        // create texture
 -        aReader->SetFileName( fi.absoluteFilePath().toUtf8().constData() );
 -        aReader->Update();      
 -        VTKViewer_Texture* aTexture = VTKViewer_Texture::New();           
 -        vtkImageMapToColors* aMap = 0;
 -        vtkAlgorithmOutput* anOutput;
 -        /*
 -        // special processing for BMP reader
 -        vtkBMPReader* aBMPReader = (vtkBMPReader*)aReader;
 -        if ( aBMPReader ) {
 -        // Special processing for BMP file
 -        aBMPReader->SetAllow8BitBMP(1);
 -          
 -        aMap = vtkImageMapToColors::New();
 -        aMap->SetInputConnection( aBMPReader->GetOutputPort() );
 -        aMap->SetLookupTable( (vtkScalarsToColors*)aBMPReader->GetLookupTable() );
 -        aMap->SetOutputFormatToRGB();
 -          
 -        anOutput = aMap->GetOutputPort();
 -        }
 -        else {
 -        }
 -        */
 -        anOutput = aReader->GetOutputPort( 0 );
 -        aTexture->SetInputConnection( anOutput );
 -        // set texture mode
 -        // VSR: Currently, VTK only supports Stretch mode, so below code will give
 -        // the same results for all modes
 -        switch ( textureMode ) {
 -        case Qtx::TileTexture:
 -          aTexture->SetPosition((int)VTKViewer_Texture::Tiled);
 -          break;
 -        case Qtx::StretchTexture:
 -          aTexture->SetPosition((int)VTKViewer_Texture::Stretched);
 -          break;
 -        case Qtx::CenterTexture:
 -          aTexture->SetPosition((int)VTKViewer_Texture::Centered);
 -        default:
 -          break;
 -        }
 -        // show textured background
 -        getRenderer()->SetTexturedBackground( true );
 -        getRenderer()->SetBackgroundTexture( aTexture );
 -        
 -        // clean-up resources
 -        if ( aMap )
 -          aMap->Delete();
 -        aReader->Delete();
 -        aTexture->Delete();
 -        ok = true;
 -      }
 +        // read texture from file
 +        QString extension = fi.suffix().toLower();
 +        vtkImageReader2* aReader = 0;
 +        if ( extension == "jpg" || extension == "jpeg" )
 +          aReader = vtkJPEGReader::New();
 +        else if ( extension == "bmp" )
 +          aReader = vtkBMPReader::New();
 +        else if ( extension == "tif" || extension == "tiff" )
 +          aReader = vtkTIFFReader::New();
 +        else if ( extension == "png" )
 +          aReader = vtkPNGReader::New();
 +        else if ( extension == "mhd" || extension == "mha" )
 +          aReader = vtkMetaImageReader::New();
 +        if ( aReader ) {
 +          // create texture
-           aReader->SetFileName( fi.absoluteFilePath().toLatin1().constData() );
++          aReader->SetFileName( fi.absoluteFilePath().toUtf8().constData() );
 +          aReader->Update();
 +          VTKViewer_Texture* aTexture = VTKViewer_Texture::New();
 +          vtkImageMapToColors* aMap = 0;
 +          vtkAlgorithmOutput* anOutput;
 +          /*
 +          // special processing for BMP reader
 +          vtkBMPReader* aBMPReader = (vtkBMPReader*)aReader;
 +          if ( aBMPReader ) {
 +          // Special processing for BMP file
 +          aBMPReader->SetAllow8BitBMP(1);
 +
 +          aMap = vtkImageMapToColors::New();
 +          aMap->SetInputConnection( aBMPReader->GetOutputPort() );
 +          aMap->SetLookupTable( (vtkScalarsToColors*)aBMPReader->GetLookupTable() );
 +          aMap->SetOutputFormatToRGB();
 +
 +          anOutput = aMap->GetOutputPort();
 +          }
 +          else {
 +          }
 +          */
 +          anOutput = aReader->GetOutputPort( 0 );
 +          aTexture->SetInputConnection( anOutput );
 +          // set texture mode
 +          // VSR: Currently, VTK only supports Stretch mode, so below code will give
 +          // the same results for all modes
 +          switch ( textureMode ) {
 +          case Qtx::TileTexture:
 +            aTexture->SetPosition((int)VTKViewer_Texture::Tiled);
 +            break;
 +          case Qtx::StretchTexture:
 +            aTexture->SetPosition((int)VTKViewer_Texture::Stretched);
 +            break;
 +          case Qtx::CenterTexture:
 +            aTexture->SetPosition((int)VTKViewer_Texture::Centered);
 +          default:
 +            break;
 +          }
 +          // show textured background
 +          getRenderer()->SetTexturedBackground( true );
 +          getRenderer()->SetBackgroundTexture( aTexture );
 +
 +          // clean-up resources
 +          if ( aMap )
 +            aMap->Delete();
 +          aReader->Delete();
 +          aTexture->Delete();
 +          ok = true;
 +        }
        }
      }
    }
index 5bb774c5ed42d102eabab7bbd2685121109ca9a0,5779f7b706617fc564186dabe6a896af75c40b20..ec97e8c9d10112e2f392d1c0c8165a6c339f17b5
@@@ -272,7 -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
@@@ -934,7 -924,7 +935,8 @@@ void SalomeApp_Application::onLoadScrip
  
    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();
@@@ -1968,7 -1958,7 +1970,8 @@@ bool SalomeApp_Application::onRestoreSt
    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();