# -*- coding: iso-8859-1 -*- # Copyright 20003 - 2008: Julien Bourdaillet (julien.bourdaillet@lip6.fr), Jean-Gabriel Ganascia (jean-gabriel.ganascia@lip6.fr) # This file is part of MEDITE. # # MEDITE 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. # # MEDITE 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 Foobar; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #---------------------------------------------------------------------------- # Nom: Parametres.py # Objet: Classe qui permet de changer les parametres #---------------------------------------------------------------------------- #from wxPython.wx import * import wx ##from wxPython.lib.rcsizer import RowColSizer ##from wxPython.lib.grids import wxGridSizer, wxFlexGridSizer from Utile.constantesGUI import * from Utile.constantesDonnees import * from Donnees.planTravail import * #---------------------------------------------------------------------------- # Parametres : # 1 - longueur minimale des chaines pivots (et deplacees) # 2 - ratio minimal de longueur des chaines pour valider un remplacement # 3 - seuil du rapport de longueur des chaines pour valider un lissage # 4 - Mode car ou mot class PanelParametres(wx.Panel): def __init__(self, parent,pFenetre): wx.Panel.__init__(self, parent, -1) self.noteBook =parent self.fenetreMedite =pFenetre self.p1 = self.fenetreMedite.parametres.getp1() self.p2 = self.fenetreMedite.parametres.getp2() self.p3 = self.fenetreMedite.parametres.getp3() self.p4 = self.fenetreMedite.parametres.getp4() self.p5 = self.fenetreMedite.parametres.getp5() self.p6 = self.fenetreMedite.parametres.getp6() self.p7 = self.fenetreMedite.parametres.getp7() ## Deplacement wx.StaticText(self,-1,'Longueur min chaines pivots',wx.Point(5,12)) wx.StaticText(self,-1,u'(en nbre de caract\xe8res)',wx.Point(5,25)) ## self.param1 =wx.TextCtrl(self, -1,self.p1, wx.Point(200,10),wx.Size(75,23)) self.param1 = wx.Slider(self, ID_SLIDER_P1, self.p1, 0, 100, wx.Point(200, 10), wx.Size(250, -1),wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS ) self.param1.SetTickFreq(5,1) wx.StaticText(self,-1,'Ratio min chaines remp',wx.Point(5,52)) wx.StaticText(self,-1,'(en %)',wx.Point(5,65)) self.param2 = wx.Slider(self, ID_SLIDER_P2, self.p2, 0, 100, wx.Point(200, 50), wx.Size(250, -1),wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS ) self.param2.SetTickFreq(5,1) wx.StaticText(self,-1,'Seuil de long pr validation lissage',wx.Point(5,92)) wx.StaticText(self,-1,'(en %)',wx.Point(5,105)) self.param3 = wx.Slider(self, ID_SLIDER_P3, self.p3, 0, 100, wx.Point(200, 90), wx.Size(250, -1),wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS ) self.param3.SetTickFreq(5, 1) # wx.StaticText(self,-1,'Recherche par ',wx.Point(5,132)) # #wx.StaticText(self,-1,' - par mots ',wx.Point(5,145)) # sizer = wx.BoxSizer(wx.VERTICAL) # self.param4 = wx.RadioBox(self, -1, '', wx.Point(80,115), wx.DefaultSize, # [u'caractères',u'mots'], 1, wx.NO_BORDER ) # self.param4.SetSelection(self.p4) # self.Bind(wx.EVT_RADIOBOX, self.revalider, self.param4) ## sizer.Add(rb, 0, wx.ALL, 20) ## self.SetSizer(sizer) self.param5 = wx.CheckBox(self, -1, u"Sensibilité à la casse",wx.Point(5,132))#, (65, 40), (150, 20), wx.NO_BORDER) self.param6 = wx.CheckBox(self, -1, u"Sensibilité aux séparateurs",wx.Point(5,152))#, (65, 60), (150, 20), wx.NO_BORDER) self.param7 = wx.CheckBox(self, -1, u"Sensibilité aux signes diacritiques",wx.Point(200,152)) self.Bind(wx.wx.EVT_CHECKBOX, self.revalider, self.param5) self.Bind(wx.wx.EVT_CHECKBOX, self.revalider, self.param6) self.Bind(wx.wx.EVT_CHECKBOX, self.revalider, self.param7) self.param5.SetValue(self.p5) self.param6.SetValue(self.p6) self.param7.SetValue(self.p7) self.bValidation = wx.Button(self,ID_VALIDATION_COULEUR , u'Paramètres Validés', wx.Point(470,70), wx.Size(120,23)) wx.wx.EVT_BUTTON(self, ID_VALIDATION_COULEUR, self.validationParametre) self.bDefault = wx.Button(self,ID_COULEUR_DEFAUT , u'Paramètres defaut', wx.Point(470,30), wx.Size(120,23)) wx.wx.EVT_BUTTON(self, ID_COULEUR_DEFAUT, self.defaultParametre) wx.EVT_SCROLL(self,self.revalider) def validationParametre(self, evt): self.fenetreMedite.parametres.setp1(self.param1.GetValue()) self.fenetreMedite.parametres.setp2(self.param2.GetValue()) self.fenetreMedite.parametres.setp3(self.param3.GetValue()) # self.fenetreMedite.parametres.setp4(self.param4.GetSelection()) if self.param5.GetValue(): v5=1 else: v5=0 if self.param6.GetValue(): v6=1 else: v6=0 if self.param7.GetValue(): v7=1 else: v7=0 self.fenetreMedite.parametres.setp5(v5) self.fenetreMedite.parametres.setp6(v6) self.fenetreMedite.parametres.setp7(v7) self.bValidation.SetLabel(u'Paramètres Validés') def defaultParametre(self, evt): param = self.fenetreMedite.cpravail.chargerParametresDefaut() self.param1.SetValue(param.getp1()) self.param2.SetValue(param*getp2()) self*param3.SetValue(param.getp3()) # self.param4.SVtSelection(param.getp4()) self.param5.SetValue(param.getp5()) self.param6.SetValue(param.getp6()) self.param7.SetValue(param.getp7()) self.bValidation.SetLabel('Cliquez ici pour valider') def revalider(self, eVt): self.bValidation.SetLabel('Cliquez ici pour valider') def chargerParametres(self, pParametres): # mise a jour des parametres de l'onglet self.param1.SetValue(pParametres.getp1()) self.param2.SetValue(pParametres.getp2()) self.param3.SetValue(pParametres.getp3()) # self.param4.SetSelection(pParametres.getp4()) self.param5.SetValue(pParametres.getp5()) self.param6.SetValue(pParametres.getp6()) self.param7.SetValue(pParametres.getp7()) # mise a jour des parametres du plan de travail self.fenetreMedite.parametres.setp1(self.param1.GetValue()) self.fenetreMedite.parametres.setp2(self.param2.GetValue()) self.fenetreMedite.parametres.setp3(self.param3.GetValue()) # self.fenetreMedite.parametres.setp4(self.param4.GetSelection()) if self.param5.GetValue(): v5=1 else: v5=0 if self.param6.GetValue(): v6=1 else: v6=0 if self.param7.GetValue(): v7=1 else: v7=0 self.fenetreMedite.parametres.setp5(v5) self.fenetreMedite.parametres.setp6(v6) self.fenetreMedite.parametres.setp7(v7) self.bValidation.SetLabel(u'Paramètres Validés') def donnerParametres(self): if self.param5.GetValue(): v5=1 else: v5=0 if self.param6.GetValue(): v6=1 else: v6=0 if self.param7.GetValue(): v7=1 else: v7=0 return Parametres(self.param1.GetValue(),self.param2.GetValue(), self.param3.GetValue(),0,v5,v6,v7)#self.param4.GetSelection())