fix problem when not showing name,state or queue columns. fix problem if there were no var length cols.

This commit is contained in:
Nick Lanham 2011-04-26 22:59:48 +02:00
parent e992ac3eab
commit 67a4fd49e9
1 changed files with 7 additions and 4 deletions

View File

@ -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.__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.__columns = [prefs_to_names[col] for col in self.__cols_to_show]
self.__status_fields = column.get_required_fields(self.__columns) 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() self.__update_columns()
def __split_help(self): def __split_help(self):
@ -293,6 +295,7 @@ class AllTorrents(BaseMode, component.Component):
else: else:
rem = self.cols - req rem = self.cols - req
var_cols = len(filter(lambda x: x < 0,self.column_widths)) var_cols = len(filter(lambda x: x < 0,self.column_widths))
if (var_cols > 0):
vw = int(rem/var_cols) vw = int(rem/var_cols)
for i in range(0, len(self.column_widths)): for i in range(0, len(self.column_widths)):
if (self.column_widths[i] < 0): if (self.column_widths[i] < 0):