1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#!/usr/bin/python3
#*coding: utf8 -*
#JolieBulle 2.8
#Copyright (C) 2010-2013 Pierre Tavares
#This program 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 3
#of the License, or (at your option) any later version.
#This program 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 this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import codecs
import PyQt4
import sys
import logging
from PyQt4 import QtGui
from PyQt4 import QtCore
from base import *
from globals import *
from preferences_ui import *
from settings import *
from globals import *
import xml.etree.ElementTree as ET
from xml.dom import minidom
logger = logging.getLogger(__name__)
class DialogPref(QtGui.QDialog):
prefAccepted = QtCore.pyqtSignal()
def __init__(self, parent = None):
QtGui.QDialog.__init__(self,parent)
settings = Settings()
self.ui = Ui_Preferences()
self.ui.setupUi(self)
self.ui.lineEditPathLib.setText(recettes_dir)
try :
self.ui.spinBoxBoilOff.setValue(int(settings.conf.value("BoilOffRate")))
self.ui.spinBoxCooling.setValue(int(settings.conf.value("CoolingLoss")))
except :
pass
try :
self.ui.spinBoxGrainTemp.setValue(int(settings.conf.value("GrainTemp")))
self.ui.doubleSpinBoxFudgeFactor.setValue(float(settings.conf.value("FudgeFactor")))
except :
pass
try :
self.ui.doubleSpinBoxGrainRetention.setValue(int(settings.conf.value("GrainRetention")))
except :
pass
try:
if settings.conf.value("Menus") == "button" :
self.ui.radioButtonMenuButton.setChecked(True)
elif settings.conf.value("Menus") == "menubar" :
self.ui.radioButtonMenuBar.setChecked(True)
except :
pass
#les connections
self.ui.pushButtonChangeLib.clicked.connect(self.changePushed)
self.ui.buttonBox.accepted.connect(self.accepted)
self.ui.buttonBox.rejected.connect(self.rejected)
def changePushed (self) :
self.d = QtGui.QFileDialog.getExistingDirectory(self,
self.trUtf8("Choisir un dossier"),
home_dir,
)
if not self.d :
pass
else :
self.ui.lineEditPathLib.setText(self.d)
def accepted(self) :
if platform == 'win32' :
settings.conf.setValue("pathWin32", self.ui.lineEditPathLib.text())
else :
settings.conf.setValue("pathUnix", self.ui.lineEditPathLib.text())
logger.debug(settings.conf.value("pathUnix"))
settings.conf.setValue("BoilOffRate", self.ui.spinBoxBoilOff.value())
settings.conf.setValue("CoolingLoss", self.ui.spinBoxCooling.value())
settings.conf.setValue("GrainTemp", self.ui.spinBoxGrainTemp.value())
settings.conf.setValue("FudgeFactor", self.ui.doubleSpinBoxFudgeFactor.value())
settings.conf.setValue("GrainRetention", self.ui.doubleSpinBoxGrainRetention.value())
if self.ui.radioButtonMenuButton.isChecked():
settings.conf.setValue("Menus", "button")
else :
settings.conf.setValue("Menus", "menubar")
self.prefAccepted.emit()
def rejected (self) :
self.ui.lineEditPathLib.setText(recettes_dir)
|