garonne_ign_01 = hydro_doc.CreateObject( KIND_IMAGE )
garonne_ign_01.SetName( "garonne_ign_01" )
-garonne_ign_01.LoadImage( os.path.join(HYDRO_SAMPLES , "garonne_ign_01.png" ))
+if not(garonne_ign_01.LoadImage( os.path.join(HYDRO_SAMPLES , "garonne_ign_01.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
QPoint( 1325, 85 ) )
garonne_ign_01.SetZLevel( 0 )
-garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))
+if not(garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
QPoint( 1325, 85 ) )
garonne_ign_02.SetZLevel( 1 )
-garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))
+if not(garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
QPoint( 784, 481 ) )
garonne_ign_01.SetZLevel( 0 )
-garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))
+if not(garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
QPoint( 1325, 85 ) )
garonne_ign_02.SetZLevel( 1 )
-garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))
+if not(garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
QPoint( 784, 481 ) )
garonne_ign_inexistant = hydro_doc.CreateObject( KIND_IMAGE )
garonne_ign_inexistant.SetName( "garonne_ign_inexistant" )
-garonne_ign_inexistant.LoadImage( os.path.join(HYDRO_SAMPLES , "garonne_ign_inexistant.png" ))
+ret = garonne_ign_inexistant.LoadImage( os.path.join(HYDRO_SAMPLES , "garonne_ign_inexistant.png" ))
-# TODO : ce chargement doit echouer avec un retour d'erreur à traiter
-raise ValueError('file not found')
-
-garonne_ign_inexistant.SetLocalPoints( QPoint( 40, 817 ),
- QPoint( 1325, 85 ) )
-
-garonne_ign_inexistant.SetGlobalPoints( 1,
- QPointF( 471562, 6.36775e+06 ),
- QPointF( 489400, 6.37702e+06 ) )
-
-garonne_ign_inexistant.Update()
+if ret:
+ raise ValueError('loading problem not detected: return value should be null')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
garonne_ign_01.SetZLevel( 0 )
-garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))
+if not(garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
QPoint( 1325, 85 ) )
garonne_ign_02.SetZLevel( 1 )
-garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))
+if not(garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
QPoint( 784, 481 ) )
garonne_ign_01.SetZLevel( 0 )
-garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))
+if not(garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
QPoint( 1325, 85 ) )
garonne_ign_02.SetZLevel( 1 )
-garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))
+if not(garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
QPoint( 784, 481 ) )
garonne_ign_01.SetZLevel( 0 )
-garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))
+if not(garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
QPoint( 1325, 85 ) )
garonne_ign_02.SetZLevel( 1 )
-garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))
+if not(garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
QPoint( 784, 481 ) )
garonne_ign_01.SetZLevel( 0 )
-garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))
+if not(garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
QPoint( 1325, 85 ) )
garonne_ign_02.SetZLevel( 1 )
-garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))
+if not(garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
QPoint( 784, 481 ) )
garonne_ign_01.SetZLevel( 0 )
-garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))
+if not(garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
QPoint( 1325, 85 ) )
garonne_ign_02.SetZLevel( 1 )
-garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))
+if not(garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
QPoint( 784, 481 ) )
garonne_ign_01.SetZLevel( 0 )
-garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))
+if not(garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
QPoint( 1325, 85 ) )
garonne_ign_02.SetZLevel( 1 )
-garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))
+if not(garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
QPoint( 784, 481 ) )
garonne_ign_01.SetZLevel( 0 )
-garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))
+if not(garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
QPoint( 1325, 85 ) )
garonne_ign_02.SetZLevel( 1 )
-garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))
+if not(garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))):
+ raise ValueError('problem while loading image')
garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
QPoint( 784, 481 ) )
if ( !aFilePath.isEmpty() )
{
aResList << QString( "" );
- aResList << QString( "%1.LoadImage( \"%2\" )" )
+ aResList << QString( "if not(%1.LoadImage( \"%2\" )):" )
.arg( anImageName ).arg( aFilePath );
+ aResList << QString( " raise ValueError('problem while loading image')" );
aResList << QString( "" );
// Dump transformation points for image