7 this file is part of the project scolasync
9 Copyright (C) 2010 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/>.
37 self.
bus = dbus.SystemBus()
39 'org.freedesktop.UDisks',
40 '/org/freedesktop/UDisks')
43 'org.freedesktop.UDisks')
44 self.interface.connect_to_signal(
'DeviceAdded', self.
cbAdd)
45 self.interface.connect_to_signal(
'DeviceChanged', self.
cbChange)
46 self.interface.connect_to_signal(
"DeviceRemoved",self.
cbDel)
58 for d
in self.interface.EnumerateDevices():
74 self.widget.emit(SIGNAL(
"deviceAdded(QString)"), key)
87 self.widget.emit(SIGNAL(
"deviceAdded(QString)"), key)
100 self.widget.emit(SIGNAL(
"deviceRemoved(QString)"), key)
101 self.connectedVolumes.pop(key)
112 if type(dev)==type(
""):
114 o=self.bus.get_object(
"org.freedesktop.UDisks", dev)
127 if type(dev)==type(
""):
129 o=self.bus.get_object(
"org.freedesktop.UDisks", dev)
130 i=dbus.Interface(o,
"org.freedesktop.DBus.Properties")
131 stickId, tattoo, uuid =
"",
"",
""
133 p=i.Get(
'',
'DeviceMountPaths')
136 tattoo=ownedUsbDisk.tattooInDir(mountPoint)
140 uuid=str(i.Get(
'',
'IdUuid'))
144 stickId=str(i.Get(
"",
"DriveSerial"))
147 return (stickId, tattoo, uuid)
156 i=dbus.Interface(o,
"org.freedesktop.DBus.Properties")
158 result=str(i.Get(
'',
'DriveConnectionInterface'))==
"usb" and \
159 str(i.Get(
'',
'IdType'))==
"vfat"
def pollDevices
peuple le dictionnaire self.connectedVolumes avec les volumes actuellement gérés par dbus...
def identify
Renvoie une identification de baladeur pour scolasync.
def cbAdd
fonction de rappel pour une clé qu'on vient de brancher
def cbChange
fonction de rappel pour une clé qui vient de changer de type
def __init__
le constructeur
def cbDel
fonction de rappel pour une clé retirée
def isVfatUsb
Décide si une partition est de type vfat, et connectée par USB.
def vfatUsbPath
Détermine le chemin UDisks pour une partition vfat connectée par USB.