Improved the FtpReply a bit.

Thu, 20 Sep 2012 20:10:08 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 20 Sep 2012 20:10:08 +0200
changeset 2053
ef81185e8b89
parent 2052
b89c21c96127
child 2054
099993935e6d

Improved the FtpReply a bit.

Helpviewer/Download/DownloadItem.ui file | annotate | diff | comparison | revisions
Helpviewer/Network/FtpReply.py file | annotate | diff | comparison | revisions
--- a/Helpviewer/Download/DownloadItem.ui	Thu Sep 20 20:09:51 2012 +0200
+++ b/Helpviewer/Download/DownloadItem.ui	Thu Sep 20 20:10:08 2012 +0200
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>400</width>
-    <height>68</height>
+    <height>82</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -60,7 +60,7 @@
         </sizepolicy>
        </property>
        <property name="text">
-        <string>Info</string>
+        <string notr="true">Info</string>
        </property>
        <property name="alignment">
         <set>Qt::AlignCenter</set>
--- a/Helpviewer/Network/FtpReply.py	Thu Sep 20 20:09:51 2012 +0200
+++ b/Helpviewer/Network/FtpReply.py	Thu Sep 20 20:10:08 2012 +0200
@@ -102,21 +102,6 @@
     """
     Class implementing a network reply for FTP resources.
     """
-    Monthnames2Int = {
-        "Jan": 1,
-        "Feb": 2,
-        "Mar": 3,
-        "Apr": 4,
-        "May": 5,
-        "Jun": 6,
-        "Jul": 7,
-        "Aug": 8,
-        "Sep": 9,
-        "Oct": 10,
-        "Nov": 11,
-        "Dec": 12,
-    }
-    
     def __init__(self, url, accessHandler, parent=None):
         """
         Constructor
@@ -136,6 +121,7 @@
         self.__content = QByteArray()
         self.__units = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
         self.__dirLineParser = FtpDirLineParser()
+        self.__fileBytesReceived = 0
         
         if url.path() == "":
             url.setPath("/")
@@ -227,6 +213,7 @@
                 self.__ftp.retrlines("LIST " + self.url().path(), self.__dirCallback)
                 if len(self.__items) == 1 and \
                    self.__items[0].isFile():
+                    self.__fileBytesReceived = 0
                     self.__setContent()
                     self.__ftp.retrbinary(
                         "RETR " + self.url().path(), self.__retrCallback)
@@ -331,6 +318,9 @@
         @param data data received from the FTP server (bytes)
         """
         self.__content += QByteArray(data)
+        self.__fileBytesReceived += len(data)
+        self.downloadProgress.emit(self.__fileBytesReceived, self.__items[0].size())
+        self.readyRead.emit()
         
         QCoreApplication.processEvents()
     

eric ide

mercurial