summaryrefslogtreecommitdiffstats
path: root/deluge/ui/console/modes/alltorrents.py
diff options
context:
space:
mode:
authorNick Lanham <nick@afternight.org>2011-04-26 22:59:48 +0200
committerNick Lanham <nick@afternight.org>2011-04-26 22:59:48 +0200
commit67a4fd49e94cccc516069d4378beef0dd6ec9e43 (patch)
tree7f7b4e0cb8a863049cdc5b1bf379e6604f012e8d /deluge/ui/console/modes/alltorrents.py
parente992ac3eab02ec59c68f59fc401600c98c408507 (diff)
downloaddeluge-67a4fd4.tar.gz
deluge-67a4fd4.tar.bz2
deluge-67a4fd4.zip
fix problem when not showing name,state or queue columns. fix problem if there were no var length cols.
Diffstat (limited to 'deluge/ui/console/modes/alltorrents.py')
-rw-r--r--deluge/ui/console/modes/alltorrents.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/deluge/ui/console/modes/alltorrents.py b/deluge/ui/console/modes/alltorrents.py
index 53a045415..1fad76a86 100644
--- a/deluge/ui/console/modes/alltorrents.py
+++ b/deluge/ui/console/modes/alltorrents.py
@@ -274,6 +274,8 @@ class AllTorrents(BaseMode, component.Component):
self.__cols_to_show = [pref for pref in column_pref_names if self.config["show_%s"%pref]]
self.__columns = [prefs_to_names[col] for col in self.__cols_to_show]
self.__status_fields = column.get_required_fields(self.__columns)
+ for rf in ["state","name","queue"]: # we always need these, even if we're not displaying them
+ if not rf in self.__status_fields: self.__status_fields.append(rf)
self.__update_columns()
def __split_help(self):
@@ -293,10 +295,11 @@ class AllTorrents(BaseMode, component.Component):
else:
rem = self.cols - req
var_cols = len(filter(lambda x: x < 0,self.column_widths))
- vw = int(rem/var_cols)
- for i in range(0, len(self.column_widths)):
- if (self.column_widths[i] < 0):
- self.column_widths[i] = vw
+ if (var_cols > 0):
+ vw = int(rem/var_cols)
+ for i in range(0, len(self.column_widths)):
+ if (self.column_widths[i] < 0):
+ self.column_widths[i] = vw
self.column_string = "{!header!}%s"%("".join(["%s%s"%(self.__columns[i]," "*(self.column_widths[i]-len(self.__columns[i]))) for i in range(0,len(self.__columns))]))