ScolaSync  5.1
preferences.py
Aller à la documentation de ce fichier.
1 #!/usr/bin/python
2 # $Id: preferences.py 42 2011-01-15 22:38:04Z georgesk $
3 
4 licence={}
5 licence['en']="""
6  file preferences.py
7  this file is part of the project scolasync
8 
9  Copyright (C) 2010-2012 Georges Khaznadar <georgesk@ofset.org>
10 
11  This program is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version3 of the License, or
14  (at your option) any later version.
15 
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program. If not, see <http://www.gnu.org/licenses/>.
23 """
24 
25 from PyQt5.QtCore import *
26 from PyQt5.QtWidgets import *
27 
29 
31 
32  def __init__(self, parent=None):
33  QDialog.__init__(self, parent)
34  from Ui_preferences import Ui_Dialog
35  self.ui=Ui_Dialog()
36  self.ui.setupUi(self)
37 
38 
41 
42  def enableDelay(self, state):
43  self.ui.refreshDelaySlider.setEnabled(bool(state))
44 
45 
48 
49  def updateRefreshLabel(self, val):
50  labelTxt=QApplication.translate("Dialog", "{t} secondes", None)
51  val="%2d" %val
52  labelTxt=labelTxt.format(t=val)
53  self.ui.refreshDelayLabel.setText(labelTxt)
54 
55 
57 
58  def values(self):
59  prefs={}
60  prefs["checkable"] = True
61  prefs["mv"] = bool(self.ui.mvCheck.isChecked())
62  prefs["schoolFile"] = self.ui.lineEditSchoolFile.text()
63  prefs["workdir"] = self.ui.dirEdit.text()
64  prefs["manfile"] = self.ui.manFileEdit.text()
65  return prefs
66 
67 
70 
71  def setValues(self, prefs):
72  if prefs["mv"]:
73  state=Qt.Checked
74  else:
75  state=Qt.Unchecked
76  self.ui.mvCheck.setCheckState(state)
77  self.ui.lineEditSchoolFile.setText(prefs["schoolFile"])
78  self.ui.dirEdit.setText(prefs["workdir"])
79  self.ui.manFileEdit.setText(prefs["manfile"])
src.preferences.preferenceWindow.ui
ui
Definition: preferences.py:35
QDialog
src.preferences.preferenceWindow.updateRefreshLabel
def updateRefreshLabel(self, val)
Met à jour l'affichage de la valeur du délai de rafraichissement.
Definition: preferences.py:49
src.preferences.preferenceWindow
Definition: preferences.py:28
src.preferences.preferenceWindow.enableDelay
def enableDelay(self, state)
active ou désactive le glisseur pour modifier le délai de rafraichissement
Definition: preferences.py:42
src.preferences.preferenceWindow.values
def values(self)
Definition: preferences.py:58
QtCore
src.preferences.preferenceWindow.setValues
def setValues(self, prefs)
Met en place les préférences dans le dialogue.
Definition: preferences.py:71
src.preferences.preferenceWindow.__init__
def __init__(self, parent=None)
Le constructeur.
Definition: preferences.py:32
QtWidgets