Remove trailing whitespaces.

This commit is contained in:
Emmanuel Gil Peyrot 2013-01-18 17:55:34 +01:00
commit 27b3592e16
6 changed files with 899 additions and 899 deletions

View file

@ -62,7 +62,7 @@ class BoxSizer:
else:
current_row.append([win, h+y-oriY, w+x-oriX, oriY, oriX])
oriX=oriX+w
if oriX!=0:
oriY=oriY+h
visible_row.append(current_row)

View file

@ -40,7 +40,7 @@ def C(k):
class Chat(Window, QuickChat):
def __init__(self, to_id, host):
QuickChat.__init__(self, to_id, host)
QuickChat.__init__(self, to_id, host)
self.__parent=host.stdscr
self.to_id=JID(to_id)
self.content=[]
@ -88,7 +88,7 @@ class Chat(Window, QuickChat):
att_header=curses.color_pair(1)
else:
att_header=curses.color_pair(2)
while (msg):
if part==0:
hd=header
@ -105,7 +105,7 @@ class Chat(Window, QuickChat):
next = max + 1 #we skip the LF
else:
next = max
content.insert(part,[att,hd, msg[:max]])
msg=msg[next:] #we erase treated part
part=part+1
@ -116,7 +116,7 @@ class Chat(Window, QuickChat):
if self.__scollIdx>0 and len(content)<self.rHeight+self.__scollIdx:
self.__scollIdx=abs(len(content)-self.rHeight) #all the log fit on the screen, we must stop here
idx=0
for line in content[-self.rHeight-self.__scollIdx : -self.__scollIdx or None]:
self.addYXStr(idx, 0, line[1], line[0])
@ -124,12 +124,12 @@ class Chat(Window, QuickChat):
idx=idx+1
self.noutrefresh()
def scrollIdxUp(self):
"""increment scroll index"""
self.__scollIdx = self.__scollIdx + 1
self.update()
def scrollIdxDown(self):
"""decrement scroll index"""
if self.__scollIdx > 0:
@ -144,7 +144,7 @@ class Chat(Window, QuickChat):
return
self.content.append([timestamp,jid.short,msg])
self.update()
def handleKey(self, k):
if k == C('p'):
self.scrollIdxUp()

View file

@ -43,7 +43,7 @@ class EditBox(Window):
self.__replace_mode=False
self.__parent=parent
self.__code=code
Window.__init__(self, self.__parent, 1, self.__parent.getmaxyx()[1], self.__parent.getmaxyx()[0]-1,0, code=code)
self.update()
@ -60,7 +60,7 @@ class EditBox(Window):
"""return the text printed on the edit line"""
width = self.rWidth - len(self.__header) -1
if self.__curs_pos<width:
begin = 0
begin = 0
end = width
else:
begin = self.__curs_pos-width
@ -71,7 +71,7 @@ class EditBox(Window):
Window.update(self)
text = self.__getTextToPrint()
self.addYXStr(0, 0, text, limit=self.rWidth)
self.noutrefresh()
def __dec_cur(self):
@ -83,7 +83,7 @@ class EditBox(Window):
"""move cursor on the right"""
if self.__curs_pos<len(self.__text):
self.__curs_pos = self.__curs_pos + 1
def move_cur(self, x):
pos = x+len(self.__header)
if pos>=self.rWidth:
@ -94,7 +94,7 @@ class EditBox(Window):
"""Clear the text of the edit box"""
self.__text=""
self.__curs_pos=0
def replace_cur(self):
"""must be called earch time the cursor is moved"""
self.move_cur(self.__curs_pos)
@ -136,7 +136,7 @@ class EditBox(Window):
elif k==curses.KEY_HOME or k==C('a'):
self.__curs_pos=0
elif k==curses.KEY_END or k==C('e'):
self.__curs_pos=len(self.__text)

View file

@ -39,7 +39,7 @@ import gobject
import time
from curses import ascii
import locale
from signal import signal, SIGWINCH
from signal import signal, SIGWINCH
import fcntl
import struct
import termios
@ -68,7 +68,7 @@ def C(k):
class ChatList(QuickChatList):
"""This class manage the list of chat windows"""
def __init__(self, host):
QuickChatList.__init__(self, host)
self.sizer=host.sizer
@ -77,10 +77,10 @@ class ChatList(QuickChatList):
chat = Chat(name, self.host)
self.sizer.appendColum(0,chat)
self.sizer.update()
return chat
return chat
class ContactList(Window, QuickContactList):
def __init__(self, host, CM):
QuickContactList.__init__(self, CM)
self.host = host
@ -97,7 +97,7 @@ class ContactList(Window, QuickContactList):
Must be called when stdscr is resized."""
self.resize(stdscr.getmaxyx()[0]-2,const_CONTACT_WIDTH,0,0)
self.update()
def registerEnterCB(self, CB):
self.__enterCB=CB
@ -118,7 +118,7 @@ class ContactList(Window, QuickContactList):
if self.__index < len(self.jid_list)-1: #we dont want to select a missing contact
self.__index = self.__index + 1
self.update()
def indexDown(self):
"""decrement select contact index"""
if self.__index > 0:
@ -142,7 +142,7 @@ class ContactList(Window, QuickContactList):
return
Window.update(self)
self.jid_list.sort()
begin=0 if self.__index<self.rHeight else self.__index-self.rHeight+1
begin=0 if self.__index<self.rHeight else self.__index-self.rHeight+1
idx=0
for item in self.jid_list[begin:self.rHeight+begin]:
attr = curses.A_REVERSE if ( self.isActive() and (idx+begin) == self.__index ) else 0
@ -164,9 +164,9 @@ class ContactList(Window, QuickContactList):
self.__enterCB(self.jid_list[self.__index])
except NameError:
pass # TODO: thrown an error here
class SortilegeApp(QuickApp):
def __init__(self):
#debug(const_APP_NAME+" init...")
@ -245,7 +245,7 @@ class SortilegeApp(QuickApp):
debug (_("Deactivating colors"))
curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_BLACK)
def showChat(self, chat):
debug (_("show chat"))
@ -256,7 +256,7 @@ class SortilegeApp(QuickApp):
debug (_("showing %s"), self.currentChat)
self.chat_wins[self.currentChat].show()
self.chat_wins[self.currentChat].update()
### EVENTS ###
@ -302,7 +302,7 @@ class SortilegeApp(QuickApp):
if (self.currentChat==None):
self.currentChat=win.short
self.showChat(win.short)
# we show the window in the status bar
if not self.currentChat == win.short:
self.statusBar.add_item(win.short)
@ -319,7 +319,7 @@ class SortilegeApp(QuickApp):
height, width = ttysize()
curses.resizeterm(height, width)
gobject.idle_add(self.callOnceLoop)
def callOnceLoop(self):
"""Call the loop and return false (for not being called again by gobject mainloop).
Usefull for calling loop when there is no input in stdin"""
@ -351,7 +351,7 @@ class SortilegeApp(QuickApp):
self.editBar.activate(True)
self.sizer.update()
## Chat Params ##
## Chat Params ##
elif k == C('c'):
self.chatParams["color"] = not self.chatParams["color"]
self.color(self.chatParams["color"])
@ -376,7 +376,7 @@ class SortilegeApp(QuickApp):
self.sizer.update() # FIXME: everything need to be managed by the sizer
## we now throw the key to win handlers ##
else:
else:
for win in self.listWins:
if win.isActive():
win.handleKey(k)
@ -391,7 +391,7 @@ class SortilegeApp(QuickApp):
self.__key_handling(pressed)
self.editBar.replace_cur()
curses.doupdate()
return True

View file

@ -31,7 +31,7 @@ class StatusBar(Window):
self.__parent=parent
self.__code=code
self.__items=set()
Window.__init__(self, self.__parent, 1, self.__parent.getmaxyx()[1], self.__parent.getmaxyx()[0]-2,0, code=code)
def __len__(self):
@ -60,11 +60,11 @@ class StatusBar(Window):
def clear_text(self):
"""Clear the text of the edit box"""
del(self.__items[:])
def add_item(self, item):
self.__items.add(item)
self.update()
def remove_item(self, item):
if item in self.__items:
self.__items.remove(item)

View file

@ -33,7 +33,7 @@ class Window():
self.__parent=parent
self.__code=code
self.__hide=False
self.resize(height, width, y, x)
self.oriCoords=self.__coords #FIXME: tres moche, a faire en mieux
@ -88,7 +88,7 @@ class Window():
# we check that coordinates are under limits
self.__coordAdjust(self.__coords)
height,width,y,x=self.__coords
self.window = self.__parent.subwin(height, width, y, x)
self.defInsideCoord()
@ -124,15 +124,15 @@ class Window():
n = self.rWidth-x if not limit else limit
encoded = text.encode(self.__code)
adjust = len(encoded) - len(text) # hack because addnstr doesn't manage unicode
try:
self.window.addnstr(y, x, encoded, n + adjust, attr)
try:
self.window.addnstr(y, x, encoded, n + adjust, attr)
except:
#We have to catch error to write on last line last col FIXME: is there a better way ?
pass
def move(self, y, x):
self.window.move(y,x)
def noutrefresh(self):
self.window.noutrefresh()