Completely remove placement of three dots symbol between columns, including option concerning it.

This commit is contained in:
Asmageddon 2012-03-07 16:27:39 +01:00
parent 6edd159626
commit 415bc22dd9
4 changed files with 10 additions and 22 deletions

View File

@ -170,7 +170,6 @@ DEFAULT_PREFS = {
"downloaded_width":13,
"uploaded_width":13,
"owner_width":10,
"disable_three_dots": False,
"ignore_duplicate_lines": False
}
@ -347,7 +346,7 @@ class AllTorrents(BaseMode, component.Component):
for torrent_id in self._sorted_ids:
ts = self.curstate[torrent_id]
newnames.append(ts["name"])
newrows.append((format_utils.format_row([column.get_column_value(name,ts) for name in self.__columns],self.column_widths, self.config),ts["state"]))
newrows.append((format_utils.format_row([column.get_column_value(name,ts) for name in self.__columns],self.column_widths),ts["state"]))
self.numtorrents = len(state)
self.formatted_rows = newrows

View File

@ -80,14 +80,11 @@ def format_priority(prio):
else:
return pstring
def trim_string(string, w, have_dbls, console_config):
def trim_string(string, w, have_dbls):
if w <= 0:
return ""
elif w == 1:
if console_config["disable_three_dots"]:
return u" "
else:
return u""
return u" "
elif have_dbls:
# have to do this the slow way
chrs = []
@ -103,17 +100,11 @@ def trim_string(string, w, have_dbls, console_config):
if width != w:
chrs.pop()
chrs.append('.')
if console_config["disable_three_dots"]:
return u"%s "%("".join(chrs))
else:
return u"%s"%("".join(chrs))
return u"%s "%("".join(chrs))
else:
if console_config["disable_three_dots"]:
return u"%s "%(string[0:w-1])
else:
return u"%s"%(string[0:w-2])
return u"%s "%(string[0:w-1])
def format_column(col, lim, console_config):
def format_column(col, lim):
dbls = 0
if haveud and isinstance(col,unicode):
# might have some double width chars
@ -124,13 +115,12 @@ def format_column(col, lim, console_config):
dbls += 1
size = len(col)+dbls
if (size >= lim - 1):
return trim_string(col,lim,dbls>0, console_config)
return trim_string(col,lim,dbls>0)
else:
return "%s%s"%(col," "*(lim-size))
def format_row(row,column_widths, console_config):
return "".join([format_column(row[i],column_widths[i], console_config) for i in range(0,len(row))])
def format_row(row, column_widths):
return "".join([format_column(row[i],column_widths[i]) for i in range(0,len(row))])
import re
_strip_re = re.compile("\{!.*?!\}")

View File

@ -311,7 +311,6 @@ class InterfacePane(BasePane):
def __init__(self, offset, parent, width):
BasePane.__init__(self,offset,parent,width)
self.add_header("General")
self.add_checked_input("disable_three_dots","Do not append three dots symbol when trimming columns",parent.console_config["disable_three_dots"])
self.add_checked_input("ignore_duplicate_lines","Do not store duplicate input in history",parent.console_config["ignore_duplicate_lines"])
self.add_header("Columns To Display")
for cpn in deluge.ui.console.modes.alltorrents.column_pref_names:

View File

@ -333,7 +333,7 @@ class TorrentDetail(BaseMode, component.Component):
r = format_utils.format_row(["%s%s %s"%(" "*depth,xchar,fl[0]),
deluge.common.fsize(fl[2]),fl[5],
format_utils.format_priority(fl[6])],
self.column_widths, self.console_config)
self.column_widths)
self.add_string(off,"%s%s"%(color_string,r),trim=False)
off += 1