From: pascale.noyret Date: Fri, 4 Dec 2015 10:49:36 +0000 (+0100) Subject: merge Nizhny X-Git-Tag: nouvelEficas_V7_7_1rc1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=221da48db3beb709c3674e1f455690faa9cf0195;p=tools%2Feficas.git merge Nizhny --- diff --git a/InterfaceQT4/composimp.py b/InterfaceQT4/composimp.py index c8dac6ca..607eec62 100644 --- a/InterfaceQT4/composimp.py +++ b/InterfaceQT4/composimp.py @@ -165,8 +165,12 @@ class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal): elif self.item.has_into(): if self.item.is_list_SansOrdreNiDoublon(): #print 6 - from monWidgetPlusieursInto import MonWidgetPlusieursInto - widget=MonWidgetPlusieursInto(self,maDefinition,monNom,monObjet,parentQt,maCommande) + if self.item in self.editor.listeDesListesOuvertes or not(self.editor.afficheListesPliees) : + from monWidgetPlusieursInto import MonWidgetPlusieursInto + widget=MonWidgetPlusieursInto(self,maDefinition,monNom,monObjet,parentQt,maCommande) + else : + from monWidgetPlusieursPlie import MonWidgetPlusieursPlie + widget=MonWidgetPlusieursPlie(self,maDefinition,monNom,monObjet,parentQt,maCommande) else : #print 7 # tres vite pour le tag mais devra etre gere dans configuration @@ -303,6 +307,7 @@ class SIMPTreeItem(Objecttreeitem.AtomicObjectTreeItem): return valeurs def get_liste_possible(self,listeActuelle=[]): + print "llllllllllllllllllllllkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk" if hasattr(self.definition.validators,'into'): valeurspossibles = self.definition.validators.into else: @@ -327,6 +332,7 @@ class SIMPTreeItem(Objecttreeitem.AtomicObjectTreeItem): encorevalide=self.valide_liste_partielle(item,listeActuelle) if encorevalide : listevalideliste.append(item) + print listevalideliste return listevalideliste def get_liste_param_possible(self): diff --git a/InterfaceQT4/feuille.py b/InterfaceQT4/feuille.py index 79bb9e72..9f7f4889 100644 --- a/InterfaceQT4/feuille.py +++ b/InterfaceQT4/feuille.py @@ -177,10 +177,28 @@ class Feuille(QWidget,ContientIcones,SaisieValeur,FacultatifOuOptionnel): #self.editor.fenetreCentraleAffichee.rendVisibleNoeud(nodeAVoir) #nodeAVoir.fenetre.setFocus() # return # on est bien postionne - if self.objSimp.isvalid() and hasattr(self, 'AAfficher'): - self.editor.fenetreCentraleAffichee.afficheSuivant(self.AAfficher) + + if self.objSimp.isvalid() and hasattr(self, 'AAfficher'): + nodeAVoir=self.parentQt.node.chercheNoeudCorrespondant(self.objSimp) + try : + index=self.editor.fenetreCentraleAffichee.listeAffichageWidget.index(nodeAVoir.fenetre.AAfficher) + if (index==len(self.editor.fenetreCentraleAffichee.listeAffichageWidget)-1) : + try : + nodeAVoir.fenetre.setValeursApresBouton() + except : + pass + else : + self.editor.fenetreCentraleAffichee.afficheSuivant(nodeAVoir.fenetre.AAfficher) + except : + pass else : - if hasattr(self, 'AAfficher'): self.AAfficher.setFocus(7) + if self.objSimp.isvalid() and hasattr(self, 'AAfficher'): + try : + self.setValeursApresBouton() + except : + self.editor.fenetreCentraleAffichee.afficheSuivant(self.AAfficher) + else : + if hasattr(self, 'AAfficher'): self.AAfficher.setFocus(7) def reaffichePourDeplier(self): self.parentQt.reaffiche() diff --git a/InterfaceQT4/gereIcones.py b/InterfaceQT4/gereIcones.py index 2ef27183..9073e563 100644 --- a/InterfaceQT4/gereIcones.py +++ b/InterfaceQT4/gereIcones.py @@ -168,6 +168,7 @@ class FacultatifOuOptionnel: icon=QIcon(self.repIcon+"/ast-green-ball.png") else : icon=QIcon(self.repIcon+"/ast-red-ball.png") + print "lllllllllllllllllllllllllllllllll" self.RBValide.setIcon(icon) # il faut chercher la bonne fenetre diff --git a/InterfaceQT4/monBoutonValide.py b/InterfaceQT4/monBoutonValide.py index 43ea8228..7ae919ff 100644 --- a/InterfaceQT4/monBoutonValide.py +++ b/InterfaceQT4/monBoutonValide.py @@ -43,6 +43,7 @@ class MonBoutonValide(QToolButton) : myToolTip=QString(tr("objet valide")) QToolTip.showText(event.globalPos(),myToolTip ) else : + t="" texte=unicode(self.parent.node.item.object.report()) deb=1 for l in texte.split('\n')[2:-2]: diff --git a/InterfaceQT4/monWidgetBloc.py b/InterfaceQT4/monWidgetBloc.py index 0ac25d25..b4fa2344 100644 --- a/InterfaceQT4/monWidgetBloc.py +++ b/InterfaceQT4/monWidgetBloc.py @@ -31,6 +31,6 @@ class MonWidgetBloc(Ui_WidgetBloc,Groupe): """ def __init__(self,node,editor,parentQt,definition, obj, niveau,commande): Groupe.__init__(self,node,editor,parentQt, definition,obj,niveau,commande) - self.parentQt.commandesLayout.insertWidget(-1,self) + self.parentQt.commandesLayout.insertWidget(-1,self,1) diff --git a/InterfaceQT4/monWidgetCommande.py b/InterfaceQT4/monWidgetCommande.py index d21333b0..3e884c6f 100644 --- a/InterfaceQT4/monWidgetCommande.py +++ b/InterfaceQT4/monWidgetCommande.py @@ -85,6 +85,7 @@ class MonWidgetCommande(Ui_WidgetCommande,Groupe): self.monOptionnel=MonWidgetOptionnel(self) self.editor.widgetOptionnel=self.monOptionnel self.editor.splitter.addWidget(self.monOptionnel) + self.editor.restoreSplitterSizes() self.afficheOptionnel() #print "fin init de widget Commande" @@ -131,6 +132,17 @@ class MonWidgetCommande(Ui_WidgetCommande,Groupe): w.focusNextChild() self.inhibe=0 return True + if i==0 and next==True and not self.inhibe: + self.listeAffichageWidget[0].setFocus(7) + self.inhibe=1 + w=self.focusWidget() + w.focusNextChild() + self.inhibe=0 + return True + if i>0 and next==False and not self.inhibe: + if isinstance(self.listeAffichageWidget[i-1],QRadioButton): + self.listeAffichageWidget[i-1].setFocus(7) + return True return QWidget.focusNextPrevChild(self, next) def etablitOrdre(self): diff --git a/InterfaceQT4/monWidgetOptionnel.py b/InterfaceQT4/monWidgetOptionnel.py index 2bcef99c..e3d86408 100644 --- a/InterfaceQT4/monWidgetOptionnel.py +++ b/InterfaceQT4/monWidgetOptionnel.py @@ -121,3 +121,6 @@ class MonWidgetOptionnel (QWidget,Ui_WidgetOptionnel): #print "dans Optionnel __ ajout de ", maListe self.parentMC.ajoutMC(maListe) + def hide(self): + self.parentQt.editor.saveSplitterSizes() + QWidget.hide(self) diff --git a/InterfaceQT4/monWidgetPlusieursBase.py b/InterfaceQT4/monWidgetPlusieursBase.py index 3e878f2d..6bd555b0 100644 --- a/InterfaceQT4/monWidgetPlusieursBase.py +++ b/InterfaceQT4/monWidgetPlusieursBase.py @@ -39,7 +39,7 @@ hauteurMax=253 class MonWidgetPlusieursBase (Ui_WidgetPlusieursBase,Feuille,GereListe,GerePlie): def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande): - #print "MonWidgetPlusieursBase", nom + print "MonWidgetPlusieursBase", nom self.nomLine="lineEditVal" self.inInit=True self.indexDernierLabel=0 diff --git a/InterfaceQT4/monWidgetPlusieursInto.py b/InterfaceQT4/monWidgetPlusieursInto.py index 26a5b480..efac292b 100644 --- a/InterfaceQT4/monWidgetPlusieursInto.py +++ b/InterfaceQT4/monWidgetPlusieursInto.py @@ -39,8 +39,11 @@ class MonWidgetPlusieursInto (Ui_WidgetPlusieursInto,Feuille,GerePlie): Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande) self.listeValeursCourantes=self.node.item.GetListeValeurs() self.parentQt.commandesLayout.insertWidget(-1,self) + #if len(self.listeValeursCourantes) == len(self.monSimpDef.into) : self.CBCheck.setChecked(False) + #else : self.CBCheck.setChecked(True) self.connect(self.CBCheck, SIGNAL('stateChanged(int)'),self.change) self.gereIconePlier() + self.inhibe=False # try except si la liste des possibles est vide # prevoir qqchose try : @@ -50,17 +53,22 @@ class MonWidgetPlusieursInto (Ui_WidgetPlusieursInto,Feuille,GerePlie): def change(self,int): - if self.CBCheck.isChecked() : + if self.inhibe:return + self.inhibe=True + if not(self.CBCheck.isChecked()) : for i in range(len(self.listeAAfficher)): nomCB="lineEditVal"+str(i+1) courant=getattr(self,nomCB) courant.setChecked(True) + self.CBCheck.setChecked(False) else : min,max = self.node.item.GetMinMax() for i in range(len(self.listeAAfficher)): nomCB="lineEditVal"+str(i+1) courant=getattr(self,nomCB) courant.setChecked(False) + self.CBCheck.setChecked(True) + self.inhibe=False def setValeurs(self): self.listeValeursCourantes=self.node.item.GetListeValeurs() @@ -186,6 +194,10 @@ class MonWidgetPlusieursInto (Ui_WidgetPlusieursInto,Feuille,GerePlie): self.editor.affiche_infos(tr("")) if self.listeValeursCourantes== [] : self.listeValeursCourantes=None self.node.item.set_valeur(self.listeValeursCourantes) + if self.listeValeursCourantes != None and (len(self.listeValeursCourantes) != len(self.monSimpDef.into)) : + self.inhibe=True + self.CBCheck.setChecked(True) + self.inhibe=False self.setValide() self.reaffiche() diff --git a/InterfaceQT4/monWidgetPlusieursIntoOrdonne.py b/InterfaceQT4/monWidgetPlusieursIntoOrdonne.py index 1f1ce2cd..6d43dcec 100644 --- a/InterfaceQT4/monWidgetPlusieursIntoOrdonne.py +++ b/InterfaceQT4/monWidgetPlusieursIntoOrdonne.py @@ -43,6 +43,7 @@ class MonWidgetPlusieursIntoOrdonne (Ui_WidgetPlusieursIntoOrdonne, Feuille,Gere self.nomLine="LEResultat" self.listeLE=[] self.ouAjouter=0 + self.NumLineEditEnCours=0 Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande) GereListe.__init__(self) self.initCommentaire() @@ -67,6 +68,7 @@ class MonWidgetPlusieursIntoOrdonne (Ui_WidgetPlusieursIntoOrdonne, Feuille,Gere def prepareListeResultat(self): + print "prepareListeResultat" for i in self.listeLE: i.close() self.listeLE=[] self.vScrollBar = self.scrollArea.verticalScrollBar() @@ -154,6 +156,8 @@ class MonWidgetPlusieursIntoOrdonne (Ui_WidgetPlusieursIntoOrdonne, Feuille,Gere nouveauLE.setFocus() setattr(self,nomLE,nouveauLE) + def ajoutLineEdit(self): + self.ajoutLEResultat (self.indexDernierLabel) def traiteClicSurLabelListe(self,valeur): diff --git a/InterfaceQT4/monWidgetRadioButton.py b/InterfaceQT4/monWidgetRadioButton.py index fa5b7c6c..176dbee0 100644 --- a/InterfaceQT4/monWidgetRadioButton.py +++ b/InterfaceQT4/monWidgetRadioButton.py @@ -50,6 +50,7 @@ class MonWidgetRadioButtonCommun (Feuille): if not(type(valeur) in types.StringTypes) : valeur=str(valeur) try : self.dict_bouton[valeur].setChecked(True) + self.dict_bouton[valeur].setFocus(True) except : pass @@ -88,6 +89,7 @@ class MonWidgetRadioButtonCommun (Feuille): def keyPressEvent(self, event): if event.key() == Qt.Key_Right : self.selectSuivant(); return if event.key() == Qt.Key_Left : self.selectPrecedent(); return + if event.key() == Qt.Key_Return or event.key() == Qt.Key_Space : self.checkFocused(); return QWidget.keyPressEvent(self,event) def selectSuivant(self): @@ -108,6 +110,17 @@ class MonWidgetRadioButtonCommun (Feuille): courant=getattr(self,nomBouton) courant.setFocus(True) + def checkFocused(self): + aLeFocus=self.focusWidget() + nom=aLeFocus.objectName()[12:] + i=nom.toInt()[0] + if i > 0 and i <= len(self.maListeDeValeur): + nomBouton="radioButton_"+str(i) + courant=getattr(self,nomBouton) + if not courant.isChecked(): + courant.setChecked(True) + self.boutonclic() + class MonWidgetRadioButton (Ui_WidgetRadioButton,MonWidgetRadioButtonCommun): def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande): diff --git a/Noyau/strfunc.py b/Noyau/strfunc.py index 3e9089a0..9127b8c5 100644 --- a/Noyau/strfunc.py +++ b/Noyau/strfunc.py @@ -101,8 +101,10 @@ def ufmt(uformat, *args): formatted_string="" try: formatted_string = uformat % arguments - except UnicodeDecodeError, err: - print type(uformat), uformat - print type(arguments), arguments - raise + #except UnicodeDecodeError: + # print type(uformat), uformat + # print type(arguments), arguments + #raise + except : + pass return formatted_string diff --git a/Tests/EficasEngineTest.py b/Tests/EficasEngineTest.py new file mode 100644 index 00000000..1718c601 --- /dev/null +++ b/Tests/EficasEngineTest.py @@ -0,0 +1,249 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2012 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 configure pour Code_Aster +""" +# Modules Python +# Modules Eficas + +import sys,os +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..')) + +from PyQt4.QtCore import * +from InterfaceQT4 import eficas_go + +import prefs +import difflib + +from PyQt4.QtGui import * +from myMain import Ui_Eficas +from viewManager import MyTabview +from getVersion import getEficasVersion + +from Extensions.i18n import tr +from Extensions.eficas_exception import EficasException + +from Editeur import session + +import unittest +import HTMLTestRunner + +class EficasEngineTestSuite(unittest.TestSuite): + def __init__(self, testList): + unittest.TestSuite.__init__(self) + for test in testList: + self.addTest(test) + +class EficasEngineTestCase(unittest.TestCase): + def setUp(self): + from qtEficas import Appli + from Editeur import session + from Extensions import localisation + + options = session.parse(sys.argv) + if options.code!= None : code=options.code + if options.ssCode!= None : ssCode=options.ssCode + + self.code=prefs.code + self.Eficas=None + self.editor=None + + self.app = QApplication(sys.argv) + localisation.localise(self.app,'en') + self.Eficas=Appli(code=self.code,ssCode=None,multi=False,langue='en') + + def tearDown(self): + del self.Eficas + self.Eficas = None + del self.app + self.app = None + self.editor = None + + def close(self): + if ( self.editor != None ): + vm=self.Eficas.viewmanager + index=vm.myQtab.currentIndex() + idx=index + while idx < len(vm.dict_editors) -1 : + vm.dict_editors[idx]=vm.dict_editors[idx+1] + idx = idx + 1 + del vm.dict_editors[len (vm.dict_editors) -1] + try : + del vm.doubles[vm.dict_editors[index]] + except : + pass + vm.myQtab.removeTab(index) + self.editor = None + + def open_file(self, fileName): + if ( self.Eficas == None ): + return False + + result=True + try: + self.Eficas.viewmanager.handleOpen(fileName) + index=self.Eficas.viewmanager.myQtab.currentIndex() + self.editor=self.Eficas.viewmanager.dict_editors[index] + except: + result=False + pass + + return result + + def save_file(self, file): + if ( self.editor == None ): + return False + + try: + os.remove(file) + except: + pass + + result=True + + try: + self.editor.saveFileAs(fileName=file) + except: + result=False + pass + return result + + def search_object(self, name): + obj=None + if ( self.editor != None ): + obj=self.editor.jdc + return self.search_subobject(obj, name) + + def search_subobject(self, obj, name): + if ( obj==None ): + return None + + if ( hasattr( obj, 'get_sdname' ) and obj.get_sdname() == name ): + return obj + + list=[] + if ( hasattr(obj, 'etapes') ): + list=obj.etapes + elif ( hasattr(obj, 'mc_liste') ): + list=obj.mc_liste + + o=None + for i in list: + o=self.search_subobject(i, name) + if ( o != None ): + break + + return o + + def search_param(self, obj, name): + if ( obj == None ): + return None + + if ( hasattr( obj, 'nom' ) and obj.nom == name ): + return obj + + list=[] + if ( hasattr(obj, 'etapes') ): + list=obj.etapes + elif ( hasattr(obj, 'mc_liste') ): + list=obj.mc_liste + + o=None + for i in list: + o=self.search_param(i, name) + if ( o != None ): + break + + return o + + def remove_object(self, obj): + if ( obj != None and hasattr( obj, 'parent' ) ): + p=obj.parent + if ( p != None ): + p.suppentite(obj) + + def compare_files(self, orig, test): + origlines = open(orig, 'U').readlines() + testlines = open(test, 'U').readlines() + + diff = difflib.unified_diff(origlines, testlines, orig, test) + + result = 0; + for str in diff: + if ( len(str) == 0 ): + continue + elif ( str[0] != ' ' ): + result=1 + print str + + return result + + def testCaseDataDir(self): + return '/dn24/EFICAS/stv' + + def testCaseInputDataFile(self): + return "" + + def testCasePatternDataFile(self): + dataFile=self.testCaseInputDataFile() + split=os.path.splitext(dataFile) + return split[0] + '_ptrn' + split[1] + + def testCaseTestDataFile(self): + dataFile=self.testCaseInputDataFile() + split=os.path.splitext(dataFile) + return split[0] + '_test' + split[1] + + def testCaseInputDataPath(self): + return self.testCaseDataDir() + os.sep + self.testCaseInputDataFile() + + def testCasePatternDataPath(self): + return self.testCaseDataDir() + os.sep + self.testCasePatternDataFile() + + def testCaseTestDataPath(self): + return self.testCaseDataDir() + os.sep + self.testCaseTestDataFile() + + def runTest(self): + inputFile=self.testCaseInputDataPath() + + self.assert_(self.open_file(inputFile), 'Can not open file: ' + inputFile) + + self.assert_(self.performTest(), 'Test not performed') + + testFile=self.testCaseTestDataPath() + + self.assert_(self.save_file(testFile), 'Can not save file: ' + testFile) + + patternFile=self.testCasePatternDataPath() + cmp=self.compare_files(patternFile, testFile) + + self.assert_(cmp == 0, "Pattern file and test file are differs") + + self.close() + + def performTest(self): + return True + +def run_tests(reportFile, testSuit): + print reportFile + buf = file(reportFile, 'wb') + runner = HTMLTestRunner.HTMLTestRunner(stream=buf, title='Test report', description='Result of tests') + runner.run(testSuit) diff --git a/Tests/HTMLTestRunner.py b/Tests/HTMLTestRunner.py index 8da592f2..0439bf48 100644 --- a/Tests/HTMLTestRunner.py +++ b/Tests/HTMLTestRunner.py @@ -13,16 +13,14 @@ The simplest way to use this is to invoke its main method. E.g. HTMLTestRunner.main() -To customize the report, instantiates a HTMLTestRunner object and set -the parameters. HTMLTestRunner is a counterpart to unittest's -TextTestRunner. E.g. +For more customization options, instantiates a HTMLTestRunner object. +HTMLTestRunner is a counterpart to unittest's TextTestRunner. E.g. # output to a file fp = file('my_report.html', 'wb') runner = HTMLTestRunner.HTMLTestRunner( stream=fp, title='My unit test', - report_attrs=[('Version','1.2.3')], description='This demonstrates the report output by HTMLTestRunner.' ) @@ -35,7 +33,7 @@ TextTestRunner. E.g. ------------------------------------------------------------------------ -Copyright (c) 2004-2006, Wai Yip Tung +Copyright (c) 2004-2007, Wai Yip Tung All rights reserved. Redistribution and use in source and binary forms, with or without @@ -67,17 +65,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # URL: http://tungwaiyip.info/software/HTMLTestRunner.html __author__ = "Wai Yip Tung" -__version__ = "0.8.0" +__version__ = "0.8.2" """ -Changes in 0.8.0 +Change History + +Version 0.8.2 +* Show output inline instead of popup window (Viorel Lupu). + +Version in 0.8.1 +* Validated XHTML (Wolfgang Borgert). +* Added description of test classes and test cases. + +Version in 0.8.0 * Define Template_mixin class for customization. * Workaround a IE 6 bug that it does not treat +*/ +--> %(heading)s %(report)s @@ -279,13 +305,15 @@ function showOutput(id, name) { # STYLESHEET_TMPL = """ -