diff browser_side/panels.py @ 62:12e889a683ce SàT v0.2.0

server side: misc stuff: - fixed lot of misuse in callbacks - chat history fixed - a visual indicator now appear when we have message waiting from a contact - fixed About dialog size issue in webkit - fixed Drag'n'Drop for webkit - defaut room to join is now libervia@conference.libervia.org
author Goffi <goffi@goffi.org>
date Tue, 31 May 2011 17:06:59 +0200
parents 4fa3d57f72f8
children 9d8e79ac4c9c
line wrap: on
line diff
--- a/browser_side/panels.py	Tue May 31 17:03:37 2011 +0200
+++ b/browser_side/panels.py	Tue May 31 17:06:59 2011 +0200
@@ -144,7 +144,6 @@
         def updateContactCb(sender):
             _jid = _contacts_list.getValue(_contacts_list.getSelectedIndex())
             self.host.bridge.call('updateContact', None, _jid, '', _dialog.getSelectedGroups())
-            print "contactUpdated"
 
         def onContactChange(_list):
             _jid = _contacts_list.getValue(_contacts_list.getSelectedIndex())
@@ -202,7 +201,7 @@
         _main_panel = VerticalPanel()
         _label = Label("Discussion room:")
         _edit = TextBox()
-        _edit.setText('libervia@conference.tazar.int')
+        _edit.setText('libervia@conference.libervia.org')
         hpanel = HorizontalPanel()
         hpanel.add(_label)
         hpanel.add(_edit)
@@ -236,12 +235,10 @@
         DropWidget.__init__(self)
     
     def onDragEnter(self, event):
-        print "drag enter"
         self.addStyleName('dragover')
         DOM.eventPreventDefault(event)
 
     def onDragLeave(self, event):
-        print "\ndrag leave"
         if event.clientX <= self.getAbsoluteLeft() or event.clientY <= self.getAbsoluteTop() or\
            event.clientX >= self.getAbsoluteLeft() + self.getOffsetWidth()-1 or event.clientY >= self.getAbsoluteTop() + self.getOffsetHeight()-1:
            #We check that we are inside widget's box, and we don't remove the style in this case because
@@ -260,12 +257,13 @@
 
 
     def onDrop(self, event):
-        print "Empty Panel: onDrop"
         dt = event.dataTransfer
         #'text', 'text/plain', and 'Text' are equivalent.
         try:
-            item = dt.getData("text/plain")
-            item_type = dt.getData("type")
+            item, item_type = dt.getData("text/plain").split('\n') #Workaround for webkit, only text/plain seems to be managed
+            if item_type and item_type[-1] == '\0': #Workaround for what looks like a pyjamas bug: the \0 should not be there, and 
+                item_type = item_type[:-1]          # .strip('\0') and .replace('\0','') don't work. TODO: check this and fill a bug report
+            #item_type = dt.getData("type")
             print "message: %s" % item
             print "type: %s" % item_type
         except:
@@ -279,6 +277,7 @@
             self.host.FillMicroblogPanel(_new_panel)
         elif item_type=="CONTACT":
             _contact = JID(item)
+            self.host.contact_panel.setContactMessageWaiting(_contact.bare, False)
             _new_panel = ChatPanel(self.host, _contact)
             _new_panel.historyPrint()
         elif item_type=="CONTACT_TITLE":
@@ -431,7 +430,7 @@
             type = "ONE2ONE"
             target = str(self.host.selected.target)
         else:
-            print self.host.selected
+            print "Unknown selected host:",self.host.selected
             type = "UNKNOWN"
         return (type, target)
 
@@ -550,7 +549,7 @@
         self.status = new_status or '&nbsp;'
         self.setHTML(self.__getContent())
 
-    def onClick(self, sender, event):
+    def onClick(self, sender):
         #As status is the default target of uniBar, we don't want to select anything if click on it
         self.host.select(None)
 
@@ -655,7 +654,7 @@
         #the event will not propagate to children
         ScrollPanelWrapper.doAttachChildren(self)
 
-    def onClick(self, sender, event):
+    def onClick(self, sender):
         self.host.select(self)
     
     def setUserNick(self, nick):
@@ -670,12 +669,10 @@
             self.occupants_list.addOccupant(nick)
 
     def userJoined(self, nick, data):
-        print "userJoined:", nick, data
         self.occupants_list.addOccupant(nick)
         self.printInfo("=> %s has joined the room" % nick)
 
     def userLeft(self, nick, data):
-        print "userLeft:", nick, data
         self.occupants_list.removeOccupant(nick)
         self.printInfo("<= %s has left the room" % nick)
 
@@ -686,7 +683,7 @@
             stamps.sort()
             for stamp in stamps:
                 self.printMessage(history[stamp][0], history[stamp][1], stamp)
-        self.host.bridge.call('getHistory', getHistoryCB, self.host.whoami.bare, str(self.target), 20)
+        self.host.bridge.call('getHistory', getHistoryCB, self.host.whoami.bare, self.target.bare, 20)
    
     def printInfo(self, msg, type='normal'):
         """Print general info
@@ -758,7 +755,6 @@
         Window.addWindowResizeListener(self)
 
     def onWindowResized(self, width, height):
-        print "onWindowResized"
         tab_panel_elt = self.getElement()
         _elts = doc().getElementsByClassName('gwt-TabBar')
         if not _elts.length: