primitivus group chat & misc

primitivus: new widget: SurroundedText (text with a character repeated around it)
primitivus: new decorator LabelLine (like lineBox, but with a label on the top line)
wix & primitivus & quick_app: group chat method move to quick_chat

wix: when new message, window is not raised anymore, but RequestUserAttention is called instead
This commit is contained in:
Goffi 2010-07-08 14:12:18 +08:00
commit dbb3520a4f
2 changed files with 113 additions and 31 deletions

View file

@ -128,10 +128,7 @@ class Chat(wx.Frame, QuickChat):
"""Set the users presents in the contact list for a group chat
@param nicks: list of nicknames
"""
debug (_("Adding users %s to room") % nicks)
if self.type != "group":
error (_("[INTERNAL] trying to set presents nicks for a non group chat window"))
return
QuickChat.setPresents(self, nicks)
for nick in nicks:
self.present_panel.presents.replace(nick)
self.occupants.add(nick)
@ -143,27 +140,19 @@ class Chat(wx.Frame, QuickChat):
if self.type != "group":
error (_("[INTERNAL] trying to replace user for a non group chat window"))
return
self.present_panel.presents.replace(nick)
self.occupants.add(nick)
QuickChat.replaceUser(self, nick)
def removeUser(self, nick):
"""Remove a user from the group list"""
debug(_("Removing user %s") % nick)
if self.type != "group":
error (_("[INTERNAL] trying to remove user for a non group chat window"))
return
QuickChat.removeUser(self, nick)
self.present_panel.presents.remove(nick)
self.occupants.remove(nick)
def setSubject(self, subject):
"""Set title for a group chat"""
debug(_("Setting subject to %s") % subject)
if self.type != "group":
error (_("[INTERNAL] trying to set subject for a non group chat window"))
return
QuickChat.setSubject(self, subject)
self.subjectBox.SetValue(subject)
def __eraseMenus(self):
"""erase all menus"""
menuBar = self.GetMenuBar()
@ -228,7 +217,10 @@ class Chat(wx.Frame, QuickChat):
self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font))
self.chatWindow.AppendText("%s\n" % msg)
if not mymess:
self.Raise() #FIXME: too intrusive
#TODO: use notification system
self.RequestUserAttention() #FIXME: do this only if in background.
self.Show() #gof: FIXME: to check
#self.Raise() #FIXME: too intrusive
### events ###

View file

@ -442,7 +442,7 @@ class MainWindow(wx.Frame, QuickApp):
#TODO: a proper MUC room joining dialog with nickname etc
dlg = wx.TextEntryDialog(
self, _("Please enter MUC's JID"),
_('Entering a MUC room'), _('test@conference.necton2.int'))
_('Entering a MUC room'), 'test@conference.necton2.int')
#_('Entering a MUC room'), _('room@muc_service.server.tld'))
if dlg.ShowModal() == wx.ID_OK:
room_jid=JID(dlg.GetValue())