Package medite :: Package Controleurs :: Module cTravail
[hide private]
[frames] | no frames]

Source Code for Module medite.Controleurs.cTravail

  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:          cTravail.py 
 20  # Objet:        Classe qui interface entre les donnees et l'interface graphique 
 21  #---------------------------------------------------------------------------- 
 22  import os, posixpath,sys #, site, wxPython 
 23  #from wxPython.lib.colourselect import * 
 24  #from wxPython.wx import * 
 25  import wx 
 26  #import wx.lib 
 27   
 28  from Utile.constantesDonnees import * 
 29  from Donnees.planTravail import * 
 30   
 31   
32 -class CTravail(object):
33 """ C'est la classe de type 'Controleur' qui fait le lien entre les donnees Travail et 34 l'interface"""
35 - def __init__(self):
36 self.__travail = DonneesTravail() 37 if not posixpath.exists(REPPRIVE) : 38 os.mkdir(REPPRIVE)
39
40 - def enregistrerListePlans(self, pListe):
41 """ Methode pour enregistrer le plan de travail """ 42 self.__travail.enregistrerListePlans(pListe)
43 44 # Methode pour enregistrer le plan de travail 45 # def enregistrerPlan(self, pPlan): 46 # self.__travail.enregistrerPlan(pPlan) 47
48 - def enregistrerParametres(self, pParametres):
49 """ Methode pour enregistrer les parametres """ 50 self.__travail.enregistrerParametres(pParametres)
51
52 - def enregistrerCouleurs(self, pCouleurs):
53 """ Methode pour enregistrer les couleurs """ 54 # passer de la forme (r,g,b) a la forme [r,g,b] 55 cI = pCouleurs.getCoulInsert() 56 cIr = cI.Red() 57 cIg = cI.Green() 58 cIb = cI.Blue() 59 60 cS = pCouleurs.getCoulSupp() 61 cSr = cS.Red() 62 cSg = cS.Green() 63 cSb = cS.Blue() 64 65 cR = pCouleurs.getCoulRemp() 66 cRr = cR.Red() 67 cRg = cR.Green() 68 cRb = cR.Blue() 69 70 cDep = pCouleurs.getDeplacement() 71 72 coulMemo = CouleursMemorisees([cIr,cIg,cIb], [cSr,cSg,cSb], [cRr,cRg,cRb], [cDep]) 73 self.__travail.enregistrerCouleurs(coulMemo)
74
75 - def chargerListePlans(self):
76 """ Methode pour recuperer la liste des plans de travail """ 77 return self.__travail.chargerListePlans()
78 79 # methode pour recuperer les donnees du plan de travail 80 # def chargerPlan(self): 81 # return self.__travail.chargerPlan() 82
83 - def chargerCouleurs(self):
84 """ Methode pour recuperer les couleurs """ 85 # passer de la forme [r,g,b] a la forme (r,g,b) 86 couleurs = self.__travail.chargerCouleurs() 87 88 cI = couleurs.getCoulInsert() 89 cIi = wx.Colour(cI[0],cI[1],cI[2]) 90 91 cS = couleurs.getCoulSupp() 92 cSi = wx.Colour(cS[0],cS[1],cS[2]) 93 94 cR = couleurs.getCoulRemp() 95 cRi = wx.Colour(cR[0],cR[1],cR[2]) 96 97 cE = couleurs.getEcriture() 98 cEi = wx.Colour(cE[0],cE[1],cE[2]) 99 100 cD = couleurs.getDeplacement()[0] 101 102 return CouleursInterface(cIi,cSi, cRi, cEi, cD)
103
104 - def chargerCouleursDefaut(self):
105 """ Methode pour recuperer les couleurs de defaut """ 106 cIi = wx.Colour(DEFAUT_INSERTION[0],DEFAUT_INSERTION[1], DEFAUT_INSERTION[2]) 107 cSi = wx.Colour(DEFAUT_SUPPRESSION[0],DEFAUT_SUPPRESSION[1], DEFAUT_SUPPRESSION[2]) 108 cRi = wx.Colour(DEFAUT_REMPLACEMENT[0],DEFAUT_REMPLACEMENT[1],DEFAUT_REMPLACEMENT[2]) 109 cEi = wx.Colour(DEFAUT_ECRITURE_BLANC[0],DEFAUT_ECRITURE_BLANC[1],DEFAUT_ECRITURE_BLANC[2]) 110 cD = DEFAUT_SOULIGNE_DEPLACEMENT 111 return CouleursInterface(cIi,cSi,cRi,cEi,cD)
112
113 - def chargerParametres(self):
114 """ Methode pour recuperer les parametres """ 115 return self.__travail.chargerParametres()
116 117
118 - def chargerParametresDefaut(self):
119 """ Methode pour recuperer les parametres de defaut """ 120 return Parametres(DEFAUT__LONG_MIN_PIVOT, 121 DEFAUT_RATION__MIN_REMP, 122 DEFAUT_RATIO_SEUIL_LISSAGE, 123 DEFAULT_CAR_OU_MOT)
124