Module: deluge Branch: master Commit: 49d5ed6bdef748992da6071f3a8ca8e730ef99e6
Author: Pedro Algarvio <[email protected]> Date: Thu Apr 21 20:55:01 2011 +0100 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. --- deluge/ui/gtkui/listview.py | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py index b96ca1a..35c7b76 100644 --- a/deluge/ui/gtkui/listview.py +++ b/deluge/ui/gtkui/listview.py @@ -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() -- You received this message because you are subscribed to the Google Groups "deluge-commit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/deluge-commit?hl=en.
