From 03fefc279b9110c3685c1f449f84353787be5ec3 Mon Sep 17 00:00:00 2001 From: Nogare Date: Wed, 14 Mar 2012 15:50:25 -0400 Subject: [PATCH] Change .clear() -> erase() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change .clear() to -> .erase() should eliminate flicker issues. I'm unsure whether I should've changed line 105 of popup.py.. we can revert if there is any issues. Note: we only want to erase() during refreshes, if we are changing modes we do want to clear() the screen(at least I think we do… it might make sense to just use erase() everywhere for consistency… I/we should look into this) --- deluge/ui/console/modes/alltorrents.py | 6 +++--- deluge/ui/console/modes/basemode.py | 2 +- deluge/ui/console/modes/connectionmanager.py | 2 +- deluge/ui/console/modes/legacy.py | 2 +- deluge/ui/console/modes/popup.py | 2 +- deluge/ui/console/modes/preferences.py | 2 +- deluge/ui/console/modes/torrentdetail.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/deluge/ui/console/modes/alltorrents.py b/deluge/ui/console/modes/alltorrents.py index 01852cc96..9ad03d1eb 100644 --- a/deluge/ui/console/modes/alltorrents.py +++ b/deluge/ui/console/modes/alltorrents.py @@ -473,7 +473,7 @@ class AllTorrents(BaseMode, component.Component): def _on_get_cache_status(status,port,config): def doprefs(arg): if arg and True in arg[0]: - self.stdscr.clear() + self.stdscr.erase() component.get("ConsoleUI").set_mode(Preferences(self,config,self.config,port,status,self.stdscr,self.encoding)) else: self.messages.append(("Error","An error occured trying to display preferences")) @@ -485,7 +485,7 @@ class AllTorrents(BaseMode, component.Component): def __show_events(self): def doevents(arg): if arg and True in arg[0]: - self.stdscr.clear() + self.stdscr.erase() component.get("ConsoleUI").set_mode(EventView(self,self.stdscr,self.encoding)) else: self.messages.append(("Error","An error occured trying to display events")) @@ -699,7 +699,7 @@ class AllTorrents(BaseMode, component.Component): self.popup = MessagePopup(self,title,msg) if not lines: - self.stdscr.clear() + self.stdscr.erase() # Update the status bars if self._curr_filter == None: diff --git a/deluge/ui/console/modes/basemode.py b/deluge/ui/console/modes/basemode.py index 186b9a03d..885f0b36d 100644 --- a/deluge/ui/console/modes/basemode.py +++ b/deluge/ui/console/modes/basemode.py @@ -205,7 +205,7 @@ class BaseMode(CursesStdIO): Updates the lines based on the`:attr:lines` based on the `:attr:display_lines_offset` attribute and the status bars. """ - self.stdscr.clear() + self.stdscr.erase() self.draw_statusbars() # Update the status bars diff --git a/deluge/ui/console/modes/connectionmanager.py b/deluge/ui/console/modes/connectionmanager.py index 4f9b4686a..15e8bf613 100644 --- a/deluge/ui/console/modes/connectionmanager.py +++ b/deluge/ui/console/modes/connectionmanager.py @@ -172,7 +172,7 @@ class ConnectionManager(BaseMode): self.messages.append((title,message)) def refresh(self): - self.stdscr.clear() + self.stdscr.erase() self.draw_statusbars() self.stdscr.noutrefresh() diff --git a/deluge/ui/console/modes/legacy.py b/deluge/ui/console/modes/legacy.py index a5b0f4854..5b46acbad 100644 --- a/deluge/ui/console/modes/legacy.py +++ b/deluge/ui/console/modes/legacy.py @@ -254,7 +254,7 @@ class Legacy(BaseMode): Updates the lines based on the`:attr:lines` based on the `:attr:display_lines_offset` attribute and the status bars. """ - self.stdscr.clear() + self.stdscr.erase() # Update the status bars self.add_string(0, self.statusbars.topbar) diff --git a/deluge/ui/console/modes/popup.py b/deluge/ui/console/modes/popup.py index cb94face0..1aee83ede 100644 --- a/deluge/ui/console/modes/popup.py +++ b/deluge/ui/console/modes/popup.py @@ -102,7 +102,7 @@ class Popup: def refresh(self): - self.screen.clear() + self.screen.erase() self.screen.border(0,0,0,0) toff = max(1,int((self.parent.cols/4)-(len(self.title)/2))) self.parent.add_string(0,"{!white,black,bold!}%s"%self.title,self.screen,toff,False,True) diff --git a/deluge/ui/console/modes/preferences.py b/deluge/ui/console/modes/preferences.py index 0c0cd5a52..2b2669b25 100644 --- a/deluge/ui/console/modes/preferences.py +++ b/deluge/ui/console/modes/preferences.py @@ -168,7 +168,7 @@ class Preferences(BaseMode): title,msg = self.messages.popleft() self.popup = MessagePopup(self,title,msg) - self.stdscr.clear() + self.stdscr.erase() 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)) diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py index 7e90d071b..d1197e8b7 100644 --- a/deluge/ui/console/modes/torrentdetail.py +++ b/deluge/ui/console/modes/torrentdetail.py @@ -396,7 +396,7 @@ class TorrentDetail(BaseMode, component.Component): self.popup = MessagePopup(self,title,msg) # Update the status bars - self.stdscr.clear() + self.stdscr.erase() 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))