Aller à la documentation de ce fichier.00001
00002
00003
00004
00005 licence={}
00006 licence['en']="""
00007 file preferences.py
00008 this file is part of the project scolasync
00009
00010 Copyright (C) 2010 Georges Khaznadar <georgesk@ofset.org>
00011
00012 This program is free software: you can redistribute it and/or modify
00013 it under the terms of the GNU General Public License as published by
00014 the Free Software Foundation, either version3 of the License, or
00015 (at your option) any later version.
00016
00017 This program is distributed in the hope that it will be useful,
00018 but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 GNU General Public License for more details.
00021
00022 You should have received a copy of the GNU General Public License
00023 along with this program. If not, see <http://www.gnu.org/licenses/>.
00024 """
00025
00026 from PyQt4.QtCore import *
00027 from PyQt4.QtGui import *
00028
00029 class preferenceWindow(QDialog):
00030
00031
00032
00033
00034 def __init__(self, parent=None):
00035 QDialog.__init__(self, parent)
00036 from Ui_preferences import Ui_Dialog
00037 self.ui=Ui_Dialog()
00038 self.ui.setupUi(self)
00039 self.connect(self.ui.refreshEnabledBox, SIGNAL("stateChanged(int)"), self.enableDelay)
00040 self.connect(self.ui.refreshDelaySlider, SIGNAL("valueChanged(int)"), self.updateRefreshLabel)
00041
00042
00043
00044
00045
00046
00047 def enableDelay(self, state):
00048 self.ui.refreshDelaySlider.setEnabled(bool(state))
00049
00050
00051
00052
00053
00054
00055 def updateRefreshLabel(self, val):
00056 labelTxt=QApplication.translate("Dialog", "%1 secondes", None, QApplication.UnicodeUTF8)
00057 val="%2d" %val
00058 labelTxt=labelTxt.arg(val)
00059 self.ui.refreshDelayLabel.setText(labelTxt)
00060
00061
00062
00063
00064
00065 def values(self):
00066 prefs={}
00067 prefs["checkable"] = bool(self.ui.checkCheck.isChecked())
00068 prefs["mv"] = bool(self.ui.mvCheck.isChecked())
00069 prefs["workdir"] = "%s" %self.ui.dirEdit.text().toUtf8()
00070 prefs["manfile"] = "%s" %self.ui.manFileEdit.text().toUtf8()
00071 prefs["refreshEnabled"] = bool(self.ui.refreshEnabledBox.isChecked())
00072 prefs["refreshDelay"] = self.ui.refreshDelaySlider.value()
00073 return prefs
00074
00075
00076
00077
00078
00079
00080 def setValues(self, prefs):
00081 if prefs["checkable"]:
00082 state=Qt.Checked
00083 else:
00084 state=Qt.Unchecked
00085 self.ui.checkCheck.setCheckState(state)
00086 if prefs["mv"]:
00087 state=Qt.Checked
00088 else:
00089 state=Qt.Unchecked
00090 self.ui.mvCheck.setCheckState(state)
00091 if prefs["refreshEnabled"]:
00092 state=Qt.Checked
00093 else:
00094 state=Qt.Unchecked
00095 self.ui.refreshEnabledBox.setCheckState(state)
00096 self.ui.refreshDelaySlider.setEnabled(prefs["refreshEnabled"])
00097 self.ui.dirEdit.setText(prefs["workdir"])
00098 self.ui.manFileEdit.setText(prefs["manfile"])
00099 self.ui.refreshDelaySlider.setValue(prefs["refreshDelay"])
00100