Salome HOME
PN report du patch V1_6p2
[tools/eficas.git] / Editeur / appli.py
index 740b1eb8f17167717e5235556ba22dfefbf4685b..0a03c2550294f71d8e8bd8edd6950593666013ae 100644 (file)
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 #            CONFIGURATION MANAGEMENT OF EDF VERSION
 # ======================================================================
 # COPYRIGHT (C) 1991 - 2002  EDF R&D                  WWW.CODE-ASTER.ORG
     L'aspect applicatif doit etre pris en charge par la classe dérivée
 """
 # Modules Python
+import os
 import sys
 import types
 import Pmw
 import Tkinter
-from tkMessageBox import showinfo,askyesno,showerror
+from widgets import showerror
 
 # Modules Eficas
 import splash
@@ -39,7 +41,7 @@ import properties
 from widgets import Fenetre
 from Misc import MakeNomComplet
 
-VERSION="EFICAS v1.4"
+VERSION="EFICAS v1.6"
 
 class APPLI: 
   def __init__ (self,master,code='ASTER',fichier=None) :
@@ -61,11 +63,17 @@ class APPLI:
       self.affiche_FAQ()
       # AY : cas ou le nom du fichier a été passé en argument
       if fichier :
-           try :
-                self.bureau.openJDC( str(MakeNomComplet.FILENAME(fichier)) )
-           except Exception,e :
-                showerror( "ARGUMENT INVALIDE", str(e) )
+           fich=str(MakeNomComplet.FILENAME(fichier))
+           if not os.path.isfile(fich):
+              showerror("Fichier inexistant", "Fichier %s en argument n'existe pas" % fich)
+           else:
+              self.bureau.openJDC( fich)
       # AY : fin
+      # PN : ajout d un attribut pour indiquer si 
+      # l appli a ete lance depuis Salome
+      self.salome=0
+
+     
 
   def send_message(self,message):
       self.message=message
@@ -204,6 +212,13 @@ class APPLI:
          if not item :
             menu.add_separator()
          else:
+            if len(item)==3:
+               raccourci=item[2]
+               newitem=(item[0],item[1])
+            else :
+              raccourci=""
+               newitem=item
+            item=newitem
             label,method=item
             if type(method) == types.TupleType:
                # On a un tuple => on cree une cascade
@@ -218,6 +233,8 @@ class APPLI:
             else:
                command=getattr(appli_composant,method)
                menu.add_command(label=label,command=command)
+               if raccourci != "" :
+                  self.top.bind(raccourci,command)
       # Si au moins un radiobouton existe on invoke le premier
       if radio:menu.invoke(radio)