43 @signal removeDirectoryDone() emitted after a directory has been deleted |
43 @signal removeDirectoryDone() emitted after a directory has been deleted |
44 @signal createDirectoryDone() emitted after a directory was created |
44 @signal createDirectoryDone() emitted after a directory was created |
45 @signal fsinfoDone(fsinfo) emitted after the file system information was |
45 @signal fsinfoDone(fsinfo) emitted after the file system information was |
46 obtained |
46 obtained |
47 |
47 |
48 @signal synchTimeDone() emitted after the time was synchronizde to the |
|
49 device |
|
50 @signal showTimeDone(dateTime) emitted after the date and time was fetched |
|
51 from the connected device |
|
52 @signal showVersionDone(versionInfo) emitted after the version information |
|
53 was fetched from the connected device |
|
54 @signal showImplementationDone(name,version) emitted after the |
|
55 implementation information has been obtained |
|
56 |
|
57 @signal error(exc) emitted with a failure message to indicate a failure |
48 @signal error(exc) emitted with a failure message to indicate a failure |
58 during the most recent operation |
49 during the most recent operation |
59 """ |
50 """ |
60 longListFiles = pyqtSignal(tuple) |
51 longListFiles = pyqtSignal(tuple) |
61 currentDir = pyqtSignal(str) |
52 currentDir = pyqtSignal(str) |
66 rsyncDone = pyqtSignal(str, str) |
57 rsyncDone = pyqtSignal(str, str) |
67 rsyncProgressMessage = pyqtSignal(str) |
58 rsyncProgressMessage = pyqtSignal(str) |
68 removeDirectoryDone = pyqtSignal() |
59 removeDirectoryDone = pyqtSignal() |
69 createDirectoryDone = pyqtSignal() |
60 createDirectoryDone = pyqtSignal() |
70 fsinfoDone = pyqtSignal(tuple) |
61 fsinfoDone = pyqtSignal(tuple) |
71 |
|
72 synchTimeDone = pyqtSignal() |
|
73 showTimeDone = pyqtSignal(str) |
|
74 showVersionDone = pyqtSignal(dict) |
|
75 showImplementationDone = pyqtSignal(str, str) |
|
76 |
62 |
77 error = pyqtSignal(str, str) |
63 error = pyqtSignal(str, str) |
78 |
64 |
79 def __init__(self, commandsInterface, parent=None): |
65 def __init__(self, commandsInterface, parent=None): |
80 """ |
66 """ |
379 try: |
365 try: |
380 fsinfo = self.__commandsInterface.fileSystemInfo() |
366 fsinfo = self.__commandsInterface.fileSystemInfo() |
381 self.fsinfoDone.emit(fsinfo) |
367 self.fsinfoDone.emit(fsinfo) |
382 except Exception as exc: |
368 except Exception as exc: |
383 self.error.emit("fileSystemInfo", str(exc)) |
369 self.error.emit("fileSystemInfo", str(exc)) |
384 |
|
385 ################################################################## |
|
386 ## some non-filesystem related methods below |
|
387 ################################################################## |
|
388 |
|
389 @pyqtSlot() |
|
390 def synchronizeTime(self): |
|
391 """ |
|
392 Public slot to set the time of the connected device to the local |
|
393 computer's time. |
|
394 """ |
|
395 try: |
|
396 self.__commandsInterface.syncTime() |
|
397 self.synchTimeDone.emit() |
|
398 except Exception as exc: |
|
399 self.error.emit("rmdir", str(exc)) |
|
400 |
|
401 @pyqtSlot() |
|
402 def showTime(self): |
|
403 """ |
|
404 Public slot to get the current date and time of the device. |
|
405 """ |
|
406 try: |
|
407 dt = self.__commandsInterface.showTime() |
|
408 self.showTimeDone.emit(dt) |
|
409 except Exception as exc: |
|
410 self.error.emit("showTime", str(exc)) |
|
411 |
|
412 @pyqtSlot() |
|
413 def showVersion(self): |
|
414 """ |
|
415 Public slot to get the version info for the MicroPython run by the |
|
416 connected device. |
|
417 """ |
|
418 try: |
|
419 versionInfo = self.__commandsInterface.version() |
|
420 self.showVersionDone.emit(versionInfo) |
|
421 except Exception as exc: |
|
422 self.error.emit("showVersion", str(exc)) |
|
423 |
|
424 @pyqtSlot() |
|
425 def showImplementation(self): |
|
426 """ |
|
427 Public slot to obtain some implementation related information. |
|
428 """ |
|
429 try: |
|
430 impInfo = self.__commandsInterface.getImplementation() |
|
431 if impInfo["name"] == "micropython": |
|
432 name = "MicroPython" |
|
433 elif impInfo["name"] == "circuitpython": |
|
434 name = "CircuitPython" |
|
435 elif impInfo["name"] == "unknown": |
|
436 name = self.tr("unknown") |
|
437 else: |
|
438 name = impInfo["name"] |
|
439 if impInfo["version"] == "unknown": |
|
440 version = self.tr("unknown") |
|
441 else: |
|
442 version = impInfo["version"] |
|
443 self.showImplementationDone.emit(name, version) |
|
444 except Exception as exc: |
|
445 self.error.emit("showVersion", str(exc)) |
|