Package medite :: Package GUI :: Module Parametres
[hide private]
[frames] | no frames]

Source Code for Module medite.GUI.Parametres

  1  # -*- coding: iso-8859-1 -*- 
  2  # Copyright 20003 - 2008: Julien Bourdaillet (julien.bourdaillet@lip6.fr), Jean-Gabriel Ganascia (jean-gabriel.ganascia@lip6.fr) 
  3  # This file is part of MEDITE. 
  4  # 
  5  #    MEDITE is free software; you can redistribute it and/or modify 
  6  #    it under the terms of the GNU General Public License as published by 
  7  #    the Free Software Foundation; either version 2 of the License, or 
  8  #    (at your option) any later version. 
  9  # 
 10  #    MEDITE is distributed in the hope that it will be useful, 
 11  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
 12  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 13  #    GNU General Public License for more details. 
 14  # 
 15  #    You should have received a copy of the GNU General Public License 
 16  #    along with Foobar; if not, write to the Free Software 
 17  #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
 18  #---------------------------------------------------------------------------- 
 19  # Nom:          Parametres.py 
 20  # Objet:        Classe qui permet de changer les parametres 
 21  #---------------------------------------------------------------------------- 
 22  #from wxPython.wx import * 
 23  import wx 
 24  ##from wxPython.lib.rcsizer import RowColSizer 
 25  ##from wxPython.lib.grids import wxGridSizer, wxFlexGridSizer 
 26   
 27  from Utile.constantesGUI import * 
 28  from Utile.constantesDonnees import * 
 29  from Donnees.planTravail import * 
 30   
 31  #---------------------------------------------------------------------------- 
 32   
 33  # Parametres : 
 34  # 1 - longueur minimale des chaines pivots (et deplacees) 
 35  # 2 - ratio minimal de longueur des chaines pour valider un remplacement 
 36  # 3 - seuil du rapport de longueur des chaines pour valider un lissage 
 37  # 4 - Mode car ou mot 
38 -class PanelParametres(wx.Panel):
39
40 - def __init__(self, parent,pFenetre):
41 wx.Panel.__init__(self, parent, -1) 42 43 self.noteBook =parent 44 self.fenetreMedite =pFenetre 45 46 self.p1 = self.fenetreMedite.parametres.getp1() 47 self.p2 = self.fenetreMedite.parametres.getp2() 48 self.p3 = self.fenetreMedite.parametres.getp3() 49 self.p4 = self.fenetreMedite.parametres.getp4() 50 self.p5 = self.fenetreMedite.parametres.getp5() 51 self.p6 = self.fenetreMedite.parametres.getp6() 52 self.p7 = self.fenetreMedite.parametres.getp7() 53 54 ## Deplacement 55 wx.StaticText(self,-1,'Longueur min chaines pivots',wx.Point(5,12)) 56 wx.StaticText(self,-1,u'(en nbre de caract\xe8res)',wx.Point(5,25)) 57 ## self.param1 =wx.TextCtrl(self, -1,self.p1, wx.Point(200,10),wx.Size(75,23)) 58 self.param1 = wx.Slider(self, ID_SLIDER_P1, self.p1, 0, 100, wx.Point(200, 10), 59 wx.Size(250, -1),wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS ) 60 self.param1.SetTickFreq(5,1) 61 62 wx.StaticText(self,-1,'Ratio min chaines remp',wx.Point(5,52)) 63 wx.StaticText(self,-1,'(en %)',wx.Point(5,65)) 64 self.param2 = wx.Slider(self, ID_SLIDER_P2, self.p2, 0, 100, wx.Point(200, 50), 65 wx.Size(250, -1),wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS ) 66 self.param2.SetTickFreq(5,1) 67 68 wx.StaticText(self,-1,'Seuil de long pr validation lissage',wx.Point(5,92)) 69 wx.StaticText(self,-1,'(en %)',wx.Point(5,105)) 70 self.param3 = wx.Slider(self, ID_SLIDER_P3, self.p3, 0, 100, wx.Point(200, 90), 71 wx.Size(250, -1),wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS ) 72 self.param3.SetTickFreq(5, 1) 73 74 # wx.StaticText(self,-1,'Recherche par ',wx.Point(5,132)) 75 # #wx.StaticText(self,-1,' - par mots ',wx.Point(5,145)) 76 # sizer = wx.BoxSizer(wx.VERTICAL) 77 # self.param4 = wx.RadioBox(self, -1, '', wx.Point(80,115), wx.DefaultSize, 78 # [u'caractères',u'mots'], 1, wx.NO_BORDER ) 79 # self.param4.SetSelection(self.p4) 80 # self.Bind(wx.EVT_RADIOBOX, self.revalider, self.param4) 81 ## sizer.Add(rb, 0, wx.ALL, 20) 82 ## self.SetSizer(sizer) 83 84 self.param5 = wx.CheckBox(self, -1, u"Sensibilité à la casse",wx.Point(5,132))#, (65, 40), (150, 20), wx.NO_BORDER) 85 self.param6 = wx.CheckBox(self, -1, u"Sensibilité aux séparateurs",wx.Point(5,152))#, (65, 60), (150, 20), wx.NO_BORDER) 86 self.param7 = wx.CheckBox(self, -1, u"Sensibilité aux signes diacritiques",wx.Point(200,152)) 87 self.Bind(wx.wx.EVT_CHECKBOX, self.revalider, self.param5) 88 self.Bind(wx.wx.EVT_CHECKBOX, self.revalider, self.param6) 89 self.Bind(wx.wx.EVT_CHECKBOX, self.revalider, self.param7) 90 self.param5.SetValue(self.p5) 91 self.param6.SetValue(self.p6) 92 self.param7.SetValue(self.p7) 93 94 self.bValidation = wx.Button(self,ID_VALIDATION_COULEUR , u'Paramètres Validés', 95 wx.Point(470,70), wx.Size(120,23)) 96 wx.wx.EVT_BUTTON(self, ID_VALIDATION_COULEUR, self.validationParametre) 97 98 self.bDefault = wx.Button(self,ID_COULEUR_DEFAUT , u'Paramètres defaut', 99 wx.Point(470,30), wx.Size(120,23)) 100 wx.wx.EVT_BUTTON(self, ID_COULEUR_DEFAUT, self.defaultParametre) 101 102 wx.EVT_SCROLL(self,self.revalider)
103
104 - def validationParametre(self, evt):
105 self.fenetreMedite.parametres.setp1(self.param1.GetValue()) 106 self.fenetreMedite.parametres.setp2(self.param2.GetValue()) 107 self.fenetreMedite.parametres.setp3(self.param3.GetValue()) 108 # self.fenetreMedite.parametres.setp4(self.param4.GetSelection()) 109 if self.param5.GetValue(): v5=1 110 else: v5=0 111 if self.param6.GetValue(): v6=1 112 else: v6=0 113 if self.param7.GetValue(): v7=1 114 else: v7=0 115 self.fenetreMedite.parametres.setp5(v5) 116 self.fenetreMedite.parametres.setp6(v6) 117 self.fenetreMedite.parametres.setp7(v7) 118 self.bValidation.SetLabel(u'Paramètres Validés')
119
120 - def defaultParametre(self, evt):
121 param = self.fenetreMedite.ctravail.chargerParametresDefaut() 122 123 self.param1.SetValue(param.getp1()) 124 self.param2.SetValue(param.getp2()) 125 self.param3.SetValue(param.getp3()) 126 # self.param4.SetSelection(param.getp4()) 127 self.param5.SetValue(param.getp5()) 128 self.param6.SetValue(param.getp6()) 129 self.param7.SetValue(param.getp7()) 130 self.bValidation.SetLabel('Cliquez ici pour valider')
131
132 - def revalider(self, evt):
133 self.bValidation.SetLabel('Cliquez ici pour valider')
134
135 - def chargerParametres(self, pParametres):
136 # mise a jour des parametres de l'onglet 137 self.param1.SetValue(pParametres.getp1()) 138 self.param2.SetValue(pParametres.getp2()) 139 self.param3.SetValue(pParametres.getp3()) 140 # self.param4.SetSelection(pParametres.getp4()) 141 self.param5.SetValue(pParametres.getp5()) 142 self.param6.SetValue(pParametres.getp6()) 143 self.param7.SetValue(pParametres.getp7()) 144 # mise a jour des parametres du plan de travail 145 self.fenetreMedite.parametres.setp1(self.param1.GetValue()) 146 self.fenetreMedite.parametres.setp2(self.param2.GetValue()) 147 self.fenetreMedite.parametres.setp3(self.param3.GetValue()) 148 # self.fenetreMedite.parametres.setp4(self.param4.GetSelection()) 149 if self.param5.GetValue(): v5=1 150 else: v5=0 151 if self.param6.GetValue(): v6=1 152 else: v6=0 153 if self.param7.GetValue(): v7=1 154 else: v7=0 155 self.fenetreMedite.parametres.setp5(v5) 156 self.fenetreMedite.parametres.setp6(v6) 157 self.fenetreMedite.parametres.setp7(v7) 158 self.bValidation.SetLabel(u'Paramètres Validés')
159
160 - def donnerParametres(self):
161 if self.param5.GetValue(): v5=1 162 else: v5=0 163 if self.param6.GetValue(): v6=1 164 else: v6=0 165 if self.param7.GetValue(): v7=1 166 else: v7=0 167 return Parametres(self.param1.GetValue(),self.param2.GetValue(), 168 self.param3.GetValue(),0,v5,v6,v7)#self.param4.GetSelection())
169