Salome HOME
Pour mettre au point les generate dans les Tools
authorpascale.noyret <pascale.noyret@edf.fr>
Wed, 22 Apr 2020 15:40:12 +0000 (17:40 +0200)
committerpascale.noyret <pascale.noyret@edf.fr>
Wed, 22 Apr 2020 15:40:12 +0000 (17:40 +0200)
16 files changed:
Editeur/catadesc.py
Editeur/session.py
Ihm/I_JDC.py
InterfaceQT4/compooper.py
InterfaceQT4/configuration.py
InterfaceQT4/editor.py
InterfaceQT4/editorSsIhm.py
InterfaceQT4/eficas_go.py
InterfaceQT4/qtEficas.py
InterfaceQT4/qtEficasSsIhm.py
InterfaceQT4/readercata.py
InterfaceQT4/readercataXML.py
Tools/generateXML.py [new file with mode: 0755]
Tools/qtEficasGui.py [new file with mode: 0755]
generator/generator_PSEN.py
generator/generator_XML.py

index 89b7059934e27aeb3c6f56168703879056464c7d..7f3ffeaef835c9268864ac6cbce2c28c2a656e96 100644 (file)
@@ -23,67 +23,72 @@ except : pass
 
 class CatalogDescription(object):
     
-    def __init__(self, identifier, cata_file_path, file_format = "python",
-                 default = False, code = None,ss_code=None, user_name = None,
-                 selectable = True, file_format_in = "python"):
+    def __init__(self, labelCode, fichierCata, formatFichierOut = "python", formatFichierIn='python',
+                 default = False, code = None,ss_code=None,):
         """
         This class can be used to describe an Eficas catalog.
 
-        :type  identifier: string
-        :param identifier: unique identifier for the catalog
+        :type  labelCode: string
+        :param labelCode: unique labelCode for the catalog
                 
-        :type  cata_file_path: string
-        :param cata_file_path: path of the file containing the catalog itself
+        :type  fichierCata: string
+        :param fichierCata: path of the file containing the catalog itself
                 
-        :type  file_format: string
-        :param file_format: format of the files generated when using this
-                            catalog
+        :type  fileFormatOut: string
+        :param fileFormatOut: format of the files generated when using this catalog
                 
         :type  default: boolean
-        :param default: indicate if this catalog is the default one (appear on
-                        the top of the catalogs list)
+        :param default: indicate if this catalog is the default one (appear on the top of the catalogs list)
                 
         :type  code: string
-        :param code: Deprecated. Used to indicate the code associated to this
-                     catalog
+        :param code: Used to indicate the code associated to this catalog
                 
         :type  ss_code: string
         :param ss_code: scheme associated to this catalog (Map only)
 
-        :type  user_name: string
-        :param user_name: name of the catalog as it will appear in the list
-                
-        :type  selectable: boolean
-        :param selectable: indicate if this catalog appears in the list.
-                           Setting this parameter to False is useful to keep
-                           old catalogs to edit existing files but to forbid
-                           to use them to create new files.
                 
         """
-        self.identifier = identifier
-        self.cata_file_path = cata_file_path
-        self.file_format = file_format
+
+        self.labelCode = labelCode
+        self.fichierCata = fichierCata
+        self.formatFichierOut = formatFichierOut
+        self.formatFichierIn = formatFichierIn 
         self.default = default
         self.code = code
-        if user_name is None:
-            self.user_name = identifier
-        else:
-            self.user_name = user_name
-        self.selectable = selectable
-        self.file_format_in = file_format_in
 
     @staticmethod
-    def create_from_tuple(cata_tuple):
+    def createFromTuple(cataTuple):
         #print "Warning: Describing a catalog with a tuple is deprecated. " \
         #      "Please create a CatalogDescription instance directly."
-        desc = CatalogDescription(code = cata_tuple[0],
-                                  identifier = cata_tuple[1],
-                                  cata_file_path = cata_tuple[2],
-                                  file_format = cata_tuple[3])
+        if cataTuple[0] == 'MAP' :
+           desc = CatalogDescription(code = cataTuple[0],
+                                  labelCode = cataTuple[1],
+                                  fichierCata = cataTuple[2],
+                                  ssCode      = cataTuple[3],
+                                  formatFichierOut = 'MAP',
+                                  formatFichierIn  = 'MAP')
+        elif len(cataTuple) == 4:
+           desc = CatalogDescription(code = cataTuple[0],
+                                  labelCode = cataTuple[1],
+                                  fichierCata = cataTuple[2],
+                                  formatFichierOut = cataTuple[3],
+                                  formatFichierIn  = 'python')
+        elif len(cataTuple) == 5 : 
+           desc = CatalogDescription(code = cataTuple[0],
+                                  labelCode = cataTuple[1],
+                                  fichierCata = cataTuple[2],
+                                  formatFichierOut = cataTuple[3],
+                                  formatFichierIn  = cataTuple[4])
+        elif len(cataTuple) == 6 : 
+           desc = CatalogDescription(code = cataTuple[0],
+                                  labelCode = cataTuple[1],
+                                  fichierCata = cataTuple[2],
+                                  formatFichierOut = cataTuple[3],
+                                  formatFichierIn  = cataTuple[4],
+                                  defaut=cataTuple[5])
+        else : 
+           print ('pb a la description du catalogue avec les donnees')
+           print (cataTuple)
+           desc=None
         
-        if len(cata_tuple) == 5:
-            if cata_tuple[4] == "defaut":
-                desc.default = True
-            else:
-                desc.file_format_in = cata_tuple[4]
         return desc
index 500680015203bd95e599ef4151c12daef7792f0a..f337ed0be5d394623415912f4e66c7c31b09357a 100644 (file)
 Ce module centralise les informations issues de la ligne de commande.
 
 La ligne de commande est parsee avec l'aide du module python optparse.
-Les options possibles sont : -c, -j, -p, -d, -i, -f comme definies ci-dessous.
+Les options possibles sont : -l, -j, -p, -d, -i, -f comme definies ci-dessous.
 
 Un exemple typique d'utilisation est :
->>> ./appli.py -c V7.3 -d 1 -j aa -i 11 iii -p ppp -i 22 ii -j bb -f ff
+>>> ./appli.py -v V7.3 -d 1 -j aa -i 11 iii -p ppp -i 22 ii -j bb -f ff
 
 qui demande a l'application d'ouvrir trois jeux de commandes.
 
@@ -243,7 +243,7 @@ def printDEnv():
 def createparser():
     # creation du parser des options de la ligne de commande
     #import prefs
-    parser=optparse.OptionParser(usage=tr("utilisation : %prog [options]"), version="%prog 1.13")
+    parser=optparse.OptionParser(usage=tr("utilisation : %prog [options]"), version="%prog 9.5")
 
     parser.add_option(u"-j","--jdc",dest="comm",type='string',
                     action="callback",callback=checkComm,
@@ -257,14 +257,14 @@ def createparser():
                   action="callback", callback=checkInclude,
                   nargs=2, help=tr("numero d'unite suivi du nom du fichier include"))
 
-    parser.add_option(u"-f","--fich", type="string",dest="fich",
-                  action="callback", callback=checkFich,
-                  help=tr("fichier decrivant une etude"))
+    #parser.add_option(u"-f","--fich", type="string",dest="fich",
+    #              action="callback", callback=checkFich,
+    #              help=tr("fichier decrivant une etude"))
 
     parser.add_option(u"-c","--cata", action="store", type="string",dest="fichierCata",
-                  help=tr("version de catalogue a utiliser"))
+                  help=tr("catalogue a utiliser"))
 
-    parser.add_option(u"-v","--version_cata", action="store", type="string",dest="version_cata",
+    parser.add_option(u"-v","--label", action="store", type="string",dest="labelCode",
                   help=tr("version de catalogue a utiliser"))
 
 
@@ -274,11 +274,15 @@ def createparser():
     parser.add_option(u"-d","--debug", action="store", type="int",dest="debug",
                   help=tr("niveau de debug"))
 
+    parser.add_option(u"-x","--withXSD", action="store_true", dest="withXSD",
+                  default=False,
+                  help=tr("construit le .xml en meme temps que le .comm"))
+
     parser.add_option(u"-s","--schema", action="store", type="string",dest="ssCode",
                   help=tr("schema"))
     # To handle locale information
-    parser.add_option("-l", "--locale", action="store", type="string", dest="locale",
-                  help=tr("localisation de l'application, pour la traduction"))
+    #parser.add_option("-l", "--locale", action="store", type="string", dest="locale",
+    #              help=tr("localisation de l'application, pour la traduction"))
 
 
     return parser
@@ -289,6 +293,8 @@ def parse(args):
     if not hasattr(options,"studies"):
        options.studies=[]
        options.comm=[]
+    if not hasattr(options,"fichierCata"): options.fichierCata=None
+    if not hasattr(options,"labelCode"): options.labelCode=None
     try:
        del parser.values.current
     except:
@@ -314,6 +320,7 @@ def parse(args):
     global d_env
     d_env=options
     #printDEnv()
+    #print (options)
     return options
 
 def getUnit(d_study,appliEficas):
index 9010f0473b9356901d79d427b328e61b62390ec8..dfecae063b1d747da8340c598787fa9151f215f2 100644 (file)
@@ -549,7 +549,6 @@ class JDC(I_OBJECT.OBJECT):
           e.updateContext(context)
 
    def analyse(self):
-      #if self.editor.format_in == 'xml' :
          # il ne faut pas le faire quand le jeu de donnees est vide
       #   self.setCurrentContext()
       #   self.analyseFromXML()
index ac272a04c93b76a0485592c5148224fb695766ef..b8f4aafe6b31c5cd8b34b9d36f2989ac527578b4 100644 (file)
@@ -245,7 +245,7 @@ class EtapeTreeItem(Objecttreeitem.ObjectTreeItem):
           représentatif de self.object
       """
       # Format de fichier utilisé
-      format=self.appliEficas.format_fichier
+      format=self.appliEficas.formatFichierIn
       return self.object.getObjetCommentarise(format)
 
   def getObjetCommentarise_BAK(self):
index c3d438146009f170ee02944c49b443a19ca86c04..78d7159679a05b661a54d332420d1a5c4f7ee92c 100644 (file)
@@ -154,6 +154,7 @@ class configBase(object):
       try :
         prefsCode=__import__(name)
       except :
+        self.catalogues=[]
         print ('pas de fichier de prefs')
         return
       for k in dir(prefsCode):
index d549b36d45d6d0af0cdd27231364d38de500e304..b19a4a6983d5c7bded2f45295631a4daddcc9005 100755 (executable)
@@ -103,8 +103,8 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget):
         if self.maConfiguration.boutonDsMenuBar : self.appliEficas.remplitIconesCommandes()
 
      
-        self.format =  self.appliEficas.format_fichier
-        self.format_in =  self.appliEficas.format_fichier_in
+        self.formatFichierOut =  self.appliEficas.formatFichierOut
+        self.formatFichierIn  =  self.appliEficas.formatFichierIn
 
         self.node_selected = []
         self.deplier = True
@@ -637,7 +637,7 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget):
       if self.modified or self.fichier==None  :
          QMessageBox.critical( self, tr( "Execution impossible "),tr("Sauvegarder SVP avant l'execution "))
          return
-      if not hasattr(self,'generator'): texte=self.getTextJDC(self.format)
+      if not hasattr(self,'generator'): texte=self.getTextJDC(self.formatFichierOut)
       from PrepareRunCarmel import prepareRunCarmel
       fichierGenerique=os.path.basename(self.fichier).split(".")[0]
       repMed=os.path.dirname(self.fichier)
@@ -779,7 +779,7 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget):
         extension='.casR'
         fn = self.fichierComplet
         #saveas=True # Pour forcer le nom
-        self.generator=self.maConfiguration.mesGenerators.plugins[self.format]()
+        self.generator=self.maConfiguration.mesGenerators.plugins[self.formatFichierOut]()
         if self.fichierComplet is None or saveas:
           if path is None: path=self.maConfiguration.savedir
           bOK, fn=self.determineNomFichier(path,extension)
@@ -935,7 +935,7 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget):
         ulfile = os.path.abspath(fn)
         self.appliEficas.maConfiguration.savedir=os.path.split(ulfile)[0]
 
-        # On utilise le convertisseur defini par format_fichier
+        # On utilise le convertisseur defini par formatFichierIn
         source=self.getSource(ulfile)
         if source:
             # On a reussia convertir le fichier self.ulfile
index ce7b08ef437a16b6a008be8a0669e447df952559..fec2294353e4930ac5d521ef623b6c45fd02be2c 100755 (executable)
@@ -87,11 +87,11 @@ class JDCEditorSsIhm :
            self.appliEficas.code=self.code
         else :
            self.readercata=self.appliEficas.readercata
-        if self.readercata.ficCata == None : return    #Sortie Salome
+        if self.readercata.fichierCata == None : return    #Sortie Salome
         self.titre=self.readercata.titre
 
-        self.format    =  self.appliEficas.format_fichier
-        self.format_in =  self.appliEficas.format_fichier_in
+        self.formatFichierOut =  self.appliEficas.formatFichierOut
+        self.formatFichierIn  =  self.appliEficas.formatFichierIn
 
         if self.appliEficas.maConfiguration.dumpXSD==True : self.appliEficas.dumpXsd()
         self.dict_reels={}
@@ -119,9 +119,13 @@ class JDCEditorSsIhm :
 
         self.maConfiguration.mesGenerators     = generator
         self.maConfiguration.mesconvertisseurs = convert
+        try :
+           self.XMLGenerateur=generator.plugins['xml']()
+        except :
+           self.XMLGenerateur=None
 
-        if self.format in generator.plugins.keys():
-           self.generator = generator.plugins[self.format]()
+        if self.formatFichierOut in generator.plugins.keys():
+           self.generator = generator.plugins[self.formatFichierOut]()
 
 
         self.fileInfo       = None
@@ -192,10 +196,10 @@ class JDCEditorSsIhm :
         jdcName=os.path.basename(fn)
 
         # Il faut convertir le contenu du fichier en fonction du format
-        if self.appliEficas.format_fichier_in in convert.plugins:
+        if self.appliEficas.formatFichierIn in convert.plugins:
              # Le convertisseur existe on l'utilise
 
-             p=convert.plugins[self.appliEficas.format_fichier_in]()
+             p=convert.plugins[self.appliEficas.formatFichierIn]()
              p.readfile(fn)
 
              if p.text=="" : self.nouveau=1
@@ -216,7 +220,7 @@ class JDCEditorSsIhm :
         else :
             self.afficheInfos("Type de fichier non reconnu",'red')
             self.informe( "Type de fichier non reconnu",
-                    "EFICAS ne sait pas ouvrir le type de fichier " + self.appliEficas.format_fichier_in)
+                    "EFICAS ne sait pas ouvrir le type de fichier " + self.appliEficas.formatFichierIn)
             return None
 
         CONTEXT.unsetCurrentStep()
@@ -309,9 +313,9 @@ class JDCEditorSsIhm :
     #-----------------------#
 
         # Il faut convertir le contenu du fichier en fonction du format
-        if self.format in convert.plugins :
+        if self.formatFichierIn in convert.plugins :
             # Le convertisseur existe on l'utilise
-            p=convert.plugins[self.format]()
+            p=convert.plugins[self.formatFichierIn]()
             p.readfile(file)
             text=p.convert('execnoparseur')
             if not p.cr.estvide():
@@ -321,7 +325,7 @@ class JDCEditorSsIhm :
             # Il n'existe pas c'est une erreur
             self.afficheInfos("Type de fichier non reconnu",'red')
             self.informe( "Type de fichier non reconnu",
-                    "EFICAS ne sait pas ouvrir le type de fichier " + self.appliEficas.format_fichier_in)
+                    "EFICAS ne sait pas ouvrir le type de fichier " + self.appliEficas.formatFichierIn)
             return None
 
     #----------------------------------------------#
@@ -360,7 +364,7 @@ class JDCEditorSsIhm :
     #-----------------------#
     def viewJdcPy(self):
     #-----------------------#
-        strSource = str( self.getTextJDC(self.format) )
+        strSource = str( self.getTextJDC(self.formatFichierOut) )
         self._viewText(strSource, "JDC_RESULTAT")
 
     #-----------------------#
@@ -412,7 +416,7 @@ class JDCEditorSsIhm :
         fn = str(fn)
 
         if txt == None :
-            txt = self.getTextJDC(self.format,formatLigne=formatLigne)
+            txt = self.getTextJDC(self.formatFichierOut,formatLigne=formatLigne)
             eol = '\n'
             if len(txt) >= len(eol):
                if txt[-len(eol):] != eol:
@@ -433,12 +437,13 @@ class JDCEditorSsIhm :
             print('Sauvegarde du Fichier', 'Le fichier'+str(fn) + 'n a pas pu etre sauvegarde :'  , str(why))
             self.afficheInfos('Le fichier'+str(fn) + 'n a pas pu etre sauvegarde '  , 'red')
             return 0
+           
 
     #-----------------------------------------------------------#
     def getTextJDC(self,format = None,pourRun=0,formatLigne="beautifie"):
     #-----------------------------------------------------------#
       if self.code == "MAP" and not(format in generator.plugins): format = "MAP"
-      if format == None : format = self.format
+      if format == None : format = self.formatFichierOut
       if format in generator.plugins:
 
          # Le generateur existe on l'utilise
@@ -499,7 +504,7 @@ class JDCEditorSsIhm :
          dico=self.generator.Dico
          return dico
       else :
-         self.afficheInfos(tr("Format %s non reconnu" , self.format),'red')
+         self.afficheInfos(tr("Format %s non reconnu" , 'Dictionnaire Imbrique' ),'red')
          return ""
 
    #-----------------------------------------#
@@ -512,7 +517,7 @@ class JDCEditorSsIhm :
     def chercheDico(self):
     #-----------------------------------------#
         dicoCourant={}
-        format =  self.appliEficas.format_fichier
+        format =  self.appliEficas.formatFichierOut
         if format in generator.plugins:
            # Le generateur existe on l'utilise
            self.generator=generator.plugins[format]()
index 16f8bce6f9865ca1824f3e7502f42e1b4f0c0b3b..405b74669d4dd3c2e51c9bdcce4235be55ee3d08 100755 (executable)
@@ -62,14 +62,15 @@ def lanceEficas(code=None, multi=False, langue='en', labelCode=None):
     res=app.exec_()
     sys.exit(res)
 
-def getEficasSsIhm(code=None, multi=False, langue='en', labelCode=None):
-#------------------------------------------------------------------------
+def getEficasSsIhm(code=None, multi=False, langue='en', labelCode=None,forceXML=False):
+#-------------------------------------------------------------------------------------
     """
         Lance l'appli EFICAS sans Ihm
     """
     from Editeur  import session
     options = session.parse(sys.argv)
     if options.code   != None : code=options.code
+    if forceXML : options.withXSD=True
 
     from InterfaceQT4.qtEficasSsIhm import AppliSsIhm
     Eficas=AppliSsIhm(code=code, salome=0, multi=multi, langue=langue, labelCode=labelCode)
@@ -111,13 +112,13 @@ def genereXML(code=None):
        print ('comm file is needed')
        return
     
-    monEficasSsIhm = getEficasSsIhm(code=options.code)
+    monEficasSsIhm = getEficasSsIhm(code=options.code, forceXML=True)
 
     from .editorSsIhm import JDCEditorSsIhm
     monEditeur=JDCEditorSsIhm(monEficasSsIhm,fichier)
     fichierXML=fichier[:fichier.rfind(".")]+'.xml'
-    monEditeur.saveFile(fichierXML)
-    monEditeur.generator.writeDefault(fichierXML)
+    monEditeur.XMLGenerateur.gener(monEditeur.jdc)
+    monEditeur.XMLGenerateur.writeDefault(fichierXML)
 
 
 
index 6ee8679f228a039c2268383c1bc19ddfcc967b03..dab76fd3592d85fb393c2373ad95357806471350 100755 (executable)
@@ -999,13 +999,6 @@ if __name__=='__main__':
     sys.path.append(rep)
     from Adao import prefs
     from Adao import prefs_Adao
-    #if hasattr(prefsCode,'encoding'):
-       # Hack pour changer le codage par defaut des strings
-       #import sys
-       #reload(sys)
-       #sys.setdefaultencoding(prefsCode.encoding)
-       #del sys.setdefaultencoding
-       # Fin hack
 
     from Editeur import import_code
     from Editeur import session
index e58758172039b9ca7111689c6b5b27cf56128d73..f204ecbf1eb5833b9898ad433bb49761f958e3d6 100755 (executable)
@@ -65,6 +65,8 @@ class AppliSsIhm:
         self.repIcon=os.path.join( os.path.dirname(os.path.abspath(__file__)),'..','Editeur','icons')
 
         self.fichierCata=session.d_env.fichierCata
+        if session.d_env.labelCode : self.labelCode=session.d_env.labelCode
+        self.withXSD=session.d_env.withXSD
 
         if self.salome:
           import Accas
@@ -104,10 +106,11 @@ class AppliSsIhm:
           
 
         if ssCode != None :
-           self.format_fichier= ssCode  #par defaut
-           prefsCode.NAME_SCHEME=ssCode
+           self.formatFichierOut = ssCode  #par defaut
+           prefsCode.NAME_SCHEME = ssCode
         else :
-           self.format_fichier="python" #par defaut
+           self.formatFichierIn  = "python" #par defaut
+           self.formatFichierOut = "python" #par defaut
 
         nameConf='configuration_'+self.code
         try :
index 509e7c83310db30b883d70959e78043a5e457def..fccc20c3659d4013b0baa154cb69c028d4417620 100644 (file)
@@ -30,7 +30,6 @@ try :
    from builtins import object
 except : pass
 
-#import os,sys,py_compile
 import os, sys
 
 # Modules Eficas
@@ -49,7 +48,7 @@ from Extensions.eficas_exception import EficasException
 class ReaderCataCommun(object):
 #-------------------------------
 
-   def askChoixCatalogue(self, cata_choice_list):
+   def askChoixCatalogue(self, cataListeChoix):
    # ____________________________________________
       """
       Ouvre une fenetre de selection du catalogue dans le cas où plusieurs
@@ -68,7 +67,7 @@ class ReaderCataCommun(object):
           title=tr("Choix d une version ")
 
       from InterfaceQT4.monChoixCata import MonChoixCata
-      widgetChoix = MonChoixCata(self.appliEficas, [cata.user_name for cata in cata_choice_list], title)
+      widgetChoix = MonChoixCata(self.appliEficas, [cata.labelCode for cata in cataListeChoix], title)
       ret=widgetChoix.exec_()
 
 
@@ -77,14 +76,13 @@ class ReaderCataCommun(object):
       lab+=str(self.code)
       lab+=tr(" avec le catalogue ")
       if ret == QDialog.Accepted:
-          cata = cata_choice_list[widgetChoix.CBChoixCata.currentIndex()]
-          self.ficCata = cata.cata_file_path
-          self.labelCode = cata.identifier
-          self.appliEficas.format_fichier = cata.file_format
-          self.appliEficas.format_fichier_in = cata.file_format_in
+          cata = cataListeChoix[widgetChoix.CBChoixCata.currentIndex()]
+          self.fichierCata = cata.fichierCata
+          self.labelCode   = cata.labelCode
+          self.appliEficas.formatFichierOut = cata.formatFichierOut
+          self.appliEficas.formatFichierIn  = cata.formatFichierIn
           lab+=self.labelCode
           self.appliEficas.setWindowTitle(lab)
-          #qApp.mainWidget().setCaption(lab)
           widgetChoix.close()
       else:
           widgetChoix.close()
@@ -94,32 +92,37 @@ class ReaderCataCommun(object):
    # ____________________
 
  
-      liste_cata_possibles=[]
+      listeCataPossibles=[]
       self.Commandes_Ordre_Catalogue=[]
 
 
-      all_cata_list = []
+      listeTousLesCatas = []
       for catalogue in self.appliEficas.maConfiguration.catalogues:
-          if isinstance(catalogue, CatalogDescription): all_cata_list.append(catalogue)
-          elif isinstance(catalogue, tuple)           : all_cata_list.append(CatalogDescription.create_from_tuple(catalogue))
+          if isinstance(catalogue, CatalogDescription): listeTousLesCatas.append(catalogue)
+          elif isinstance(catalogue, tuple)           : listeTousLesCatas.append(CatalogDescription.createFromTuple(catalogue))
           else: print(("Catalog description cannot be interpreted: ", catalogue))
 
       # This filter is only useful for codes that have subcodes (like MAP).
       # Otherwise, the "code" attribute of the catalog description can (should) be None.
-      if self.ssCode is None: liste_cata_possibles = all_cata_list
+      if self.ssCode is None: listeCataPossibles = listeTousLesCatas
       else:
-          for catalogue in all_cata_list:
-             if catalogue.code == self.code and catalogue.file_format == self.ssCode: liste_cata_possibles.append(catalogue)
+          for catalogue in listeTousLesCatas:
+             if catalogue.code == self.code and catalogue.ssCode == self.ssCode: listeCataPossibles.append(catalogue)
 
-      # souci : c est pour la  version
+      # le catalogue est fixe dans la ligne de commande
       if self.appliEficas.fichierCata != None : 
-         for catalogue in all_cata_list: 
-             if os.path.abspath(catalogue.cata_file_path) ==  (os.path.abspath(self.appliEficas.fichierCata)) :
-                liste_cata_possibles=(catalogue,)
+         trouve=False
+         for catalogue in listeTousLesCatas: 
+             if os.path.abspath(catalogue.fichierCata) ==  (os.path.abspath(self.appliEficas.fichierCata)) :
+                listeCataPossibles=(catalogue,)
+                trouve=True
                 break
+         if not trouve:
+                catalogue=CatalogDescription.createFromTuple((self.code ,self.code,self.appliEficas.fichierCata,'python','python'))
+                listeCataPossibles=(catalogue,)
              
 
-      if len(liste_cata_possibles)==0:
+      if len(listeCataPossibles)==0:
           try : 
              from PyQt5.QtWidgets import QMessageBox, QDialog
              QMessageBox.critical(self.QWParent, tr("Import du catalogue"),
@@ -131,21 +134,21 @@ class ReaderCataCommun(object):
           return
 
 
+      # le label est fixe dans la ligne de commande
       if self.labelCode is not None:
           # La version a ete fixee
-          for cata in liste_cata_possibles:
-             if self.labelCode == cata.identifier:
-                self.ficCata = cata.cata_file_path
-                self.appliEficas.format_fichier = cata.file_format
-                self.appliEficas.format_fichier_in = cata.file_format_in
+          for cata in listeCataPossibles:
+             if self.labelCode == cata.labelCode:
+                self.fichierCata = cata.fichierCata
+                self.appliEficas.formatFichierIn  = cata.formatFichierIn
+                self.appliEficas.formatFichierOut = cata.formatFichierOut
       else:
-          cata_choice_list = []
-          for cata in liste_cata_possibles:
-              if cata.selectable:
-                  if cata.default : cata_choice_list.insert(0, cata)
-                  else            : cata_choice_list.append(cata)
+          cataListeChoix = []
+          for cata in listeCataPossibles:
+              if cata.default : cataListeChoix.insert(0, cata)
+              else            : cataListeChoix.append(cata)
 
-          if len(cata_choice_list) == 0:
+          if len(cataListeChoix) == 0:
               try : 
                 from PyQt5.QtWidgets import QMessageBox
                 QMessageBox.critical(self.QWParent, tr("Import du catalogue"),
@@ -155,11 +158,11 @@ class ReaderCataCommun(object):
               self.appliEficas.close()
               if self.appliEficas.salome == 0 : sys.exit(1)
 
-          elif len(cata_choice_list) == 1:
-              self.ficCata = cata_choice_list[0].cata_file_path
-              self.labelCode = cata_choice_list[0].identifier
-              self.appliEficas.format_fichier = cata_choice_list[0].file_format
-              self.appliEficas.format_fichier_in = cata_choice_list[0].file_format_in
+          elif len(cataListeChoix) == 1:
+              self.fichierCata = cataListeChoix[0].fichierCata
+              self.labelCode   = cataListeChoix[0].labelCode
+              self.appliEficas.formatFichierOut = cataListeChoix[0].formatFichierOut
+              self.appliEficas.formatFichierIn  = cataListeChoix[0].formatFichierIn
 
           else:
               # plusieurs catalogues sont disponibles : il faut demander a l'utilisateur
@@ -167,10 +170,10 @@ class ReaderCataCommun(object):
               if self.appliEficas.ssIhm : 
                  print ('Unable to know which catafile is choosen')
                  exit()
-              self.askChoixCatalogue(cata_choice_list)
+              self.askChoixCatalogue(cataListeChoix)
               self.demandeCatalogue=True
 
-      if self.ficCata == None :
+      if self.fichierCata == None :
           if self.appliEficas.salome == 0 :
              print(("Pas de catalogue pour code %s, version %s" %(self.code,self.labelCode)))
              sys.exit(1)
@@ -193,9 +196,11 @@ class ReaderCata (ReaderCataCommun):
       self.demandeCatalogue=False
       self.code=self.appliEficas.code
       self.ssCode=self.appliEficas.ssCode
-      self.appliEficas.format_fichier='python'
+      # on positionne par defaut mais est-ce vraiment necessaire
+      self.appliEficas.formatFichierIn='python'
+      self.appliEficas.formatFichierOut='python'
       self.labelCode=self.appliEficas.labelCode
-      self.ficCata=None
+      self.fichierCata=self.appliEficas.fichierCata
       self.openCata()
       self.traiteIcones()
       self.cataitem=None
@@ -211,17 +216,16 @@ class ReaderCata (ReaderCataCommun):
       # import du catalogue
       self.choisitCata()
 
-      if self.appliEficas.maConfiguration.withXSD :
+      if self.appliEficas.maConfiguration.withXSD or self.appliEficas.withXSD :
          try :
-           nomCataXsd = os.path.splitext(os.path.basename(self.ficCata))[0]+'_genere'
-           fichierCataTrunc=os.path.splitext(os.path.basename(self.ficCata))[0]  
+           nomCataXsd = os.path.splitext(os.path.basename(self.fichierCata))[0]
+           fichierCataTrunc=os.path.splitext(os.path.basename(self.fichierCata))[0]  
            #if fichierCataTrunc[0:4] in ('cata','Cata'): fichierCataTrunc=fichierCataTrunc[4:]
            #if fichierCataTrunc[0] in ('_','-') : fichierCataTrunc=fichierCataTrunc[1:]
            nomCataXsd = fichierCataTrunc+'_driver' 
 
     
-           pathCata = os.path.dirname(self.ficCata)+'/raw/'+nomCataXsd+'.py'
-#           modeleMetier=__import__('raw.cata_DPD_genere',fromlist=[''])
+           pathCata = os.path.dirname(self.fichierCata)+'/raw/'+nomCataXsd+'.py'
            import imp
            modeleMetier= imp.load_source(nomCataXsd,pathCata)
            #print ('_________________________', modeleMetier)
@@ -231,7 +235,7 @@ class ReaderCata (ReaderCataCommun):
       else :
            modeleMetier = None
 
-      self.cata = self.importCata(self.ficCata)
+      self.cata = self.importCata(self.fichierCata)
       if hasattr(self.cata, 'implement'): self.cata.JdC.implement = self.cata.implement
       else : self.cata.JdC.implement = ""
       if hasattr(self.cata, 'importedBy'): self.cata.JdC.importedBy = self.cata.importedBy
@@ -245,9 +249,9 @@ class ReaderCata (ReaderCataCommun):
       if not self.cata :
           try:
             from PyQt5.QtWidgets import QMessageBox, QDialog
-            QMessageBox.critical( self.QWParent, tr("Import du catalogue"),tr("Impossible d'importer le catalogue ")+ self.ficCata)
+            QMessageBox.critical( self.QWParent, tr("Import du catalogue"),tr("Impossible d'importer le catalogue ")+ self.fichierCata)
           except : 
-            print ("Impossible d'importer le catalogue "+ self.ficCata)
+            print ("Impossible d'importer le catalogue "+ self.fichierCata)
           self.appliEficas.close()
           if self.appliEficas.salome == 0 :
              sys.exit(1)
@@ -284,7 +288,7 @@ class ReaderCata (ReaderCataCommun):
       # traitement des clefs documentaires
       #
 
-      self.titre=self.VERSION_EFICAS+" "+tr( " avec le catalogue ") + os.path.basename(self.ficCata)
+      self.titre=self.VERSION_EFICAS+" "+tr( " avec le catalogue ") + os.path.basename(self.fichierCata)
       if self.appliEficas.ssIhm == False : self.appliEficas.setWindowTitle(self.titre)
       self.appliEficas.titre=self.titre
       self.QWParent.titre=self.titre
@@ -345,9 +349,9 @@ class ReaderCata (ReaderCataCommun):
           Retrouve l'ordre des mots-cles dans le catalogue, cad :
           Attention s appuie sur les commentaires
       """
-      nom_cata = os.path.splitext(os.path.basename(self.ficCata))[0]
-      rep_cata = os.path.dirname(self.ficCata)
-      self.Commandes_Ordre_Catalogue = analyse_catalogue_initial.analyseCatalogue(self.ficCata)
+      nom_cata = os.path.splitext(os.path.basename(self.fichierCata))[0]
+      rep_cata = os.path.dirname(self.fichierCata)
+      self.Commandes_Ordre_Catalogue = analyse_catalogue_initial.analyseCatalogue(self.fichierCata)
       #print self.Commandes_Ordre_Catalogue
 
    def traiteIcones(self):
index 8b3093184091c24a13400a925cb6f6e6508e36e8..9282b62261d76d381ad103d9342b75066f931763 100644 (file)
@@ -46,8 +46,9 @@ class ReaderCata (ReaderCataCommun):
       self.VERSION_EFICAS=self.appliEficas.VERSION_EFICAS
       self.code=self.appliEficas.code
       self.ssCode=self.appliEficas.ssCode
-      self.appliEficas.format_fichier='python'
-      self.appliEficas.format_fichier_in ='xml'
+      # PN ?? bizarre le 22/04/20
+      self.appliEficas.formatfichierOut='python'
+      self.appliEficas.formatfichierIn ='xml'
       self.modeNouvCommande=self.appliEficas.maConfiguration.modeNouvCommande
       self.labelCode=self.appliEficas.labelCode
       self.version_cata=None
diff --git a/Tools/generateXML.py b/Tools/generateXML.py
new file mode 100755 (executable)
index 0000000..49486b5
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2013   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""
+""
+  cree le .xml associe au .comm
+  generateXML.py -c leCatalogue le.comm
+
+"""
+# Modules Python
+# Modules Eficas
+
+import sys
+import os
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../'))
+
+from InterfaceQT4 import eficas_go
+eficas_go.genereXML(code='NonConnu')
diff --git a/Tools/qtEficasGui.py b/Tools/qtEficasGui.py
new file mode 100755 (executable)
index 0000000..b9e0faf
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2013   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""
+   Ce module sert a lancer EFICAS  contre l avis de Pascale sans directory associee
+   Dans ce cas on peut taper
+   a) de n importe ou sans avoir rien positionne :
+           /leCheminVersTools/qtEficasGui.py -c leFichierCatalogueAvecSonPathComplet
+   b) En ayant positionne le PYTHONPATH avec la directory qui contient ce qu il faut
+      c est a dire le prefs.py et prefs_leCode.py 
+      exemple pour Adao
+          /leCheminVersTools/qtEficasGui.py -k Adao 
+          /leCheminVersTools/qtEficasGui.py -k Adao -v V95
+
+"""
+# Modules Python
+# Modules Eficas
+
+import sys
+import os
+
+repIni=os.path.dirname(os.path.abspath(__file__))
+INSTALLDIR=os.path.join(repIni,'..')
+sys.path[:0]=[INSTALLDIR]
+#sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../..'))
+
+from InterfaceQT4 import eficas_go
+eficas_go.lanceEficas(code='NonConnu')
index f2c1b22b4aebe05b0cbea76869369caba3ee290d..93ee4bc5e026fd25d5291a30d3072094e5aec66e 100755 (executable)
@@ -31,7 +31,6 @@ import traceback
 import types,re,os
 from Extensions.i18n import tr
 from .generator_dicoImbrique import DicoImbriqueGenerator
-import pdb
 
 def entryPoint():
    """
index 6401ded1ccdabc79449610651f19b01b73d9626f..1bb13d6689c95172d9e7acffa9b74c77de54e498 100644 (file)
@@ -57,10 +57,11 @@ class XMLGenerator(PythonGenerator):
    def gener(self,obj,format='brut',config=None,appliEficas=None):
        
       try :
+      #if 1 :
         self.texteXML=obj.toXml()
       except : 
         self.texteXML='erreur generation'
-        pass
+      #  pass
       
       self.textePourAide =""
       self.dictNbNomObj={}