From: rnv Date: Fri, 13 Jul 2018 06:45:54 +0000 (+0300) Subject: Unicode support X-Git-Tag: SHAPER_V9_1_0RC1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f398d8d86da2fc774dc251206a5f9f53264df4be;p=modules%2Fgui.git Unicode support --- f398d8d86da2fc774dc251206a5f9f53264df4be diff --cc src/LightApp/LightApp_Application.cxx index ad5debdbc,c451c3734..ae03b893e --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@@ -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"); diff --cc src/LightApp/LightApp_VTKSelector.cxx index 5d2a918ed,70db9624f..697344247 --- a/src/LightApp/LightApp_VTKSelector.cxx +++ b/src/LightApp/LightApp_VTKSelector.cxx @@@ -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(aDataOwner)){ - Handle(SALOME_InteractiveObject) anIO = + } + else if(const LightApp_DataOwner* anOwner = dynamic_cast(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/SVTK/SVTK_ViewWindow.cxx index c2daba504,3a63b154f..493648118 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@@ -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; + } } } } diff --cc src/SalomeApp/SalomeApp_Application.cxx index 5bb774c5e,5779f7b70..ec97e8c9d --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@@ -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( 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();