Fixed help string in torrent detail and event views

This commit is contained in:
Asmageddon 2012-05-28 20:29:58 +02:00
parent a47b2bc715
commit 2e647c6b41
3 changed files with 28 additions and 6 deletions

View File

@ -736,8 +736,7 @@ class AllTorrents(BaseMode, component.Component):
self.add_string(self.rows - 1, string) self.add_string(self.rows - 1, string)
else: else:
#This will quite likely fail when switching modes because #This will quite likely fail when switching modes
# of an arcane problem with twisted
try: try:
rf = format_utils.remove_formatting rf = format_utils.remove_formatting
string = self.statusbars.bottombar string = self.statusbars.bottombar

View File

@ -36,6 +36,7 @@
import deluge.component as component import deluge.component as component
from basemode import BaseMode from basemode import BaseMode
try: try:
import curses import curses
except ImportError: except ImportError:
@ -44,6 +45,8 @@ except ImportError:
import logging import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
import format_utils
class EventView(BaseMode): class EventView(BaseMode):
def __init__(self, parent_mode, stdscr, encoding=None): def __init__(self, parent_mode, stdscr, encoding=None):
self.parent_mode = parent_mode self.parent_mode = parent_mode
@ -55,7 +58,17 @@ class EventView(BaseMode):
self.add_string(0,self.statusbars.topbar) self.add_string(0,self.statusbars.topbar)
hstr = "%sPress [h] for help"%(" "*(self.cols - len(self.statusbars.bottombar) - 10)) hstr = "%sPress [h] for help"%(" "*(self.cols - len(self.statusbars.bottombar) - 10))
self.add_string(self.rows - 1, "%s%s"%(self.statusbars.bottombar,hstr)) #This will quite likely fail when switching modes
try:
rf = format_utils.remove_formatting
string = self.statusbars.bottombar
hstr = "Press {!magenta,blue,bold!}[h]{!status!} for help"
string += " " * ( self.cols - len(rf(string)) - len(rf(hstr))) + hstr
self.add_string(self.rows - 1, string)
except:
pass
if events: if events:
for i,event in enumerate(events): for i,event in enumerate(events):
@ -82,7 +95,7 @@ class EventView(BaseMode):
reactor.stop() reactor.stop()
client.disconnect().addCallback(on_disconnect) client.disconnect().addCallback(on_disconnect)
else: else:
reactor.stop() reactor.stop()
return return
elif chr(c) == 'q': elif chr(c) == 'q':
self.back_to_overview() self.back_to_overview()

View File

@ -398,8 +398,18 @@ class TorrentDetail(BaseMode, component.Component):
# Update the status bars # Update the status bars
self.stdscr.erase() self.stdscr.erase()
self.add_string(0,self.statusbars.topbar) self.add_string(0,self.statusbars.topbar)
hstr = "%sPress [h] for help"%(" "*(self.cols - len(self.statusbars.bottombar) - 10))
self.add_string(self.rows - 1, "%s%s"%(self.statusbars.bottombar,hstr)) #This will quite likely fail when switching modes
try:
rf = format_utils.remove_formatting
string = self.statusbars.bottombar
hstr = "Press {!magenta,blue,bold!}[h]{!status!} for help"
string += " " * ( self.cols - len(rf(string)) - len(rf(hstr))) + hstr
self.add_string(self.rows - 1, string)
except:
pass
if self.files_sep: if self.files_sep:
self.add_string((self.rows/2)-1,self.files_sep) self.add_string((self.rows/2)-1,self.files_sep)