Allowed float sizes of Popups between 0.0 and 1.0 which make them take specified amount of available screen space, made help popups larger

This commit is contained in:
Asmageddon 2012-05-31 13:11:05 +02:00
parent 11e3a66484
commit 718bf57b5d
3 changed files with 11 additions and 4 deletions

View File

@ -1195,7 +1195,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)
self.popup = Popup(self,"Help",init_lines=self.__help_lines, height_req = 0.75)
elif chr(c) == 'p':
self.show_preferences()
return

View File

@ -106,8 +106,15 @@ class Popup:
crow+=1
def handle_resize(self):
hr = self.height_req
wr = self.width_req
if isinstance(self.height_req, float) and 0.0 < self.height_req <= 1.0:
hr = int( (self.parent.rows - 2) * self.height_req )
else:
hr = self.height_req
if isinstance(self.width_req, float) and 0.0 < self.width_req <= 1.0:
wr = int( (self.parent.cols - 2) * self.width_req )
else:
wr = self.width_req
log.debug("Resizing(or creating) popup window")

View File

@ -740,6 +740,6 @@ 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)
self.popup = Popup(self,"Help",init_lines=self.__help_lines, height_req=0.75)
self.refresh()