7 this file is part of the project scolasync
9 Copyright (C) 2012 Georges Khaznadar <georgesk@ofset.org>
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.
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.
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/>.
48 def __init__(self, parent=None, oldName="", nameList=[], driveIdent=None):
49 QDialog.__init__(self, parent)
52 assert driveIdent !=
None
53 self.stickId, self.uuid, self.
tattoo = driveIdent
54 self.
ui=Ui_nameAdrive.Ui_Dialog()
57 self.ui.listWidget.addItem(n)
58 self.ui.lineEditOld.setText(self.
oldName)
60 self.connect(self.ui.listWidget, SIGNAL(
"itemSelectionChanged()"), self.
selectionChanged)
61 self.connect(self.ui.pushButtonOK, SIGNAL(
"clicked()"), self.
ok)
62 self.connect(self.ui.pushButtonEsc, SIGNAL(
"clicked()"), self.
esc)
73 m=self.numPattern.match(
"%s" %self.
oldName)
78 possible=lw.findItems(regexp,Qt.MatchRegExp)
80 lw.setCurrentItem(possible[0])
82 lw.setCurrentItem(lw.item(0))
84 lw.setCurrentItem(lw.item(0))
93 l=self.ui.listWidget.selectedItems()
95 t=i.data(Qt.DisplayRole).toString()
96 self.ui.lineEditNew.setText(t)
104 newName=
"%s" %self.ui.lineEditNew.text()
105 newName.encode(
"utf-8")
106 db.writeStudent(self.stickId, self.uuid, self.
tattoo, newName)
107 self.parent().namesDialog.takeItem(newName)
108 self.parent().checkDisks(noLoop=
True)
109 self.done(QDialog.Accepted)
117 self.done(QDialog.Rejected)
def __init__
Le constructeur.
def ok
fonction de rappel quand l'utilisateur valide le choix
un dialogue pour renommer un baladeur, compte tenu d'une liste de noms disponibles ...
def makeSelection
Si l'ancien nom commence par un numéro, sélectionne le premier élément de la liste commençant par le ...
def selectionChanged
fonction de rappel quand la sélection change dans la liste; recopie l'élément sélectionné comme nouve...
def esc
fonction de rappel quand l'utilisateur cherche à échapper au choix