From: pascale.noyret Date: Mon, 12 Aug 2019 13:42:06 +0000 (+0200) Subject: Modifications liees a MT X-Git-Tag: V9_3_1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3d0a860f340b452282ce8849add60c6a7ae82562;p=tools%2Feficas.git Modifications liees a MT --- diff --git a/Ihm/I_JDC.py b/Ihm/I_JDC.py index 5d8c3641..4cd44491 100644 --- a/Ihm/I_JDC.py +++ b/Ihm/I_JDC.py @@ -549,13 +549,19 @@ class JDC(I_OBJECT.OBJECT): e.updateContext(context) def analyse(self): - if self.editor.format == 'xml' : + try : + if self.editor.format == 'xml' : # il ne faut pas le faire quand le jeu de donnees est vide self.setCurrentContext() self.analyseFromXML() #print ('stop demande'); exit() #self.execCompileFromXML() - else : + else : + self.compile() + self.execCompile() + if not self.cr.estvide():return + self.activeEtapes() + except: self.compile() self.execCompile() if not self.cr.estvide():return diff --git a/Ihm/I_MACRO_ETAPE.py b/Ihm/I_MACRO_ETAPE.py index 0de991d8..1503f3d4 100644 --- a/Ihm/I_MACRO_ETAPE.py +++ b/Ihm/I_MACRO_ETAPE.py @@ -82,6 +82,7 @@ class MACRO_ETAPE(I_ETAPE.ETAPE): #print ("getContexteJdc",self,self.nom, text) # On recupere l'etape courante step=CONTEXT.getCurrentStep() + self.text_included_converted=0 #try: if 1 : # on essaie de creer un objet JDC auxiliaire avec un contexte initial @@ -142,9 +143,13 @@ class MACRO_ETAPE(I_ETAPE.ETAPE): jdc_pere=self.jdc,etape_include=self, prefix_include=prefix_include, recorded_units=self.recorded_units, - old_recorded_units=old_recorded_units,**args) + old_recorded_units=old_recorded_units) + #old_recorded_units=old_recorded_units,**args) j.analyse() + if not j.cr.estvide(): self.text_included_converted=0 + else : self.text_included_converted=1 + self.text_included_error=str(j.cr) # On recupere les etapes internes (pour validation) self.etapes=j.etapes self.jdc_aux=j diff --git a/InterfaceQT4/editor.py b/InterfaceQT4/editor.py index e08b3268..8db32eb9 100755 --- a/InterfaceQT4/editor.py +++ b/InterfaceQT4/editor.py @@ -946,6 +946,11 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget): # ajoute une etape de JdC a partir d un texte CONTEXT.setCurrentStep(etape) etape.buildIncludeEtape(texte) + if not (etape.text_included_converted) : + QMessageBox.information( self, + tr("Impossible d importer le texte"), + etape.text_included_error) + self.tree.racine.buildChildren() #-----------------------------------# diff --git a/InterfaceQT4/gereListe.py b/InterfaceQT4/gereListe.py index ff4577d6..f3c2c6cb 100644 --- a/InterfaceQT4/gereListe.py +++ b/InterfaceQT4/gereListe.py @@ -30,8 +30,6 @@ import types,os import traceback -import six -from six.moves import range from PyQt5.QtWidgets import QLineEdit, QLabel, QFileDialog from PyQt5.QtCore import QEvent, Qt, QTimer from PyQt5.QtGui import QIcon, QPalette @@ -296,7 +294,7 @@ class GereListe(object): fn=fn[0] if fn == None : return if fn == "" : return - ulfile = os.path.abspath(six.text_type(fn)) + ulfile = os.path.abspath(fn) self.editor.maConfiguration.savedir=os.path.split(ulfile)[0] from .monSelectVal import MonSelectVal diff --git a/InterfaceQT4/monWidgetCommandeDeplie1Niveau.py b/InterfaceQT4/monWidgetCommandeDeplie1Niveau.py index 9fa4cbd1..c03a17c1 100644 --- a/InterfaceQT4/monWidgetCommandeDeplie1Niveau.py +++ b/InterfaceQT4/monWidgetCommandeDeplie1Niveau.py @@ -80,7 +80,7 @@ class MonWidgetCommandeDeplie1Niveau(MonWidgetCommande): c.getPanel = self.getPanel c.affichePanneau = self.affichePanneau try : - c.fenetre.RBDeplie.setCheckable(False) + c.fenetre.RBDeplie.setCheckable(False) c.fenetre.RBDeplie.setEnabled(False) c.fenetre.RBDeplie.setIcon(icon) except : diff --git a/InterfaceQT4/qtEficas.py b/InterfaceQT4/qtEficas.py index e02e0aa3..f00e8b1c 100755 --- a/InterfaceQT4/qtEficas.py +++ b/InterfaceQT4/qtEficas.py @@ -974,17 +974,18 @@ class Appli(AppliSsIhm,Ui_Eficas,QMainWindow): self.lesFonctionsUtilisateurs={} if self.code not in self.mesScripts : return if not hasattr(self.mesScripts[self.code],'dict_menu') : return - titre,lesFonctions=self.mesScripts[self.code].dict_menu.items()[0] - self.menuOptions = self.menubar.addMenu("menuOptions") - self.menuOptions.setTitle(tr(titre)) - for elt in lesFonctions : - laFonctionUtilisateur, label, lesArguments = elt - action = QAction(self) - action.setText(label) + for monMenu in iter(self.mesScripts[self.code].dict_menu.items()) : + titre,lesFonctions= monMenu + self.menuOptions = self.menubar.addMenu("menuOptions") + self.menuOptions.setTitle(tr(titre)) + for elt in lesFonctions : + laFonctionUtilisateur, label, lesArguments = elt + action = QAction(self) + action.setText(label) #action.triggered.connect(self.appelleFonctionUtilisateur) - self.menuOptions.addAction(action) - self.lesFonctionsUtilisateurs[action]=(laFonctionUtilisateur, lesArguments) - self.menuOptions.triggered.connect(self.handleFonctionUtilisateur) + self.menuOptions.addAction(action) + self.lesFonctionsUtilisateurs[action]=(laFonctionUtilisateur, lesArguments) + self.menuOptions.triggered.connect(self.handleFonctionUtilisateur) def handleFonctionUtilisateur(self,action) : (laFonctionUtilisateur, lesArguments)=self.lesFonctionsUtilisateurs[action] diff --git a/InterfaceQT4/viewManager.py b/InterfaceQT4/viewManager.py index 4d66fda4..78955b0a 100644 --- a/InterfaceQT4/viewManager.py +++ b/InterfaceQT4/viewManager.py @@ -26,7 +26,6 @@ except : pass import os from Extensions.i18n import tr -import six from PyQt5.QtWidgets import QFileDialog, QMessageBox from PyQt5.QtCore import QFileInfo @@ -77,8 +76,8 @@ class MyViewManager(object): extensions) fichier=fichier[0] if len(fichier) == 0: return None - fichier = os.path.abspath(six.text_type(fichier)) - ulfile = os.path.abspath(six.text_type(fichier)) + fichier = os.path.abspath(fichier) + ulfile = os.path.abspath(fichier) self.appliEficas.maConfiguration.savedir=os.path.split(ulfile)[0] self.appliEficas.addToRecentList(fichier) maPage=self.getEditor( fichier,units=units) @@ -248,7 +247,7 @@ class MyViewManager(object): return ok, newName = editor.saveFile() if ok : - fileName=os.path.basename(six.text_type(newName)) + fileName=os.path.basename(newName) self.myQtab.setTabText(index,fileName) return ok @@ -271,7 +270,7 @@ class MyViewManager(object): return ok, newName = editor.sauveLigneFile() if ok : - fileName=os.path.basename(six.text_type(newName)) + fileName=os.path.basename(newName) self.myQtab.setTabText(index,fileName) return ok @@ -282,7 +281,7 @@ class MyViewManager(object): oldName=editor.fichier ok,newName = editor.saveFileAs() if ok : - fileName=os.path.basename(six.text_type(newName)) + fileName=os.path.basename(newName) self.myQtab.setTabText(index,fileName) if editor in self.doubles : if oldName != newName : @@ -340,7 +339,7 @@ class MyViewManager(object): #PNPNPNPN --> a affiner if fichier is None: self.untitledCount += 1 - self.myQtab.addTab(win, tr("Fichier non encore nomme " + self.appliEficas.readercata.versionCode, self.untitledCount)) + self.myQtab.addTab(win, tr("Fichier non encore nomme") + str(self.untitledCount)) #self.myQtab.addTab(win, str(self.appliEficas.code)) else: liste=fichier.split('/') @@ -400,7 +399,7 @@ class MyViewManager(object): if res == 0: (ok, newName) = editor.saveFile() if ok: - fileName=os.path.basename(six.text_type(newName)) + fileName=os.path.basename(newName) index=self.myQtab.currentIndex() self.myQtab.setTabText(index,fileName) return ok @@ -425,9 +424,8 @@ class MyViewManager(object): listeParam = [] for p in lesArguments: - print (p) if hasattr(editor,p): listeParam.append(getattr(editor,p)) if p=="editor" : listeParam.append(editor) if p=="etapeCourante" : listeParam.append(editor.getEtapeCourante()) - apply(laFonctionUtilisateur,listeParam) + laFonctionUtilisateur(*listeParam) diff --git a/Noyau/N_JDC.py b/Noyau/N_JDC.py index 172ed05a..2b4a9dda 100644 --- a/Noyau/N_JDC.py +++ b/Noyau/N_JDC.py @@ -264,7 +264,7 @@ Causes possibles : except NameError as e: etype, value, tb = sys.exc_info() l = traceback.extract_tb(tb) - s = traceback.format_exception_only("Erreur de nom", e)[0][:-1] + s = traceback.format_exception_only(NameError,e) msg = "erreur de syntaxe, %s ligne %d" % (s, l[-1][1]) if CONTEXT.debug: traceback.print_exc() diff --git a/Noyau/nommage.py b/Noyau/nommage.py index 72b4ceed..e8a24ee2 100644 --- a/Noyau/nommage.py +++ b/Noyau/nommage.py @@ -42,6 +42,7 @@ except : pass import re import linecache +import sys from functools import partial # Modules EFICAS @@ -77,7 +78,10 @@ def _getNomConceptResultat(ope, level=2): lineno = f.f_lineno # XXX Too bad if -O is used # lineno = f_lineno(f) # Ne marche pas toujours co = f.f_code - filename = six.text_type(co.co_filename, getEncoding()) + if sys.version_info >= (3,0) : + filename = co.co_filename + else : + filename = six.text_type(co.co_filename, getEncoding()) name = co.co_name # pattern pour identifier le debut de la commande pattern_oper = re.compile(regex1 % ope)