mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-27 11:45:44 +00:00
Hopefully, final fix for #1786:
We now make sure that a state file exists when trying to restore an order from it. The best effort to restore the previous order is made, though, in some cases, since we're matching against names which are translatable, a match might not be found, in that case, continue the effort though skip the non matching column name. On next load, everything should be fine since the state file will include the, now in use, translation.
This commit is contained in:
parent
4b9209674e
commit
49d5ed6bde
@ -609,6 +609,9 @@ class ListView:
|
||||
return not model[iter][TORRENT_NAME_COL].lower().startswith(key.lower())
|
||||
|
||||
def restore_columns_order_from_state(self):
|
||||
if self.state is None:
|
||||
# No state file exists, so, no reordering can be done
|
||||
return
|
||||
columns = self.treeview.get_columns()
|
||||
def find_column(header):
|
||||
for column in columns:
|
||||
@ -629,6 +632,14 @@ class ListView:
|
||||
# It's in the right position
|
||||
continue
|
||||
column = find_column(col_state.name)
|
||||
if not column:
|
||||
log.debug("Could not find column matching \"%s\" on state." %
|
||||
col_state.name)
|
||||
# The cases where I've found that the column could not be found
|
||||
# is when not using the english locale, ie, the default one, or
|
||||
# when changing locales between runs.
|
||||
# On the next load, all should be fine
|
||||
continue
|
||||
self.treeview.move_column_after(column, column_at_position)
|
||||
# Get columns again to keep reordering since positions have changed
|
||||
columns = self.treeview.get_columns()
|
||||
|
Loading…
x
Reference in New Issue
Block a user