1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2013 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 from desSelectVal import Ui_DSelVal
25 fromm determine import monEnvQT5
27 from PyQt5.QtWidgets import QDialog
28 from PyQt5.QtCore import QTimer
30 from PyQt4.QtGui import *
31 from PyQt4.QtCore import *
33 class DSelVal(Ui_DSelVal,QDialog):
34 def __init__(self,parent ,modal ) :
35 QDialog.__init__(self,parent)
38 class MonSelectVal(DSelVal):
40 Classe definissant le panel associe aux mots-cles qui demandent
41 a l'utilisateur de choisir une seule valeur parmi une liste de valeurs
44 def __init__(self,file,parent,name = None,fl = 0):
47 DSelVal.__init__(self,parent,0)
54 self.connecterSignaux()
56 def connecterSignaux(self) :
57 self.Bespace.clicked.connect(self.SelectEsp)
58 self.BpointVirgule.clicked.connect(self.SelectPoint)
59 self.Bvirgule.clicked.connect(self.SelectVir)
60 self.BImportSel.clicked.connect(self.BImportSelPressed)
61 self.BImportTout.clicked.connect(self.BImportToutPressed)
62 self.parent.editor.sb.messageChanged(self.messageAChanger)
64 def connecterSignauxQT4(self) :
65 self.connect(self.Bespace,SIGNAL("clicked()"),self.SelectEsp)
66 self.connect(self.BpointVirgule,SIGNAL("clicked()"),self.SelectPoint)
67 self.connect(self.Bvirgule,SIGNAL("clicked()"),self.SelectVir)
68 self.connect(self.BImportSel,SIGNAL("clicked()"),self.BImportSelPressed)
69 self.connect(self.BImportTout,SIGNAL("clicked()"),self.BImportToutPressed)
70 self.connect(self.parent.editor.sb,SIGNAL("messageChanged(QString)"),self.messageAChanger)
72 def messageAChanger(self):
73 message=self.parent.editor.sb.currentMessage()
74 mapalette=self.sb.palette()
75 from PyQt4.QtGui import QPalette
76 mapalette.setColor( QPalette.WindowText, self.parent.editor.couleur )
77 self.sb.setPalette( mapalette );
78 self.sb.setText(tr(message))
79 QTimer.singleShot(3000, self.efface)
85 if self.file == "" : return
86 f = open(self.file, "rb")
92 self.TBtext.setText(self.texte)
100 def SelectPoint(self):
103 def BImportSelPressed(self):
105 texte = self.TBtext.textCursor().selectedText()
106 textTraite=texte.replace(u'\u2029',"\n")
107 self.textTraite=str(textTraite)
110 def BImportToutPressed(self):
111 self.textTraite=self.texte
114 def Traitement(self):
116 if self.textTraite == "" : return
117 if self.textTraite[-1]=="\n" : self.textTraite=self.textTraite[0:-1]
118 self.textTraite=string.replace(self.textTraite,"\n",self.separateur)
119 liste1=self.textTraite.split(self.separateur)
122 if val != '' and val != ' ' and val != self.separateur :
129 self.parent.ajoutNValeur(liste)