Skip to content

Commit

Permalink
Disable progressbars for individual files
Browse files Browse the repository at this point in the history
  • Loading branch information
ichorid committed Dec 27, 2021
1 parent 6f1e9e8 commit f3f9245
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
from tribler_gui.utilities import compose_magnetlink, connect, copy_to_clipboard, format_size, format_speed, tr

INCLUDED_FILES_CHANGE_DELAY = 1000 # milliseconds
PROGRESS_BAR_DRAW_LIMIT = 1000 # Don't draw progress bars for files in torrents that have more than this many files

# Disabled, because drawing progress bars with setItemWidget is horribly slow on some systems.
# We must use delegate-based drawing instead
PROGRESS_BAR_DRAW_LIMIT = 0 # Don't draw progress bars for files in torrents that have more than this many files


def convert_to_files_tree_format(download_info):
Expand Down
4 changes: 2 additions & 2 deletions src/tribler-gui/tribler_gui/widgets/torrentfiletreewidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ def subtree_progress_update(self, updates, force_update=False, draw_progress_bar
self.progress_bytes = self.progress_bytes - old_bytes + new_bytes

if child_changed or force_update:
if self.file_size and self.progress_bytes:
if self.progress_bytes is not None and self.file_size:
self.file_progress = self.progress_bytes / self.file_size
self.setText(PROGRESS_COL, f"{self.file_progress:.1%}")

# ACHTUNG! This can be _very_ slow for torrents with lots of files, hence disabled by default
# To draw progress bars with acceptable performance we'd have to implement use QT's MVC stuff
# To draw progress bars with acceptable performance we'd have to use QT's MVC stuff
if draw_progress_bars:
bar_container, progress_bar = create_progress_bar_widget()
progress_bar.setValue(int(self.file_progress * 100))
Expand Down

0 comments on commit f3f9245

Please sign in to comment.