From a2494cca12ab102018a74caa62bcc92c13bdb40f Mon Sep 17 00:00:00 2001 From: PASCALE NOYRET Date: Fri, 1 Mar 2024 15:35:29 +0100 Subject: [PATCH] correction des bugs et des chemins pour la version qt eficas multi --- Accas/catalog/reader_cata.py | 7 +++---- Editeur/configuration.py | 21 ++++++++++++++------- Editeur/editor.py | 5 ++--- Editeur/editor_manager.py | 17 +++++------------ Editeur/eficas_appli.py | 7 +++---- Editeur/eficas_go.py | 3 ++- InterfaceGUI/QT5/monChoixCode.py | 19 ++++++++++--------- InterfaceGUI/QT5/qt_editor.py | 4 ++-- InterfaceGUI/QT5/qt_eficas.py | 9 +++------ InterfaceGUI/Web/.web_eficas.py.swp | Bin 0 -> 20480 bytes InterfaceGUI/Web/web_editor_manager.py | 5 ++--- InterfaceGUI/Web/web_eficas.py | 6 +++--- 12 files changed, 49 insertions(+), 54 deletions(-) create mode 100644 InterfaceGUI/Web/.web_eficas.py.swp diff --git a/Accas/catalog/reader_cata.py b/Accas/catalog/reader_cata.py index 4910e52f..5a8e72d4 100644 --- a/Accas/catalog/reader_cata.py +++ b/Accas/catalog/reader_cata.py @@ -80,12 +80,12 @@ class ReaderCataCommun(object): widgetChoix.close() raise EficasException() + #--------------------# def choisitCata(self): #--------------------# - listeCataPossibles = [] - listeTousLesCatas = [] + listeCataPossibles = [] for catalogue in self.appliEficas.maConfiguration.catalogues: if isinstance(catalogue, CatalogDescription): listeTousLesCatas.append(catalogue) @@ -106,7 +106,7 @@ class ReaderCataCommun(object): self.appliEficas.afficheMessage( tr("Import du catalogue"), tr("Pas de catalogue defini pour le code {}".format(self.code))) - self.appliEficas.close() + #self.appliEficas.close() if self.appliEficas.salome == 0: sys.exit(1) return @@ -181,7 +181,6 @@ class ReaderCataCommun(object): else: # plusieurs catalogues sont disponibles : il faut demander a l'utilisateur # lequel il veut utiliser ... - print ('PN : --> passer la commande askChoixCatalogue dans Editor avec sortie pour non QT / non Web') #self.appliEficas.afficheMessage( tr("Import du catalogue"), tr('Aucun catalogue choisi'), critique = True) self.demandeCatalogue = True self.askChoixCatalogue(cataListeChoix) diff --git a/Editeur/configuration.py b/Editeur/configuration.py index 1bda98f0..d0a87502 100644 --- a/Editeur/configuration.py +++ b/Editeur/configuration.py @@ -46,13 +46,16 @@ class BaseConfiguration(object): self.appliEficas = appliEficas self.code = appliEficas.code - if self.code == None: return self.salome = appliEficas.salome if self.salome: name = "prefs_eficas_salome.ini" else: name = "prefs_eficas.ini" - if sys.platform == 'linux' : self.repUser = os.path.join( os.path.expanduser("~"), '.config/Eficas',self.code) - else : self.repUser = os.path.join('C:/','.config/Eficas',self.code) + if self.code != None : + if sys.platform == 'linux' : self.repUser = os.path.join( os.path.expanduser("~"), '.config/Eficas',self.code) + else : self.repUser = os.path.join('C:/','.config/Eficas',self.code) + else : + if sys.platform == 'linux' : self.repUser = os.path.join( os.path.expanduser("~"), '.config/Eficas') + else : self.repUser = os.path.join('C:/','.config/Eficas') self.fichierPrefsUtilisateur = os.path.join(self.repUser, name) self.labelsStandards = ('PdfReader', 'saveDir', 'modeNouvCommande', 'afficheUQ', 'closeAutreCommande', 'closeFrameRechercheCommande', @@ -71,7 +74,7 @@ class BaseConfiguration(object): self.setValeursParDefaut() - if self.code != "": + if self.code != "" and self.code != None: self.lectureFichierIniStandard() self.lectureFichierIniIntegrateur() self.lectureFichierIniUtilisateur() @@ -93,9 +96,13 @@ class BaseConfiguration(object): # Valeurs par defaut self.pathDoc = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..","Doc")) - self.PedfReader = "acroread" - nomDir = "Eficas_" + self.code - self.saveDir = os.path.abspath(os.path.join(os.path.expanduser("~"), nomDir)) + self.PdfReader = "acroread" + + if self.code : + nomDir = "Eficas_" + self.code + self.saveDir = os.path.abspath(os.path.join(os.path.expanduser("~"), nomDir)) + else : + self.saveDir = os.path.abspath(os.path.expanduser("~")) self.modeNouvCommande = "initial" self.affiche = "alpha" self.closeAutreCommande = False diff --git a/Editeur/editor.py b/Editeur/editor.py index 7c5836ae..5dc397b8 100755 --- a/Editeur/editor.py +++ b/Editeur/editor.py @@ -57,9 +57,8 @@ class Editor: self.dicoNouveauxFact = {} self.dict_reels = {} self.liste_simp_reel = [] - self.idUnique = uuid1().hex - self.appliEficas.editorManager.dictEditors[self.idUnique]=self - + self.idEditor = uuid1().hex + self.appliEficas.editorManager.dictEditors[self.idEditor]=self # ces attributs sont mis a jour par definitCode appelee par newEditor diff --git a/Editeur/editor_manager.py b/Editeur/editor_manager.py index 21b75ccb..04fc0bd8 100644 --- a/Editeur/editor_manager.py +++ b/Editeur/editor_manager.py @@ -41,15 +41,15 @@ class EditorManager(object): self.doubles = {} - # ----------------------------------------------------- - def getEditor(self, fichier=None, jdc=None, include=0): - # ----------------------------------------------------- + # ----------------------------------------------------------------- + def getEditor(self, cata = None, fichier=None, jdc=None, include=0): + # ----------------------------------------------------------------- """ Retourne un nouvel editeur ou None si doublon """ if fichier == None : - self.appliEficas.afficheMessage('Eficas sans Ihm', + self.appliEficas.afficheMessage('Eficas', 'nom de fichier obligatoire pour obtenir un editor') return None for indexEditor in self.dictEditors: @@ -63,16 +63,9 @@ class EditorManager(object): self.appliEficas.afficheMessage('Eficas sans Ihm', 'impossible d allouer un editor') return None self.editors.append(editor) - idEditor = uuid1().hex - self.dictEditors[idEditor] = editor - editor.idEditor = idEditor + self.dictEditors[editor.idEditor] = editor return editor - # -------------------------------- - def setCurrentEditorById(self,id): - # -------------------------------- - print ('a Programmer') - return True # ------------------------- diff --git a/Editeur/eficas_appli.py b/Editeur/eficas_appli.py index ee3dc79a..e794efed 100755 --- a/Editeur/eficas_appli.py +++ b/Editeur/eficas_appli.py @@ -88,7 +88,6 @@ class EficasAppli: from Editeur.configuration import BaseConfiguration self.maConfiguration = BaseConfiguration(self) - self.suiteTelemac = False self.withUQ = False self.genereXSD = False from Editeur.editor_manager import EditorManager @@ -144,8 +143,8 @@ class EficasAppli: #------------------------------------------------------ #PN reflechir a ce que cela veut dire d avoir plusieurs editeurs if (hasattr(self, "editor")) and self.editor != None: - print("un seul editeur par application eficas_appli ") - sys.exit() + print("un seul editeur par application eficas_appli sans Ihm ? ") + # sys.exit() self.editor = self.editorManager.getEditor(fichier, jdc, include) return self.editor @@ -161,7 +160,7 @@ class EficasAppli: return self.editorManager.setCurrentEditorById(self,id) #--------------------------- - def openFile(self, fichier): + def openDataSet(self, fichier): #--------------------------- try: monEditor = self.editorManager.openFile(fichier) diff --git a/Editeur/eficas_go.py b/Editeur/eficas_go.py index 4385b4ce..3ce489f8 100755 --- a/Editeur/eficas_go.py +++ b/Editeur/eficas_go.py @@ -256,4 +256,5 @@ def createObjetPythonFromDocumentAccas(fichierCata=None, fichier=None, code=None if __name__ == "__main__": - pass + if repIni not in sys.path : sys.path.insert(0,repIni) + lanceQtEficas(multi=True) diff --git a/InterfaceGUI/QT5/monChoixCode.py b/InterfaceGUI/QT5/monChoixCode.py index 21253779..1f6091cb 100644 --- a/InterfaceGUI/QT5/monChoixCode.py +++ b/InterfaceGUI/QT5/monChoixCode.py @@ -27,6 +27,7 @@ from PyQt5.QtWidgets import QDialog, QRadioButton, QGroupBox, QButtonGroup from PyQt5.QtGui import QPalette from PyQt5.QtCore import QProcess, QFileInfo, Qt, QSize +listeCode = ("Telemac", "ReacteurNumerique", "Adao", "A", "B") # Import des panels @@ -57,10 +58,9 @@ class MonChoixCode(Ui_ChoixCode, QDialog): def verifieInstall(self): self.groupCodes = QButtonGroup(self.groupBox) vars = list(os.environ.items()) - listeCode = ("Telemac", "ReacteurNumerique", "Adao") for code in listeCode: dirCode = os.path.abspath( - os.path.join(os.path.abspath(__file__), "../..", code) + os.path.join(os.path.abspath(__file__), "../../../Codes", code) ) try: l = os.listdir(dirCode) @@ -94,24 +94,25 @@ class MonChoixCode(Ui_ChoixCode, QDialog): self.groupCodes.addButton(bouton) except: pass - self.appliEficas.listeCode = self.appliEficas.listeCode + listeCodesIntegrateur def choisitCode(self): bouton = self.groupCodes.checkedButton() if bouton == None: return code = str(bouton.text()) - codeUpper = code.upper() - self.appliEficas.code = codeUpper + self.appliEficas.code = code try: dirCode = os.path.abspath( - os.path.join(os.path.abspath(__file__), "../..", code) + os.path.join(os.path.abspath(__file__), "../../../Codes", code) ) l = os.listdir(dirCode) sys.path.insert(0, dirCode) except: clef = "PREFS_CATA_" + code - repIntegrateur = os.path.abspath(os.environ[clef]) - l = os.listdir(repIntegrateur) - sys.path.insert(0, repIntegrateur) + try: + repIntegrateur = os.path.abspath(os.environ[clef]) + l = os.listdir(repIntegrateur) + sys.path.insert(0, repIntegrateur) + except : + print ('probleme voir la maintenance pour definir le code') self.close() diff --git a/InterfaceGUI/QT5/qt_editor.py b/InterfaceGUI/QT5/qt_editor.py index 413f3257..6c35db38 100755 --- a/InterfaceGUI/QT5/qt_editor.py +++ b/InterfaceGUI/QT5/qt_editor.py @@ -72,8 +72,8 @@ class QtEditor(Editor, Ui_baseWidget, QWidget): Editor.__init__(self, appliEficas, fichier, jdc, include) # on enleve la gestion du dicEditor necessaire dans les autres cas - # mais ici l index est le numero de page et non l idUnique - del self.appliEficas.editorManager.dictEditors[self.idUnique] + # mais ici l index est le numero de page et non l idEditor + del self.appliEficas.editorManager.dictEditors[self.idEditor] if self.jdc: comploader.chargerComposants(self.appliEficas.GUIPath) diff --git a/InterfaceGUI/QT5/qt_eficas.py b/InterfaceGUI/QT5/qt_eficas.py index 24d1da9b..da16ce09 100755 --- a/InterfaceGUI/QT5/qt_eficas.py +++ b/InterfaceGUI/QT5/qt_eficas.py @@ -58,15 +58,12 @@ class QtEficasAppli(EficasAppli, Ui_Eficas, QMainWindow): self.GUIPath = GUIPath self.suiteTelemac = self.maConfiguration.suiteTelemac self.multi = multi - if self.multi : - self.definitCode(code, None) - if self.code == None: return - if self.maConfiguration.demandeLangue: from InterfaceGUI.QT5.monChoixLangue import MonChoixLangue widgetLangue = MonChoixLangue(self) ret = widgetLangue.exec_() + self.recemmentUtilises = [] from Accas.extensions import localisation localisation.localise(None, self.langue, translatorFile=self.maConfiguration.translatorFile,) self.repIcon = os.path.join( os.path.dirname(os.path.abspath(__file__)),"..", "..", "Editeur", "icons") @@ -152,7 +149,7 @@ class QtEficasAppli(EficasAppli, Ui_Eficas, QMainWindow): widgetChoix = MonChoixCode(self) ret = widgetChoix.exec_() if self.code == None: - return # pour le cancel de la fenetre choix code + return # pour permettre une sortie propre EficasAppli.definitCode(self, self.code, ssCode) @@ -309,7 +306,7 @@ class QtEficasAppli(EficasAppli, Ui_Eficas, QMainWindow): #------------------------------------ if hasattr(self, "rechercherDejaLa"): return self.rechercherDejaLa = True - self.actionRechercherDsCatalogue.triggered.connect( self.rechercherDejaLaechercherMotClefDsCatalogue) + self.actionRechercherDsCatalogue.triggered.connect( self.rechercherMotClefDsCatalogue) #----------------------------- def ajoutSortieComplete(self): diff --git a/InterfaceGUI/Web/.web_eficas.py.swp b/InterfaceGUI/Web/.web_eficas.py.swp new file mode 100644 index 0000000000000000000000000000000000000000..5fe9d4aacd2aa4deafd086acb5b100c317019c84 GIT binary patch literal 20480 zcmeHNO>87b6|N-#!cQP1{74|Ax8txLFZ1ig*z09P#$MYylI?Zu@vaOBL(g>0Op~7O zrn=hBTo!T20Yt(D5s^J2CE-FizzMh@lnX+FNF>Sy2?U8qjtGzdA-<~qnHhW6UWit# zP_^~Br@Ojd)%)J7S5@7wUAfZOpoP*b!*L&D)35)Ii!)bFz3_F$>gPXQnO#r?#~*eW zR4eoI)%m&OpSu2NMc3-^wcSSfDsPt$c)JxpPzr{} zi#4T&0mHya3`DY9T)3B=o2^#Vqf@!l^uYbQC)G0Lh5^HXVZbn87%&VN1`Gp+0mH!m z5d$)~i+u(9ye-jbF*%<)biO;eKAoIDbEy2TXMlgai?PoEKfZ^t7l7-)H-V1=uf3D8p92=K32XrCz{i0%cR>cYr4V8(0Q%z=wcW@Z#eKz$3tCfiu7- zfDZsK<7LQo;EO;J_%QGryjXb=cnWwD_y+JTAUo&PdJyENtuC@9`h0_j zq1EHl1(J>w{F9PDF8K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@=t_FWMatm7ZWGbTBQZ?l&F^p0(vr$NaqATn} zbbF{pPgsIRj&T8NA~Y>fec;hVNJ& z3_em@wPbmA8T$-10G8nZ!s+#~5?r34*-B-;I9r+h6e7>c#Z}rqa}m!J&lc6Bj1aI0 z3jN~3!rb{{Ro!M&r^`_&%5BFhb8nx5q3rt}Q~Uq#V_*Lgp!WaRqUz(1$-Q5z`{pnV z7zPXjh5^HXVZbn87%&VN1`Gp+0mFb{;0|K|?*pGHFkl!k3>XFs1BQVU7*LDxI_mZqvl{bXc-AyFj kEe#uXUL}-%zVhfy$@2%JJUZ0jZb$LjV8( literal 0 HcmV?d00001 diff --git a/InterfaceGUI/Web/web_editor_manager.py b/InterfaceGUI/Web/web_editor_manager.py index 74c0b3c5..56f26943 100644 --- a/InterfaceGUI/Web/web_editor_manager.py +++ b/InterfaceGUI/Web/web_editor_manager.py @@ -48,17 +48,16 @@ class WebEditorManager(EditorManager): # ------------------------------------------------------ - def getEditor(self, fichier=None, jdc=None, session = 1 ): + def getEditor(self, sId=None, cata=None, fichier=None # ------------------------------------------------------ """ Retourne un nouvel editeur ou le meme si doublon gere la liste des connexions pour propager les infos - a affiner : le nom du fichier n est pas determinant il faut aussi la machine dont il provient """ for indexEditor in self.dictEditors: editor = self.dictEditors[indexEditor] - if self.samePath(fichier, editor.getFileName()): + if self.samePath(cata, editor.getCataName()) and self.samePath(fichier, editor.getFileName()): double = editor break else: diff --git a/InterfaceGUI/Web/web_eficas.py b/InterfaceGUI/Web/web_eficas.py index b63e97f8..c79b6c1f 100755 --- a/InterfaceGUI/Web/web_eficas.py +++ b/InterfaceGUI/Web/web_eficas.py @@ -51,14 +51,14 @@ class WebEficasAppli(EficasAppli): #----------------------------------------- - def toWebApp(self, fction,*args, **kwargs): + def toWebApp(self,fction, sid, eid *args, **kwargs): #----------------------------------------- #if fction =='propageValide' : debug=0 - if debug : print ('PNPNPN : WebEficasAppli.toWebApp', fction, *args, **kwargs) + if debug : print ('PNPNPN : WebEficasAppli.toWebApp', fction, sid, eid, *args, **kwargs) if self.appWeb == None : return #if fction =='propageValide' : print ('self.appWeb.toWebApp propageValide', self.monEditeur.getNodeById(args[0]).nom) - self.appWeb.fromConnecteur(fction, *args, **kwargs) + self.appWeb.fromConnecteur(fction, sid, eid, *args, **kwargs) #----------------------- def createEditor(self): -- 2.39.2