83 self.__fileManager.rsyncProgressMessage.connect( |
83 self.__fileManager.rsyncProgressMessage.connect( |
84 self.__handleRsyncProgressMessage) |
84 self.__handleRsyncProgressMessage) |
85 self.__fileManager.removeDirectoryDone.connect(self.__newDeviceList) |
85 self.__fileManager.removeDirectoryDone.connect(self.__newDeviceList) |
86 self.__fileManager.createDirectoryDone.connect(self.__newDeviceList) |
86 self.__fileManager.createDirectoryDone.connect(self.__newDeviceList) |
87 self.__fileManager.deleteFileDone.connect(self.__newDeviceList) |
87 self.__fileManager.deleteFileDone.connect(self.__newDeviceList) |
88 self.__fileManager.fsinfoDone.connect(self.__shownFsInfoResult) |
88 self.__fileManager.fsinfoDone.connect(self.__fsInfoResultReceived) |
89 self.__fileManager.synchTimeDone.connect(self.__timeSynchronized) |
|
90 self.__fileManager.showTimeDone.connect(self.__deviceTimeReceived) |
|
91 self.__fileManager.showVersionDone.connect( |
|
92 self.__deviceVersionReceived) |
|
93 self.__fileManager.showImplementationDone.connect( |
|
94 self.__deviceImplementationReceived) |
|
95 |
89 |
96 self.__fileManager.error.connect(self.__handleError) |
90 self.__fileManager.error.connect(self.__handleError) |
97 |
91 |
98 self.localFileTreeWidget.customContextMenuRequested.connect( |
92 self.localFileTreeWidget.customContextMenuRequested.connect( |
99 self.__showLocalContextMenu) |
93 self.__showLocalContextMenu) |
127 self.__devDelFileAct = self.__deviceMenu.addAction( |
121 self.__devDelFileAct = self.__deviceMenu.addAction( |
128 self.tr("Delete File"), self.__deleteDeviceFile) |
122 self.tr("Delete File"), self.__deleteDeviceFile) |
129 self.__deviceMenu.addSeparator() |
123 self.__deviceMenu.addSeparator() |
130 self.__deviceMenu.addAction( |
124 self.__deviceMenu.addAction( |
131 self.tr("Show Filesystem Info"), self.__showFileSystemInfo) |
125 self.tr("Show Filesystem Info"), self.__showFileSystemInfo) |
132 self.__deviceMenu.addSeparator() |
|
133 self.__deviceMenu.addAction( |
|
134 self.tr("Synchronize Time"), self.__synchronizeTime) |
|
135 self.__deviceMenu.addAction( |
|
136 self.tr("Show Time"), self.__showDeviceTime) |
|
137 self.__deviceMenu.addSeparator() |
|
138 self.__deviceMenu.addAction( |
|
139 self.tr("Show Version"), self.__showDeviceVersion) |
|
140 self.__deviceMenu.addAction( |
|
141 self.tr("Show Implementation"), self.__showImplementation) |
|
142 |
126 |
143 def start(self): |
127 def start(self): |
144 """ |
128 """ |
145 Public method to start the widget. |
129 Public method to start the widget. |
146 """ |
130 """ |
742 Private slot to show some file system information. |
726 Private slot to show some file system information. |
743 """ |
727 """ |
744 self.__fileManager.fileSystemInfo() |
728 self.__fileManager.fileSystemInfo() |
745 |
729 |
746 @pyqtSlot(tuple) |
730 @pyqtSlot(tuple) |
747 def __shownFsInfoResult(self, fsinfo): |
731 def __fsInfoResultReceived(self, fsinfo): |
748 """ |
732 """ |
749 Private slot to show the file systom information of the device. |
733 Private slot to show the file system information of the device. |
750 |
734 |
751 @param fsinfo tuple of tuples containing the file system name, the |
735 @param fsinfo tuple of tuples containing the file system name, the |
752 total size, the used size and the free size |
736 total size, the used size and the free size |
753 @type tuple of tuples of (str, int, int, int) |
737 @type tuple of tuples of (str, int, int, int) |
754 """ |
738 """ |
768 ) |
752 ) |
769 E5MessageBox.information( |
753 E5MessageBox.information( |
770 self, |
754 self, |
771 self.tr("Filesystem Information"), |
755 self.tr("Filesystem Information"), |
772 msg) |
756 msg) |
773 |
|
774 @pyqtSlot() |
|
775 def __synchronizeTime(self): |
|
776 """ |
|
777 Private slot to synchronize the local time to the device. |
|
778 """ |
|
779 self.__fileManager.synchronizeTime() |
|
780 |
|
781 @pyqtSlot() |
|
782 def __timeSynchronized(self): |
|
783 """ |
|
784 Private slot handling the successful syncronization of the time. |
|
785 """ |
|
786 E5MessageBox.information( |
|
787 self, |
|
788 self.tr("Synchronize Time"), |
|
789 self.tr("The time of the connected device was synchronized with" |
|
790 " the local time.")) |
|
791 |
|
792 @pyqtSlot() |
|
793 def __showDeviceTime(self): |
|
794 """ |
|
795 Private slot to show the date and time of the connected device. |
|
796 """ |
|
797 self.__fileManager.showTime() |
|
798 |
|
799 @pyqtSlot(str) |
|
800 def __deviceTimeReceived(self, dateTimeString): |
|
801 """ |
|
802 Private slot handling the receipt of the device date and time. |
|
803 |
|
804 @param dateTimeString string containg the date and time of the device |
|
805 @type str |
|
806 """ |
|
807 try: |
|
808 date, time = dateTimeString.strip().split(None, 1) |
|
809 msg = self.tr( |
|
810 "<h3>Device Date and Time</h3>" |
|
811 "<table>" |
|
812 "<tr><td><b>Date</b></td><td>{0}</td></tr>" |
|
813 "<tr><td><b>Time</b></td><td>{1}</td></tr>" |
|
814 "</table>" |
|
815 ).format(date, time) |
|
816 except ValueError: |
|
817 msg = self.tr( |
|
818 "<h3>Device Date and Time</h3>" |
|
819 "<p>{0}</p>" |
|
820 ).format(dateTimeString.strip()) |
|
821 E5MessageBox.information( |
|
822 self, |
|
823 self.tr("Device Date and Time"), |
|
824 msg) |
|
825 |
|
826 @pyqtSlot() |
|
827 def __showDeviceVersion(self): |
|
828 """ |
|
829 Private slot to show some version info about MicroPython of the device. |
|
830 """ |
|
831 self.__fileManager.showVersion() |
|
832 |
|
833 @pyqtSlot(dict) |
|
834 def __deviceVersionReceived(self, versionInfo): |
|
835 """ |
|
836 Private slot handling the receipt of the version info. |
|
837 |
|
838 @param versionInfo dictionary containing the version information |
|
839 @type dict |
|
840 """ |
|
841 if versionInfo: |
|
842 msg = self.tr( |
|
843 "<h3>Device Version Information</h3>" |
|
844 ) |
|
845 msg += "<table>" |
|
846 for key, value in versionInfo.items(): |
|
847 msg += "<tr><td><b>{0}</b></td><td>{1}</td></tr>".format( |
|
848 key.capitalize(), value) |
|
849 msg += "</table>" |
|
850 else: |
|
851 msg = self.tr("No version information available.") |
|
852 E5MessageBox.information( |
|
853 self, |
|
854 self.tr("Device Version Information"), |
|
855 msg) |
|
856 |
|
857 @pyqtSlot() |
|
858 def __showImplementation(self): |
|
859 """ |
|
860 Private slot to show some implementation related information. |
|
861 """ |
|
862 self.__fileManager.showImplementation() |
|
863 |
|
864 @pyqtSlot(str, str) |
|
865 def __deviceImplementationReceived(self, name, version): |
|
866 """ |
|
867 Private slot handling the receipt of implementation info. |
|
868 |
|
869 @param name name of the implementation |
|
870 @type str |
|
871 @param version version string of the implementation |
|
872 @type str |
|
873 """ |
|
874 E5MessageBox.information( |
|
875 self, |
|
876 self.tr("Device Implementation Information"), |
|
877 self.tr( |
|
878 "<h3>Device Implementation Information</h3>" |
|
879 "<p>This device contains <b>{0} {1}</b>.</p>" |
|
880 ).format(name, version) |
|
881 ) |
|