Change .clear() -> erase()

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)
This commit is contained in:
Nogare 2012-03-14 15:50:25 -04:00 committed by Asmageddon
parent e85be7cccb
commit 03fefc279b
7 changed files with 9 additions and 9 deletions

View File

@ -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:

View File

@ -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

View File

@ -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()

View File

@ -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)

View File

@ -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)

View File

@ -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))

View File

@ -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))