From 6c6292135fee2a7b76520747177bedc154a4641f Mon Sep 17 00:00:00 2001 From: Asmageddon Date: Fri, 20 Jul 2012 22:18:05 +0200 Subject: [PATCH] Fixed some problems with help popups --- deluge/ui/console/modes/addtorrents.py | 8 +------- deluge/ui/console/modes/alltorrents.py | 6 +----- deluge/ui/console/modes/popup.py | 2 +- deluge/ui/console/modes/torrentdetail.py | 7 +------ 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/deluge/ui/console/modes/addtorrents.py b/deluge/ui/console/modes/addtorrents.py index 39df9d1f7..ecd394e62 100644 --- a/deluge/ui/console/modes/addtorrents.py +++ b/deluge/ui/console/modes/addtorrents.py @@ -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 diff --git a/deluge/ui/console/modes/alltorrents.py b/deluge/ui/console/modes/alltorrents.py index 66bafebe0..61b9a9816 100644 --- a/deluge/ui/console/modes/alltorrents.py +++ b/deluge/ui/console/modes/alltorrents.py @@ -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 diff --git a/deluge/ui/console/modes/popup.py b/deluge/ui/console/modes/popup.py index 644048f22..a22d45cbe 100644 --- a/deluge/ui/console/modes/popup.py +++ b/deluge/ui/console/modes/popup.py @@ -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 diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py index 5c74cdb50..0b269c62c 100644 --- a/deluge/ui/console/modes/torrentdetail.py +++ b/deluge/ui/console/modes/torrentdetail.py @@ -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':