mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-07-05 09:29:21 +02:00
fixed the order of links in the yt dialog
This commit is contained in:
@@ -1378,6 +1378,7 @@ Author: Dmitriy Yefremov
|
||||
<child>
|
||||
<object class="GtkCellRendererToggle" id="yt_selected_renderer">
|
||||
<property name="width">50</property>
|
||||
<signal name="toggled" handler="on_selected_toggled" swapped="no"/>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="active">2</attribute>
|
||||
|
||||
@@ -600,8 +600,9 @@ class YtListImportDialog:
|
||||
|
||||
try:
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
|
||||
done_links = []
|
||||
futures = {executor.submit(YouTube.get_yt_link, r[1]): r for r in self._model if r[2]}
|
||||
done_links = {}
|
||||
rows = list(filter(lambda r: r[2], self._model))
|
||||
futures = {executor.submit(YouTube.get_yt_link, r[1]): r for r in rows}
|
||||
size = len(futures)
|
||||
counter = 0
|
||||
|
||||
@@ -609,7 +610,8 @@ class YtListImportDialog:
|
||||
if not self._download_task:
|
||||
executor.shutdown()
|
||||
return
|
||||
done_links.append(future.result())
|
||||
|
||||
done_links[futures[future]] = future.result()
|
||||
counter += 1
|
||||
self.update_progress_bar(counter / size)
|
||||
except Exception as e:
|
||||
@@ -617,7 +619,7 @@ class YtListImportDialog:
|
||||
else:
|
||||
if self._download_task:
|
||||
self.show_info_message(get_message("Done!"), Gtk.MessageType.INFO)
|
||||
self.append_services(done_links)
|
||||
self.append_services([done_links[r] for r in rows])
|
||||
finally:
|
||||
self._download_task = False
|
||||
self.update_active_elements(True)
|
||||
|
||||
Reference in New Issue
Block a user