# preferences.py

Aller à la documentation de ce fichier.

    00001 #!/usr/bin/python
    00002 # -*- coding: utf-8 -*-
    00003 #       $Id: preferences.py 42 2011-01-15 22:38:04Z georgesk $
    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     #         Le constructeur
    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
    00040     ##
    00041     #
    00042     #         @return un dictionnaire de préférences
    00043     #
    00044     def values(self):
    00045         prefs={}
    00046         prefs["checkable"]=bool(self.ui.checkCheck.isChecked())
    00047         prefs["workdir"]= "%s" %self.ui.dirEdit.text().toUtf8()
    00048         return prefs
    00049
    00050     ##
    00051     #
    00052     #         Met en place les préférences dans le dialogue
    00053     #         @param prefs un dictionnaire de préférences
    00054     #
    00055     def setValues(self, prefs):
    00056         if prefs["checkable"]:
    00057             state=Qt.Checked
    00058         else:
    00059             state=Qt.Unchecked
    00060         self.ui.checkCheck.setCheckState(state)
    00061         self.ui.dirEdit.setText(prefs["workdir"])
    00062
    00063
    00064