316
by 314r
maj mentions de copyright, nettoyage |
1 |
#JolieBulle 2.8
|
2 |
#Copyright (C) 2010-2013 Pierre Tavares
|
|
184
by 314r
export profils brassage, reste à gérer l'emplacement |
3 |
#This program is distributed in the hope that it will be useful,
|
4 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
5 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
6 |
#GNU General Public License for more details.
|
|
7 |
||
8 |
#You should have received a copy of the GNU General Public License
|
|
9 |
#along with this program; if not, write to the Free Software
|
|
10 |
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
11 |
||
12 |
||
13 |
import os |
|
14 |
from sys import platform |
|
15 |
import PyQt4 |
|
16 |
import sys |
|
185
by 314r
enregistrement profils OK, classés |
17 |
from operator import itemgetter |
184
by 314r
export profils brassage, reste à gérer l'emplacement |
18 |
from PyQt4 import QtGui |
19 |
from PyQt4 import QtCore |
|
20 |
from preferences import * |
|
21 |
from globals import * |
|
22 |
import xml.etree.ElementTree as ET |
|
23 |
||
24 |
class ExportMash : |
|
25 |
||
26 |
def export(self,listMash) : |
|
27 |
# print (listMash)
|
|
28 |
||
29 |
self.database = ET.Element('DATABASE') |
|
30 |
numMash = len(listMash) |
|
185
by 314r
enregistrement profils OK, classés |
31 |
listMash = sorted(listMash, key=itemgetter('name')) |
184
by 314r
export profils brassage, reste à gérer l'emplacement |
32 |
i = 0 |
33 |
while i < numMash : |
|
34 |
i=i+1 |
|
35 |
mash = ET.SubElement(self.database, 'MASH') |
|
36 |
dicMash = listMash[i-1] |
|
37 |
mashVersion = ET.SubElement(mash, 'VERSION') |
|
38 |
mashVersion.text = '1' |
|
39 |
mashName = ET.SubElement(mash, 'NAME') |
|
40 |
mashName.text = dicMash['name'] |
|
41 |
grainTemp = ET.SubElement(mash, 'GRAIN_TEMP') |
|
204
by 314r
corrections de bug |
42 |
# grainTemp.text = dicMash['grainTemp']
|
43 |
grainTemp.text = '20' |
|
184
by 314r
export profils brassage, reste à gérer l'emplacement |
44 |
tunTemp = ET.SubElement(mash, 'TUN_TEMP') |
204
by 314r
corrections de bug |
45 |
# tunTemp.text = dicMash['tunTemp']
|
46 |
tunTemp.text = '20' |
|
184
by 314r
export profils brassage, reste à gérer l'emplacement |
47 |
ph = ET.SubElement(mash, 'PH') |
205
by 314r
amélioration profils de brassage |
48 |
ph.text = str(dicMash['ph']) |
184
by 314r
export profils brassage, reste à gérer l'emplacement |
49 |
spargeTemp = ET.SubElement(mash, 'SPARGE_TEMP') |
205
by 314r
amélioration profils de brassage |
50 |
spargeTemp.text =str(dicMash['spargeTemp']) |
184
by 314r
export profils brassage, reste à gérer l'emplacement |
51 |
steps = ET.SubElement(mash, 'MASH_STEPS') |
52 |
||
53 |
listSteps = dicMash['mashSteps'] |
|
54 |
numSteps = len(listSteps) |
|
55 |
h = 0 |
|
56 |
while h < numSteps : |
|
57 |
h = h+1 |
|
58 |
step = ET.SubElement(steps, 'MASH_STEP') |
|
59 |
dicStep = listSteps[h-1] |
|
60 |
stepVersion = ET.SubElement(step, 'VERSION') |
|
61 |
stepVersion.text = '1' |
|
62 |
stepName = ET.SubElement(step, 'NAME') |
|
63 |
stepName.text = dicStep['name'] |
|
64 |
stepType = ET.SubElement(step, 'TYPE') |
|
65 |
stepType.text = dicStep['type'] |
|
66 |
stepTemp = ET.SubElement(step, 'STEP_TEMP') |
|
205
by 314r
amélioration profils de brassage |
67 |
stepTemp.text = str(dicStep['stepTemp']) |
184
by 314r
export profils brassage, reste à gérer l'emplacement |
68 |
stepTime = ET.SubElement(step, 'STEP_TIME') |
205
by 314r
amélioration profils de brassage |
69 |
stepTime.text = str(dicStep['stepTime']) |
184
by 314r
export profils brassage, reste à gérer l'emplacement |
70 |
stepVol = ET.SubElement(step, 'INFUSE_AMOUNT') |
205
by 314r
amélioration profils de brassage |
71 |
# stepVol.text = dicStep['stepVol']
|
72 |
stepVol.text = '0' |
|
185
by 314r
enregistrement profils OK, classés |
73 |
|
74 |
||
75 |
||
76 |
def enregistrer (self, s) : |
|
77 |
ET.ElementTree(self.database).write(s,encoding="utf-8") |
|
184
by 314r
export profils brassage, reste à gérer l'emplacement |
78 |
|
79 |
||
80 |
||
81 |
||
82 |