Fixed some problems with help popups

This commit is contained in:
Asmageddon 2012-07-20 22:18:05 +02:00
parent 75c4135d6e
commit 6c6292135f
4 changed files with 4 additions and 19 deletions

View File

@ -124,8 +124,6 @@ class AddTorrents(BaseMode, component.Component):
component.Component.__init__(self, "AddTorrents", 1, depend=["SessionProxy"])
self.__split_help()
component.start(["AddTorrents"])
curses.curs_set(0)
@ -246,10 +244,6 @@ class AddTorrents(BaseMode, component.Component):
widths = [self.cols - 23, 23]
self.formatted_rows.append(format_utils.format_row(cols, widths))
def __split_help(self):
self.__help_lines = format_utils.wrap_string(HELP_STR,(self.cols/2)-2)
def scroll_list_up(self, distance):
self.cursel -= distance
if self.cursel < 0:
@ -560,7 +554,7 @@ class AddTorrents(BaseMode, component.Component):
else:
if c > 31 and c < 256:
if chr(c) == 'h':
self.popup = Popup(self,"Help",init_lines=self.__help_lines, height_req=0.75, width_req=65)
self.popup = MessagePopup(self, "Help", HELP_STR, width_req=0.75)
elif chr(c) == '>':
if self.sort_column == "date":
self.reverse_sort = not self.reverse_sort

View File

@ -292,7 +292,6 @@ class AllTorrents(BaseMode, component.Component):
curses.curs_set(0)
self.stdscr.notimeout(0)
self.__split_help()
self.update_config()
component.start(["AllTorrents"])
@ -365,9 +364,6 @@ class AllTorrents(BaseMode, component.Component):
self.__update_columns()
def __split_help(self):
self.__help_lines = format_utils.wrap_string(HELP_STR,(self.cols/2)-2)
def resume(self):
component.start(["AllTorrents"])
self.refresh()
@ -1266,7 +1262,7 @@ class AllTorrents(BaseMode, component.Component):
elif chr(c) == 'f':
self._show_torrent_filter_popup()
elif chr(c) == 'h':
self.popup = Popup(self,"Help",init_lines=self.__help_lines, height_req = 0.75, width_req=65)
self.popup = MessagePopup(self, "Help", HELP_STR, width_req=0.75)
elif chr(c) == 'p':
self.show_preferences()
return

View File

@ -356,7 +356,7 @@ class MessagePopup(Popup):
#self.width= int(parent_mode.cols/2)
Popup.__init__(self,parent_mode, title, align=align, width_req=width_req)
lns = format_utils.wrap_string(self.message,self.width-2,3,True)
self.height_req = min(len(lns)+2,int(parent_mode.rows/2))
self.height_req = min(len(lns)+2,int(parent_mode.rows*2/3))
self.handle_resize()
self._lines = lns

View File

@ -126,8 +126,6 @@ class TorrentDetail(BaseMode, component.Component):
BaseMode.__init__(self, stdscr, encoding)
component.Component.__init__(self, "TorrentDetail", 1, depend=["SessionProxy"])
self.__split_help()
self.column_names = ["Filename", "Size", "Progress", "Priority"]
self.__update_columns()
@ -177,9 +175,6 @@ class TorrentDetail(BaseMode, component.Component):
self.torrent_state = state
self.refresh()
def __split_help(self):
self.__help_lines = format_utils.wrap_string(HELP_STR,(self.cols/2)-2)
# split file list into directory tree. this function assumes all files in a
# particular directory are returned together. it won't work otherwise.
# returned list is a list of lists of the form:
@ -913,7 +908,7 @@ class TorrentDetail(BaseMode, component.Component):
torrent_actions_popup(self,[self.torrentid],action=ACTION.TORRENT_OPTIONS)
return
elif chr(c) == 'h':
self.popup = Popup(self,"Help",init_lines=self.__help_lines, height_req=0.75, width_req=65)
self.popup = MessagePopup(self, "Help", HELP_STR, width_req=0.75)
elif chr(c) == 'j':
self.file_list_up()
if chr(c) == 'k':