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
24 from PyQt4.QtGui import *
25 from PyQt4.QtCore import *
27 class DSelVal(Ui_DSelVal,QDialog):
28 def __init__(self,parent ,modal ) :
29 QDialog.__init__(self,parent)
32 class MonSelectVal(DSelVal):
34 Classe definissant le panel associe aux mots-cles qui demandent
35 a l'utilisateur de choisir une seule valeur parmi une liste de valeurs
38 def __init__(self,file,parent,name = None,fl = 0):
40 self.FonctPanel=parent
41 DSelVal.__init__(self,parent,0)
48 self.connecterSignaux()
50 def connecterSignaux(self) :
51 self.connect(self.Bespace,SIGNAL("clicked()"),self.SelectEsp)
52 self.connect(self.BpointVirgule,SIGNAL("clicked()"),self.SelectPoint)
53 self.connect(self.Bvirgule,SIGNAL("clicked()"),self.SelectVir)
54 self.connect(self.BImportSel,SIGNAL("clicked()"),self.BImportSelPressed)
55 self.connect(self.BImportTout,SIGNAL("clicked()"),self.BImportToutPressed)
58 if self.file == "" : return
59 f = open(self.file, "rb")
65 self.TBtext.setText(self.texte)
73 def SelectPoint(self):
76 def BImportSelPressed(self):
78 texte = self.TBtext.textCursor().selectedText()
79 textTraite=texte.replace(u'\u2029',"\n")
80 self.textTraite=str(textTraite)
83 def BImportToutPressed(self):
84 self.textTraite=self.texte
89 if self.textTraite == "" : return
90 if self.textTraite[-1]=="\n" : self.textTraite=self.textTraite[0:-1]
91 self.textTraite=string.replace(self.textTraite,"\n",self.separateur)
92 liste1=self.textTraite.split(self.separateur)
95 if val != '' and val != ' ' and val != self.separateur :
102 print self.FonctPanel.AjoutNValeur
103 self.FonctPanel.AjoutNValeur(liste)