From: Renaud Barate Date: Fri, 20 May 2011 09:09:46 +0000 (+0000) Subject: Integrate Pascale developments X-Git-Tag: LOGILAB~317 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d510567a80d8fd219be9cd3f414975066a8e383e;p=tools%2Feficas.git Integrate Pascale developments --- diff --git a/InterfaceQT4/CMakeLists.txt b/InterfaceQT4/CMakeLists.txt index 13b390de..ed15ed14 100644 --- a/InterfaceQT4/CMakeLists.txt +++ b/InterfaceQT4/CMakeLists.txt @@ -35,7 +35,7 @@ install ( FILES browser.py compobase.py compobloc.py compocommandecomm.py compoc monUniqueSDCOIntoPanel.py monUniqueSDCOPanel.py monVisu.py politiquesValidation.py qtCommun.py qtEficas.py qtSaisie.py readercata.py typeNode.py utilIcons.py viewManager.py - configuration.py + configuration.py monSelectImage.py DESTINATION ${CMAKE_INSTALL_PREFIX}/InterfaceQT4 ) diff --git a/InterfaceQT4/monSelectImage.py b/InterfaceQT4/monSelectImage.py new file mode 100644 index 00000000..9daff324 --- /dev/null +++ b/InterfaceQT4/monSelectImage.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- +# CONFIGURATION MANAGEMENT OF EDF VERSION +# ====================================================================== +# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG +# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY +# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY +# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR +# (AT YOUR OPTION) ANY LATER VERSION. +# +# THIS PROGRAM 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 +# GENERAL PUBLIC LICENSE FOR MORE DETAILS. +# +# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE +# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, +# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. +# +# +# ====================================================================== +# Modules Python +# Modules Eficas + +from desImage import Ui_DSelImage +from PyQt4.QtGui import * +from PyQt4.QtCore import * + +class DSelImage(Ui_DSelImage,QDialog): + def __init__(self,parent ,modal ) : + QDialog.__init__(self,parent) + self.setupUi(self) + +class MonImage (QWidget): + def __init__(self,file,parent): + QWidget.__init__(self,parent) + self.file=file + self.QtParent=parent + self.monRectangle=None + self.dessine=0 + self.readImage() + + + def readImage(self): + if self.file == "" : return + self.image=QPixmap(self.file) + + def paintEvent(self,paintEvent): + self.p= QPainter(self); + self.resize(self.image.width(),self.image.height()) + if self.monRectangle != None: + self.p.eraseRect(self.monRectangle) + self.p.drawPixmap(0,0,self.image.width(),self.image.height(),self.image) + if self.dessine==1: + self.monRectangle=QRect(QPoint(self.xdeb,self.ydeb),QPoint(self.xfin,self.yfin)) + self.p.drawRect(self.monRectangle) + + def changedEvent(self,e): + QWidget.changedEvent(self,e) + + def mousePressEvent(self,e): + self.xdeb=e.x() + self.ydeb=e.y() + self.dessine=0 + self.update() + QWidget.mousePressEvent(self,e) + + def mouseMoveEvent(self,e): + self.xfin=e.x() + self.yfin=e.y() + self.dessine=1 + self.update() + QWidget.mouseMoveEvent(self,e) + +class MonSelectImage(DSelImage): + """ + """ + def __init__(self,file,parent,name = None,fl = 0): + DSelImage.__init__(self,parent,0) + self.file=file + self.parentQT=parent + self.image=MonImage(self.file,self) + + + def accept(self) : + if (not hasattr(self.image,'xdeb')) :self.close() + name='RECT' + self.parentQT.editor.init_modif() + child=self.parentQT.node.append_brother(name) + child.item.set_valeur((self.image.xdeb,self.image.ydeb,self.image.xfin,self.image.yfin)) + child.affichePanneau() + self.close() diff --git a/InterfaceQT4/monUniqueBasePanel.py b/InterfaceQT4/monUniqueBasePanel.py index 5ac9b10e..b7ced50e 100644 --- a/InterfaceQT4/monUniqueBasePanel.py +++ b/InterfaceQT4/monUniqueBasePanel.py @@ -29,6 +29,9 @@ from desUniqueBase import Ui_DUnBase from qtCommun import QTPanel from qtSaisie import SaisieValeur from politiquesValidation import PolitiqueUnique +listeSuffixe= ('bmp','png','jpg' ) + + class DUnBase(Ui_DUnBase,QDialog): def __init__(self,parent ,modal ) : @@ -109,6 +112,17 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur): except : str=QString(valeurTexte) self.lineEditVal.setText(str) + mc = self.node.item.get_definition() + if hasattr(self,"BSelectInFile"): return + if (( mc.type[0]=="Fichier") and (QFileInfo(str).suffix() in listeSuffixe )): + self.BSelectInFile = QPushButton(self.Widget8) + self.BSelectInFile.setMinimumSize(QSize(140,40)) + self.BSelectInFile.setObjectName("BSelectInFile") + self.gridLayout.addWidget(self.BSelectInFile,1,1,1,1) + self.BSelectInFile.setText("Selection") + self.image=str + self.connect(self.BSelectInFile,SIGNAL("clicked()"),self.BSelectInFilePressed) + def InitCommentaire(self): @@ -153,6 +167,24 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur): ulfile = os.path.abspath(unicode(fichier)) self.appliEficas.CONFIGURATION.savedir=os.path.split(ulfile)[0] self.lineEditVal.setText(fichier) + if (QFileInfo(fichier).suffix() in listeSuffixe ): + self.image=fichier + if (not hasattr(self,"BSelectInFile")): + self.BSelectInFile = QPushButton(self.Widget8) + self.BSelectInFile.setMinimumSize(QSize(140,40)) + self.BSelectInFile.setObjectName("BSelectInFile") + self.gridLayout.addWidget(self.BSelectInFile,1,1,1,1) + self.BSelectInFile.setText("Selection") + self.connect(self.BSelectInFile,SIGNAL("clicked()"),self.BSelectInFilePressed) + else : + self.BSelectInFile.setVisible(1) + else: + self.BSelectInFile.setVisible(0) + + + def BSelectInFilePressed(self): + from monSelectImage import MonSelectImage + MonSelectImage(file=self.image,parent=self).show() def LEValeurPressed(self): diff --git a/InterfaceQT4/readercata.py b/InterfaceQT4/readercata.py index 5e4eb22b..57c82ba5 100644 --- a/InterfaceQT4/readercata.py +++ b/InterfaceQT4/readercata.py @@ -87,15 +87,15 @@ class READERCATA: # TODO: Remove this filter. Normally, CONFIGURATION should only define the catalogs for this code anyway. # Non pas pour Map qui a une notion de sscode for catalogue in all_cata_list: - print catalogue.code - print catalogue.file_format + #print catalogue.code + #print catalogue.file_format if catalogue.code == self.code : if (self.ssCode == None) or (self.ssCode == catalogue.file_format): liste_cata_possibles.append(catalogue) - print "___________" - print self.ssCode - print self.code + #print "___________" + #print self.ssCode + #print self.code if len(liste_cata_possibles)==0: QMessageBox.critical( self.QWParent, "Import du catalogue","Pas de catalogue defini pour le code %s" % self.code) self.appliEficas.close() diff --git a/UiQT4/desImage.ui b/UiQT4/desImage.ui new file mode 100644 index 00000000..513831b0 --- /dev/null +++ b/UiQT4/desImage.ui @@ -0,0 +1,68 @@ + + + DSelImage + + + + 0 + 0 + 400 + 329 + + + + Image Selection + + + + + 10 + 280 + 371 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + BSelect + accepted() + DSelImage + accept() + + + 248 + 254 + + + 157 + 274 + + + + + BSelect + rejected() + DSelImage + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/UiQT4/makefile b/UiQT4/makefile index 241af709..7ec1fa2f 100644 --- a/UiQT4/makefile +++ b/UiQT4/makefile @@ -9,7 +9,7 @@ PY_FILES = desChoixCata.py desCommande.py desCommentaire.py desError.py desFormu desUniqueASSD.py desUniqueBase.py desUniqueComp.py desUniqueInto.py desUniqueSDCOInto.py \ desUniqueSDCO.py desVisu.py aideQT.py OptionsEditeur.py OptionsPdf.py myMain.py \ desViewTexte.py desPixmap.py desMatrice.py OptionsOT.py OptionsCuve.py desChoixMap.py \ - OptionsMAP.py + OptionsMAP.py desImage.py %.py:%.ui ${PYUIC} -x -o $@ $<