Remove trailing whitespaces.
This commit is contained in:
parent
310e2cc347
commit
27b3592e16
1 changed files with 899 additions and 899 deletions
|
|
@ -31,7 +31,7 @@ from sat.tools.jid import JID
|
|||
|
||||
class ChatText(urwid.FlowWidget):
|
||||
"""Manage the printing of chat message"""
|
||||
|
||||
|
||||
def __init__(self, parent, timestamp, nick, my_mess, message, align='left', is_info=False):
|
||||
self.parent = parent
|
||||
self.timestamp = time.localtime(timestamp)
|
||||
|
|
@ -124,8 +124,8 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
self._invalidate()
|
||||
|
||||
|
||||
return super(Chat, self).keypress(size, key)
|
||||
|
||||
return super(Chat, self).keypress(size, key)
|
||||
|
||||
def getMenu(self):
|
||||
"""Return Menu bar"""
|
||||
menu = sat_widgets.Menu(self.host.loop)
|
||||
|
|
@ -145,7 +145,7 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
present_widget = self.__buildPresentList()
|
||||
self.present_panel = sat_widgets.VerticalSeparator(present_widget)
|
||||
self.__appendPresentPanel()
|
||||
|
||||
|
||||
def __getDecoration(self, widget):
|
||||
return sat_widgets.LabelLine(widget, sat_widgets.SurroundedText(unicode(unescapePrivate(self.target))))
|
||||
|
||||
|
|
@ -175,16 +175,16 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
def __buildPresentList(self):
|
||||
self.present_wid = sat_widgets.GenericList([],option_type = sat_widgets.ClickableText, on_click=self._presentClicked)
|
||||
return self.present_wid
|
||||
|
||||
|
||||
def __appendPresentPanel(self):
|
||||
self.chat_colums.widget_list.append(self.present_panel)
|
||||
self.chat_colums.widget_list.append(self.present_panel)
|
||||
self.chat_colums.column_types.append(('weight', 2))
|
||||
|
||||
def __removePresentPanel(self):
|
||||
self.chat_colums.set_focus(0) #necessary as the focus change to the next object, we can go out of range if we are on the last object of self.chat_colums
|
||||
self.chat_colums.widget_list.remove(self.present_panel)
|
||||
del self.chat_colums.column_types[-1]
|
||||
|
||||
|
||||
def __appendGamePanel(self, widget):
|
||||
assert (len(self.pile.widget_list) == 1)
|
||||
self.pile.widget_list.insert(0,widget)
|
||||
|
|
@ -245,13 +245,13 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
return
|
||||
|
||||
new_text = ChatText(self, timestamp or None, nick, mymess, msg)
|
||||
|
||||
|
||||
if timestamp and self.content:
|
||||
for idx in range(len(self.content)-1,-1,-1):
|
||||
current_text = self.content[idx]
|
||||
if new_text.timestamp < current_text.timestamp and idx > 0:
|
||||
continue #the new message is older, we need to insert it upper
|
||||
|
||||
|
||||
#we discard double messages, to avoid backlog / history conflict
|
||||
if ((idx and self.content[idx-1].message == msg) or
|
||||
(self.content[idx].message == msg) or
|
||||
|
|
@ -262,7 +262,7 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
break
|
||||
else:
|
||||
self.content.append(new_text)
|
||||
|
||||
|
||||
if self.text_list.get_focus()[1] == len(self.content)-2:
|
||||
#we don't change focus if user is not at the bottom
|
||||
#as that mean that he is probably watching discussion history
|
||||
|
|
@ -271,9 +271,9 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
if not self.host.x_notify.hasFocus():
|
||||
if self.type=="one2one":
|
||||
self.host.x_notify.sendNotification(_("Primitivus: %s is talking to you") % from_jid)
|
||||
elif self.getUserNick().lower() in msg.lower():
|
||||
elif self.getUserNick().lower() in msg.lower():
|
||||
self.host.x_notify.sendNotification(_("Primitivus: Somebody pinged your name in %s room") % self.target)
|
||||
|
||||
|
||||
def printInfo(self, msg, type='normal', timestamp=""):
|
||||
"""Print general info
|
||||
@param msg: message to print
|
||||
|
|
@ -292,28 +292,28 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
if not self.host.x_notify.hasFocus():
|
||||
if self.type=="one2one":
|
||||
self.host.x_notify.sendNotification(_("Primitivus: there is a message about you"))
|
||||
elif self.getUserNick().lower() in msg.lower():
|
||||
elif self.getUserNick().lower() in msg.lower():
|
||||
self.host.x_notify.sendNotification(_("Primitivus: Somebody is talking about you in %s room") % self.target)
|
||||
|
||||
|
||||
def startGame(self, game_type, referee, players):
|
||||
"""Configure the chat window to start a game"""
|
||||
if game_type=="Tarot":
|
||||
self.tarot_wid = CardGame(self, referee, players, self.nick)
|
||||
self.__appendGamePanel(self.tarot_wid)
|
||||
|
||||
|
||||
def getGame(self, game_type):
|
||||
"""Return class managing the game type"""
|
||||
#TODO: check that the game is launched, and manage errors
|
||||
if game_type=="Tarot":
|
||||
return self.tarot_wid
|
||||
return self.tarot_wid
|
||||
|
||||
#MENU EVENTS#
|
||||
def onTarotRequest(self, menu):
|
||||
if len(self.occupants) != 4:
|
||||
self.host.showPopUp(sat_widgets.Alert(_("Can't start game"), _("You need to be exactly 4 peoples in the room to start a Tarot game"), ok_cb=self.host.removePopUp))
|
||||
self.host.showPopUp(sat_widgets.Alert(_("Can't start game"), _("You need to be exactly 4 peoples in the room to start a Tarot game"), ok_cb=self.host.removePopUp))
|
||||
else:
|
||||
self.host.bridge.tarotGameCreate(self.id, list(self.occupants), self.host.profile)
|
||||
|
||||
|
||||
def onSendFileRequest(self, menu):
|
||||
dialog = FileDialog(ok_cb=self.onFileSelected, cancel_cb=self.host.removePopUp)
|
||||
self.host.showPopUp(dialog, 80, 80)
|
||||
|
|
@ -328,4 +328,4 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
else:
|
||||
full_jid = self.target
|
||||
progress_id = self.host.bridge.sendFile(full_jid, filepath, {}, self.host.profile)
|
||||
self.host.addProgress(progress_id,filepath)
|
||||
self.host.addProgress(progress_id,filepath)
|
||||
|
|
|
|||
Loading…
Reference in a new issue