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
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 _on_get_cache_status(status,port,config):
def doprefs(arg): def doprefs(arg):
if arg and True in arg[0]: 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)) component.get("ConsoleUI").set_mode(Preferences(self,config,self.config,port,status,self.stdscr,self.encoding))
else: else:
self.messages.append(("Error","An error occured trying to display preferences")) 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 __show_events(self):
def doevents(arg): def doevents(arg):
if arg and True in arg[0]: if arg and True in arg[0]:
self.stdscr.clear() self.stdscr.erase()
component.get("ConsoleUI").set_mode(EventView(self,self.stdscr,self.encoding)) component.get("ConsoleUI").set_mode(EventView(self,self.stdscr,self.encoding))
else: else:
self.messages.append(("Error","An error occured trying to display events")) 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) self.popup = MessagePopup(self,title,msg)
if not lines: if not lines:
self.stdscr.clear() self.stdscr.erase()
# Update the status bars # Update the status bars
if self._curr_filter == None: 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` Updates the lines based on the`:attr:lines` based on the `:attr:display_lines_offset`
attribute and the status bars. attribute and the status bars.
""" """
self.stdscr.clear() self.stdscr.erase()
self.draw_statusbars() self.draw_statusbars()
# Update the status bars # Update the status bars

View file

@ -172,7 +172,7 @@ class ConnectionManager(BaseMode):
self.messages.append((title,message)) self.messages.append((title,message))
def refresh(self): def refresh(self):
self.stdscr.clear() self.stdscr.erase()
self.draw_statusbars() self.draw_statusbars()
self.stdscr.noutrefresh() 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` Updates the lines based on the`:attr:lines` based on the `:attr:display_lines_offset`
attribute and the status bars. attribute and the status bars.
""" """
self.stdscr.clear() self.stdscr.erase()
# Update the status bars # Update the status bars
self.add_string(0, self.statusbars.topbar) self.add_string(0, self.statusbars.topbar)

View file

@ -102,7 +102,7 @@ class Popup:
def refresh(self): def refresh(self):
self.screen.clear() self.screen.erase()
self.screen.border(0,0,0,0) self.screen.border(0,0,0,0)
toff = max(1,int((self.parent.cols/4)-(len(self.title)/2))) 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) 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() title,msg = self.messages.popleft()
self.popup = MessagePopup(self,title,msg) self.popup = MessagePopup(self,title,msg)
self.stdscr.clear() self.stdscr.erase()
self.add_string(0,self.statusbars.topbar) self.add_string(0,self.statusbars.topbar)
hstr = "%sPress [h] for help"%(" "*(self.cols - len(self.statusbars.bottombar) - 10)) hstr = "%sPress [h] for help"%(" "*(self.cols - len(self.statusbars.bottombar) - 10))
self.add_string(self.rows - 1, "%s%s"%(self.statusbars.bottombar,hstr)) 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) self.popup = MessagePopup(self,title,msg)
# Update the status bars # Update the status bars
self.stdscr.clear() self.stdscr.erase()
self.add_string(0,self.statusbars.topbar) self.add_string(0,self.statusbars.topbar)
hstr = "%sPress [h] for help"%(" "*(self.cols - len(self.statusbars.bottombar) - 10)) hstr = "%sPress [h] for help"%(" "*(self.cols - len(self.statusbars.bottombar) - 10))
self.add_string(self.rows - 1, "%s%s"%(self.statusbars.bottombar,hstr)) self.add_string(self.rows - 1, "%s%s"%(self.statusbars.bottombar,hstr))