36 fetched from the connected device and written to the local file system |
36 fetched from the connected device and written to the local file system |
37 @signal putFileDone(localFile, deviceFile) emitted after the file was |
37 @signal putFileDone(localFile, deviceFile) emitted after the file was |
38 copied to the connected device |
38 copied to the connected device |
39 @signal deleteFileDone(deviceFile) emitted after the file has been deleted |
39 @signal deleteFileDone(deviceFile) emitted after the file has been deleted |
40 on the connected device |
40 on the connected device |
|
41 @signal touchFileDone(deviceFile) emitted after the file has been touched |
|
42 on the connected device |
41 @signal putDataDone(deviceFile) emitted after data has been save to a file |
43 @signal putDataDone(deviceFile) emitted after data has been save to a file |
42 on the connected device |
44 on the connected device |
|
45 @signal hashDone(deviceFile, hash) emitted after the hash has been calculated |
|
46 for the file on the connected device |
43 @signal rsyncDone(localName, deviceName) emitted after the rsync operation |
47 @signal rsyncDone(localName, deviceName) emitted after the rsync operation |
44 has been completed |
48 has been completed |
45 @signal rsyncProgressMessage(msg) emitted to send a message about what |
49 @signal rsyncProgressMessage(msg) emitted to send a message about what |
46 rsync is doing |
50 rsync is doing |
47 @signal removeDirectoryDone() emitted after a directory has been deleted |
51 @signal removeDirectoryDone() emitted after a directory has been deleted |
57 currentDir = pyqtSignal(str) |
61 currentDir = pyqtSignal(str) |
58 currentDirChanged = pyqtSignal(str) |
62 currentDirChanged = pyqtSignal(str) |
59 getFileDone = pyqtSignal(str, str) |
63 getFileDone = pyqtSignal(str, str) |
60 putFileDone = pyqtSignal(str, str) |
64 putFileDone = pyqtSignal(str, str) |
61 deleteFileDone = pyqtSignal(str) |
65 deleteFileDone = pyqtSignal(str) |
|
66 touchFileDone = pyqtSignal(str) |
62 putDataDone = pyqtSignal(str) |
67 putDataDone = pyqtSignal(str) |
|
68 hashDone = pyqtSignal(str, str) |
63 rsyncDone = pyqtSignal(str, str) |
69 rsyncDone = pyqtSignal(str, str) |
64 rsyncProgressMessage = pyqtSignal(str) |
70 rsyncProgressMessage = pyqtSignal(str) |
65 removeDirectoryDone = pyqtSignal() |
71 removeDirectoryDone = pyqtSignal() |
66 createDirectoryDone = pyqtSignal() |
72 createDirectoryDone = pyqtSignal() |
67 fsinfoDone = pyqtSignal(tuple) |
73 fsinfoDone = pyqtSignal(tuple) |
280 try: |
286 try: |
281 self.__device.rm(deviceFileName) |
287 self.__device.rm(deviceFileName) |
282 self.deleteFileDone.emit(deviceFileName) |
288 self.deleteFileDone.emit(deviceFileName) |
283 except Exception as exc: |
289 except Exception as exc: |
284 self.error.emit("delete", str(exc)) |
290 self.error.emit("delete", str(exc)) |
|
291 |
|
292 def touchFile(self, deviceFileName): |
|
293 """ |
|
294 Public method to touch a file on the connected device. |
|
295 |
|
296 @param deviceFileName name of the file on the connected device |
|
297 @type str |
|
298 """ |
|
299 try: |
|
300 self.__device.touch(deviceFileName=deviceFileName) |
|
301 self.touchFileDone.emit(deviceFileName) |
|
302 except Exception as exc: |
|
303 self.error.emit("delete", str(exc)) |
|
304 |
|
305 def hashFile(self, deviceFileName, algorithm="sha256", chunkSize=256): |
|
306 """ |
|
307 Public method to generate a hash of a file on the connected device. |
|
308 |
|
309 @param deviceFileName name of the file on the connected device |
|
310 @type str |
|
311 @param algorithm hashing algorithm to be used (defaults to "sha256") |
|
312 @type str (optional) |
|
313 @param chunkSize size of data chunks to be sent to the algorithm |
|
314 (defaults to 256) |
|
315 @type int (optional) |
|
316 """ |
|
317 try: |
|
318 digest = self.__device.hash( |
|
319 deviceFileName=deviceFileName, algorithm=algorithm, chunkSize=chunkSize |
|
320 ) |
|
321 self.hashDone.emit(deviceFileName, digest.hex()) |
|
322 except Exception as exc: |
|
323 self.error.emit("hash", str(exc)) |
285 |
324 |
286 def __rsync( |
325 def __rsync( |
287 self, |
326 self, |
288 hostDirectory, |
327 hostDirectory, |
289 deviceDirectory, |
328 deviceDirectory, |