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 5f2848c commit ff812fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/tribler/core/components/libtorrent/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ 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
18 changes: 7 additions & 11 deletions src/tribler/gui/widgets/downloadspage.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ 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 All @@ -101,20 +100,17 @@ def initialize_downloads_page(self):
connect(self.window().downloads_filter_input.textChanged, self.on_filter_text_changed)

self.window().downloads_list.header().setSortIndicator(12, Qt.AscendingOrder)
self.window().downloads_list.header().resizeSection(12, 146)
columns = self.window().gui_settings.value("remember_columns", "")
if columns == "":
self.window().downloads_list.header().resizeSection(12, 146)
else:
for kv in columns.split(","):
key, value = kv.split(":")
self.window().downloads_list.header().resizeSection(int(key), int(value))

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 ff812fc

Please sign in to comment.