6 this file is part of the project scolasync
8 Copyright (C) 2012 Georges Khaznadar <georgesk@ofset.org>
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
45 def __init__(self, parent=None, oldName="", nameList=[], driveIdent=None):
46 QDialog.__init__(self, parent)
49 assert driveIdent !=
None
50 self.stickId, self.uuid, self.
tattoo = driveIdent
51 self.
ui=Ui_nameAdrive.Ui_Dialog()
54 self.ui.listWidget.addItem(n)
55 self.ui.lineEditOld.setText(self.
oldName)
58 self.ui.pushButtonOK.clicked.connect(self.
ok)
59 self.ui.pushButtonEsc.clicked.connect(self.
esc)
69 m=self.numPattern.match(
"%s" %self.
oldName)
74 possible=lw.findItems(regexp,Qt.MatchRegExp)
76 lw.setCurrentItem(possible[0])
78 lw.setCurrentItem(lw.item(0))
80 lw.setCurrentItem(lw.item(0))
89 l=self.ui.listWidget.selectedItems()
91 t=i.data(Qt.DisplayRole)
92 self.ui.lineEditNew.setText(t)
100 newName=
"%s" %self.ui.lineEditNew.text()
101 newName.encode(
"utf-8")
102 db.writeStudent(self.stickId, self.uuid, self.
tattoo, newName)
103 self.parent().namesDialog.takeItem(newName)
104 self.parent().checkDisks(noLoop=
True)
105 self.done(QDialog.Accepted)
113 self.done(QDialog.Rejected)
def __init__
Le constructeur.
def ok(self)
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(self)
Si l'ancien nom commence par un numéro, sélectionne le premier élément de la liste commençant par le ...
def esc(self)
fonction de rappel quand l'utilisateur cherche à échapper au choix
def selectionChanged(self)
fonction de rappel quand la sélection change dans la liste; recopie l'élément sélectionné comme nouve...