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/>.
36 self.
bus = dbus.SystemBus()
38 'org.freedesktop.UDisks',
39 '/org/freedesktop/UDisks')
42 'org.freedesktop.UDisks')
43 self.interface.connect_to_signal(
'DeviceAdded', self.
cbAdd)
44 self.interface.connect_to_signal(
'DeviceChanged', self.
cbChange)
45 self.interface.connect_to_signal(
"DeviceRemoved",self.
cbDel)
57 for d
in self.interface.EnumerateDevices():
75 self.widget.emit(SIGNAL(
"deviceAdded(QString)"), key)
85 if key
and not self.connectedVolumes.has_key(key):
89 self.widget.emit(SIGNAL(
"deviceAdded(QString)"), key)
100 if self.connectedVolumes.has_key(key):
102 self.widget.emit(SIGNAL(
"deviceRemoved(QString)"), key)
103 self.connectedVolumes.pop(key)
115 if type(dev)==type(
""):
117 o=self.bus.get_object(
"org.freedesktop.UDisks", dev)
130 if type(dev)==type(
""):
132 o=self.bus.get_object(
"org.freedesktop.UDisks", dev)
133 i=dbus.Interface(o,
"org.freedesktop.DBus.Properties")
134 stickId, tattoo, uuid =
"",
"",
""
136 p=i.Get(
'',
'DeviceMountPaths')
139 tattoo=ownedUsbDisk.tattooInDir(mountPoint)
143 uuid=str(i.Get(
'',
'IdUuid'))
147 stickId=str(i.Get(
"",
"DriveSerial"))
150 return (stickId, tattoo, uuid)
159 i=dbus.Interface(o,
"org.freedesktop.DBus.Properties")
161 result=str(i.Get(
'',
'DriveConnectionInterface'))==
"usb" and \
162 str(i.Get(
'',
'IdType'))==
"vfat"