Skip to content

Commit

Permalink
add settings to remember_columns width
Browse files Browse the repository at this point in the history
  • Loading branch information
heldersepu committed May 7, 2024
1 parent 6aa904a commit 5f2848c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/tribler/core/components/libtorrent/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class DownloadDefaultsSettings(TriblerConfigSection):
seeding_time: float = 60
channel_download: bool = False
add_download_to_channel: bool = False
remember_columns: bool = False
columns: str = ""

@validator('number_hops')
def validate_number_hops(cls, v):
Expand Down
10 changes: 10 additions & 0 deletions src/tribler/gui/widgets/downloadspage.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def showEvent(self, QShowEvent):
"""
super().showEvent(QShowEvent)
self.schedule_downloads_refresh(REFRESH_DOWNLOADS_SOON_INTERVAL_MSEC)
request_manager.get("settings", self.initialize_with_settings)

def hideEvent(self, QHideEvent):
super().hideEvent(QHideEvent)
Expand Down Expand Up @@ -105,6 +106,15 @@ def initialize_downloads_page(self):
self.background_refresh_downloads_timer.setSingleShot(True)
connect(self.background_refresh_downloads_timer.timeout, self.on_background_refresh_downloads_timer)

def initialize_with_settings(self, settings):
if not settings:
return
self.settings = settings = settings["settings"]
if settings['download_defaults']['remember_columns']:
for kv in settings['download_defaults']['columns'].split(","):
key, value = kv.split(":")
self.window().downloads_list.header().resizeSection(int(key), int(value))

def on_filter_text_changed(self, text):
self.window().downloads_list.clearSelection()
self.window().download_details_widget.hide()
Expand Down

0 comments on commit 5f2848c

Please sign in to comment.