Author: andar

Revision: 6036

Log:
        Fix #1095 incorrect piece size used when using some non-English 
languages

Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog   2009-12-16 13:46:39 UTC (rev 6035)
+++ branches/1.2_RC/ChangeLog   2009-12-17 21:27:04 UTC (rev 6036)
@@ -32,6 +32,7 @@
        * Made the password dialog prettier
        * Fix #1086 deprecated gtk.Tooltips usage
        * Fix #768 save tracker list for create torrent dialog
+       * Fix #1095 incorrect piece size used when using some non-English 
languages
 
 ==== Console ====
        * Fix using the console in Windows, but only in command-line mode

Modified: branches/1.2_RC/deluge/ui/gtkui/createtorrentdialog.py
===================================================================
--- branches/1.2_RC/deluge/ui/gtkui/createtorrentdialog.py      2009-12-16 
13:46:39 UTC (rev 6035)
+++ branches/1.2_RC/deluge/ui/gtkui/createtorrentdialog.py      2009-12-17 
21:27:04 UTC (rev 6036)
@@ -115,9 +115,13 @@
 
     def parse_piece_size_text(self, value):
         psize, metric = value.split()
-        psize = int(psize) * 1024
-        if metric[0] == 'M':
-            psize *= 1024
+        psize = int(psize)
+        if psize < 32:
+            # This is a MiB value
+            psize = psize * 1024 * 1024
+        else:
+            # This is a KiB value
+            psize = psize * 1024
 
         return psize
 

Modified: trunk/deluge/ui/gtkui/createtorrentdialog.py
===================================================================
--- trunk/deluge/ui/gtkui/createtorrentdialog.py        2009-12-16 13:46:39 UTC 
(rev 6035)
+++ trunk/deluge/ui/gtkui/createtorrentdialog.py        2009-12-17 21:27:04 UTC 
(rev 6036)
@@ -115,9 +115,13 @@
 
     def parse_piece_size_text(self, value):
         psize, metric = value.split()
-        psize = int(psize) * 1024
-        if metric[0] == 'M':
-            psize *= 1024
+        psize = int(psize)
+        if psize < 32:
+            # This is a MiB value
+            psize = psize * 1024 * 1024
+        else:
+            # This is a KiB value
+            psize = psize * 1024
 
         return psize
 


--

You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.


Reply via email to