Ticket #1019: create-torrent-up-to-4MB-piece-size.patch
File create-torrent-up-to-4MB-piece-size.patch, 2.0 KB (added by , 15 years ago) |
---|
-
deluge/ui/gtkui/createtorrentdialog.py
111 111 112 112 self.dialog.show() 113 113 114 def parse_piece_size_text(self, value): 115 psize, metric = value.split() 116 psize = int(psize) * 1024 117 if metric[0] == 'M': 118 psize *= 1024 119 120 return psize 121 114 122 def adjust_piece_size(self): 115 123 """Adjusts the recommended piece based on the file/folder/path selected.""" 116 124 size = self.files_treestore[0][2] 117 125 model = self.glade.get_widget("combo_piece_size").get_model() 118 psize = 0119 126 for index,value in enumerate(model): 120 psize = int(value[0].split()[0]) * 1024127 psize = self.parse_piece_size_text(value[0]) 121 128 pieces = size / psize 122 129 if pieces < 2048 or (index + 1) == len(model): 123 130 self.glade.get_widget("combo_piece_size").set_active(index) … … 284 291 webseeds.append(l) 285 292 # Get the piece length in bytes 286 293 combo = self.glade.get_widget("combo_piece_size") 287 piece_length = int(combo.get_model()[combo.get_active()][0].split()[0]) * 1024 294 piece_length = \ 295 self.parse_piece_size_text(combo.get_model()[combo.get_active()][0]) 288 296 num_pieces = self.files_treestore[0][2] / piece_length 289 297 290 298 author = self.glade.get_widget("entry_author").get_text() -
deluge/ui/gtkui/glade/create_torrent_dialog.glade
553 553 64 KiB 554 554 128 KiB 555 555 256 KiB 556 512 KiB</property> 556 512 KiB 557 1 MiB 558 2 MiB 559 4 MiB</property> 557 560 </widget> 558 561 <packing> 559 562 <property name="expand">False</property>