Fixed resize bugs in event view, torrent detail and preferences(also made it actually handle resizing)

This commit is contained in:
Asmageddon 2012-05-30 21:28:24 +02:00
parent 18091c5ad6
commit 9152d322ac
3 changed files with 31 additions and 4 deletions

View File

@ -95,6 +95,15 @@ class EventView(BaseMode):
self.stdscr.noutrefresh() self.stdscr.noutrefresh()
curses.doupdate() curses.doupdate()
def on_resize(self, *args):
BaseMode.on_resize_norefresh(self, *args)
#Always refresh Legacy(it will also refresh AllTorrents), otherwise it will bug deluge out
legacy = component.get("LegacyUI")
legacy.on_resize(*args)
self.stdscr.erase()
self.refresh()
def back_to_overview(self): def back_to_overview(self):
self.stdscr.erase() self.stdscr.erase()
component.get("ConsoleUI").set_mode(self.parent_mode) component.get("ConsoleUI").set_mode(self.parent_mode)

View File

@ -129,6 +129,12 @@ class Preferences(BaseMode):
BaseMode.__init__(self, stdscr, encoding, False) BaseMode.__init__(self, stdscr, encoding, False)
# create the panes # create the panes
self.__calc_sizes()
self.action_input = SelectInput(self,None,None,["Cancel","Apply","OK"],[0,1,2],0)
self.refresh()
def __calc_sizes(self):
self.prefs_width = self.cols-self.div_off-1 self.prefs_width = self.cols-self.div_off-1
self.prefs_height = self.rows-4 self.prefs_height = self.rows-4
self.panes = [ self.panes = [
@ -144,9 +150,6 @@ class Preferences(BaseMode):
CachePane(self.div_off+2, self, self.prefs_width) CachePane(self.div_off+2, self, self.prefs_width)
] ]
self.action_input = SelectInput(self,None,None,["Cancel","Apply","OK"],[0,1,2],0)
self.refresh()
def __draw_catetories(self): def __draw_catetories(self):
for i,category in enumerate(self.categories): for i,category in enumerate(self.categories):
if i == self.cur_cat and self.active_zone == ZONE.CATEGORIES: if i == self.cur_cat and self.active_zone == ZONE.CATEGORIES:
@ -165,6 +168,16 @@ class Preferences(BaseMode):
self.stdscr.hline(self.rows-3,self.div_off+1,"_",self.cols) self.stdscr.hline(self.rows-3,self.div_off+1,"_",self.cols)
self.action_input.render(self.stdscr,self.rows-2,self.cols,selected,self.cols-22) self.action_input.render(self.stdscr,self.rows-2,self.cols,selected,self.cols-22)
def on_resize(self, *args):
BaseMode.on_resize_norefresh(self, *args)
self.__calc_sizes()
#Always refresh Legacy(it will also refresh AllTorrents), otherwise it will bug deluge out
legacy = component.get("LegacyUI")
legacy.on_resize(*args)
self.stdscr.erase()
self.refresh()
def refresh(self): def refresh(self):
if self.popup == None and self.messages: if self.popup == None and self.messages:
title,msg = self.messages.popleft() title,msg = self.messages.popleft()

View File

@ -371,6 +371,11 @@ class TorrentDetail(BaseMode, component.Component):
def on_resize(self, *args): def on_resize(self, *args):
BaseMode.on_resize_norefresh(self, *args) BaseMode.on_resize_norefresh(self, *args)
#Always refresh Legacy(it will also refresh AllTorrents), otherwise it will bug deluge out
legacy = component.get("LegacyUI")
legacy.on_resize(*args)
self.__update_columns() self.__update_columns()
self.__split_help() self.__split_help()
if self.popup: if self.popup: