Changeset 59
- Timestamp:
- 03/11/02 23:38:27 (6 years ago)
- Files:
-
- trunk/RBJabber/RBJabber/Client.py (modified) (1 diff)
- trunk/RBJabber/RBJabber/iqRosterQuery.py (modified) (2 diffs)
- trunk/RBPrivate/Prototypes/ChatClient/ChatFrame.skin (modified) (1 diff)
- trunk/RBPrivate/Prototypes/ChatClient/ChatMediator.py (added)
- trunk/RBPrivate/Prototypes/ChatClient/ClientModel.py (modified) (1 diff)
- trunk/RBPrivate/Prototypes/ChatClient/MainframeBuddyList.py (modified) (3 diffs)
- trunk/RBPrivate/Prototypes/ChatClient/MainframeMediator.py (modified) (2 diffs)
- trunk/RBPrivate/Prototypes/ChatClient/MessageFactory.py (added)
- trunk/RBPrivate/Prototypes/ChatClient/client.skin (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBJabber/RBJabber/Client.py
r55 r59 130 130 return query 131 131 132 def Message(self, toJID, body, subject='', type='message' ):132 def Message(self, toJID, body, subject='', type='message', xml=''): 133 133 idMessage = self._GetNextID() 134 134 strXML = '<message id=%s to=%s type=%s>' % (quoteattr(idMessage), quoteattr(toJID), quoteattr(type)) 135 strXML += xml 135 136 if subject: 136 137 strXML += '<subject>%s</subject>' % escape(subject) trunk/RBJabber/RBJabber/iqRosterQuery.py
r56 r59 6 6 from xml.sax.saxutils import escape, quoteattr 7 7 from iqQuery import iqQueryBase, Subject 8 from JID import JIDnormalize8 from JID import * 9 9 10 10 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 31 31 iq = UpdateDict['iq'] 32 32 for each in iq.query[0].item: 33 self.ByJID[JID normalize(each.jid)] = each33 self.ByJID[JIDjoin(JIDsplit(each.jid)[:2])] = each 34 34 self.UpdateObservers(Roster=self.ByJID) 35 35 36 def Get(self, JID, default=None): 37 return self.ByJID.get(JIDjoin(JIDsplit(JID)[:2]), default) 38 trunk/RBPrivate/Prototypes/ChatClient/ChatFrame.skin
r42 r59 2 2 <skin:skin xmlns:skin='http://namespaces.runeblade.com/skin' xmlns:py='http://namespaces.runeblade.com/xmlPython' xmlns='http://namespaces.runeblade.com/wxPythonSkin'> 3 3 <frame title='RuneBlade Chat' show='1' size='400,400' > 4 <py:script contextvar='Mediator' module='ChatMediator' call='ChatMediator' /> 4 5 <layout sizerOption='1' sizerFlag='wxEXPAND'> 5 <text sizerOption='1' sizerFlag='wxEXPAND' /> 6 <line size='5,5' sizerFlag='wxEXPAND'/> 7 <text size='10, 40' sizerFlag='wxEXPAND'/> 6 <text sizerOption='1' sizerFlag='wxEXPAND' style='wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_AUTO_URL' > 7 <py:obj_variable owner='Mediator' name='ChatOutput' /> 8 </text> 9 <line size='5,5' sizerFlag='wxEXPAND'/> 10 <layout sizerFlag='wxEXPAND'> 11 <input sizerOption='1' style='wxTE_PROCESS_ENTER'> 12 <py:obj_variable owner='Mediator' name='ChatInput' /> 13 </input> 14 <button default='1' label='Send'> 15 <py:obj_variable owner='Mediator' name='SendButton' /> 16 </button> 17 </layout> 8 18 </layout> 19 <py:inline>self.context.Mediator.Initialize()</py:inline> 9 20 </frame> 10 21 </skin:skin> trunk/RBPrivate/Prototypes/ChatClient/ClientModel.py
r56 r59 43 43 def OnAuthenticated(self, subject, UpdateDict): 44 44 iq = UpdateDict['iq'] 45 print 'Authentication:', iq.type46 45 iq._client.Presence() trunk/RBPrivate/Prototypes/ChatClient/MainframeBuddyList.py
r58 r59 32 32 if each.jid in PresenceMap: 33 33 lstTypes = [x.type for x in PresenceMap[each.jid].itervalues() if x.type != "unavailable"] 34 bAvailable = lstTypes and 1 or 0 34 35 winList.SetStringItem(idx, 1, lstTypes and lstTypes[0] or "unavailable") 35 else: winList.SetStringItem(idx, 1, "unavailable") 36 else: 37 winList.SetStringItem(idx, 1, "unavailable") 38 bAvailable = 0 36 39 winList.SetStringItem(idx, 2, each.jid) 40 41 item = winList.GetItem(idx) 42 if bAvailable: 43 item.SetBackgroundColour(wx.wxColour(224, 224, 224)) 44 item.SetTextColour(wx.wxColour(0, 64, 128)) 45 else: 46 item.SetBackgroundColour(wx.wxColour(224, 224, 224)) 47 item.SetTextColour(wx.wxColour(160, 128, 128)) 48 winList.SetItem(item) 49 37 50 idx += 1 38 51 return idx … … 62 75 self.dictBuddyLists = {} 63 76 64 65 77 def UpdateBuddyList(self, winList=None, idx=0): 66 78 winList = winList or self.winBuddyList … … 68 80 for AccountName, BuddyList in self.dictBuddyLists.iteritems(): 69 81 winList.InsertStringItem(idx, AccountName) 82 item = winList.GetItem(idx) 83 item.SetBackgroundColour(wx.wxColour(0, 64, 128)) 84 item.SetTextColour(wx.wxColour(212, 212, 255)) 85 winList.SetItem(item) 86 70 87 idx = BuddyList.UpdateBuddyList(winList, idx+1) 88 89 winList.SetColumnWidth(0, wx.wxLIST_AUTOSIZE) 90 winList.SetColumnWidth(1, wx.wxLIST_AUTOSIZE) 91 winList.SetColumnWidth(2, wx.wxLIST_AUTOSIZE) 71 92 return idx trunk/RBPrivate/Prototypes/ChatClient/MainframeMediator.py
r56 r59 3 3 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 4 5 import time 5 6 from wxPython import wx 6 7 from Foundation.Skinning import SkinFile … … 19 20 20 21 def OnIdle(self, evt): 21 result = self.context.Model.Process(0.1) 22 evt.RequestMore(result) 22 result = self.context.Model.Process(0) 23 if not result: 24 time.sleep(0.1) 25 26 evt.RequestMore(1) 23 27 evt.Skip() 24 28 trunk/RBPrivate/Prototypes/ChatClient/client.skin
r56 r59 10 10 <skin:reference>AccountManagement.skin</skin:reference> 11 11 12 <py:script module='MessageFactory' call='MessageFactory'/> 13 12 14 <!-- 13 <skin:reference>Login.skin</skin:reference>14 15 <skin:reference>ChatFrame.skin</skin:reference> 15 16 <skin:reference>GroupChatFrame.skin</skin:reference> 16 17 <skin:reference>DebugFrame.skin</skin:reference> 17 18 --> 18 19 19 </application> 20 20 </skin:skin>
