changeset 422:20c508f9b32a

browser side: fixed bad use of Timer
author Goffi <goffi@goffi.org>
date Wed, 26 Mar 2014 17:34:01 +0100
parents 39b07289ff42
children f9130176bc8d
files browser_side/contact_group.py browser_side/list_manager.py browser_side/panels.py browser_side/plugin_xep_0085.py browser_side/radiocol.py browser_side/register.py libervia.py
diffstat 7 files changed, 12 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/contact_group.py	Tue Mar 25 16:09:12 2014 +0100
+++ b/browser_side/contact_group.py	Wed Mar 26 17:34:01 2014 +0100
@@ -37,7 +37,7 @@
     def __init__(self, parent, keys_dict, contact_list, offsets, style):
         ListManager.__init__(self, parent, keys_dict, contact_list, offsets, style)
         self.registerPopupMenuPanel(entries={"Remove group": {}},
-                                    callback=lambda sender, key: Timer(5, lambda: self.removeContactKey(sender, key)))
+                                    callback=lambda sender, key: Timer(5, lambda timer: self.removeContactKey(sender, key)))
 
     def removeContactKey(self, sender, key):
         key = sender.getText()
--- a/browser_side/list_manager.py	Tue Mar 25 16:09:12 2014 +0100
+++ b/browser_side/list_manager.py	Wed Mar 26 17:34:01 2014 +0100
@@ -310,7 +310,7 @@
     def onMouseLeave(self, sender):
         """Mouse leaves the area of a DragAutoCompleteTextBox."""
         if hasattr(sender, "remove_btn"):
-            Timer(1500, lambda: sender.remove_btn.setVisible(False))
+            Timer(1500, lambda timer: sender.remove_btn.setVisible(False))
 
     def onFocus(self, sender):
         sender.setSelectionRange(0, len(self.getText()))
--- a/browser_side/panels.py	Tue Mar 25 16:09:12 2014 +0100
+++ b/browser_side/panels.py	Wed Mar 26 17:34:01 2014 +0100
@@ -136,7 +136,7 @@
 
         def history_cb(text):
             self.setText(text)
-            Timer(5, lambda: self.setCursorPos(len(text)))
+            Timer(5, lambda timer: self.setCursorPos(len(text)))
 
         if keycode == KEY_ENTER:
             if _txt:
@@ -900,7 +900,7 @@
         if not self.host.uni_box or not entry.comments:
             entry.addStyleName('selected_entry')  # blink the clicked entry
             clicked_entry = entry  # entry may be None when the timer is done
-            Timer(500, lambda: removeStyle(clicked_entry))
+            Timer(500, lambda timer: removeStyle(clicked_entry))
         if not self.host.uni_box:
             return  # unibox is disabled
         # from here the previous behavior (toggle main item selection) is conserved
--- a/browser_side/plugin_xep_0085.py	Tue Mar 25 16:09:12 2014 +0100
+++ b/browser_side/plugin_xep_0085.py	Wed Mar 26 17:34:01 2014 +0100
@@ -55,9 +55,9 @@
             return
         self.started = True
         self.next_state = state
-        self.__onEvent()
+        self.__onEvent(None)
 
-    def __onEvent(self):
+    def __onEvent(self, timer):
         # print "on event %s" % self.next_state
         state = self.next_state
         self.next_state = ""
--- a/browser_side/radiocol.py	Tue Mar 25 16:09:12 2014 +0100
+++ b/browser_side/radiocol.py	Wed Mar 26 17:34:01 2014 +0100
@@ -26,12 +26,10 @@
 from pyjamas.ui.Button import Button
 from pyjamas.ui.ClickListener import ClickHandler
 from pyjamas.ui.Hidden import Hidden
-from pyjamas.ui.HTML import HTML
 from pyjamas.ui.CaptionPanel import CaptionPanel
 from pyjamas.media.Audio import Audio
 from pyjamas import Window
 from pyjamas.Timer import Timer
-from __pyjamas__ import JS
 
 from html_tools import html_sanitize
 from file_tools import FilterFileUpload
@@ -152,7 +150,7 @@
         self.status.setStyleName('radiocol_upload_status_%s' % style)
         self.timer_on = True
 
-        def cb():
+        def cb(timer):
             self.timer_on = False
             self.updateStatus()
 
--- a/browser_side/register.py	Tue Mar 25 16:09:12 2014 +0100
+++ b/browser_side/register.py	Wed Mar 26 17:34:01 2014 +0100
@@ -35,7 +35,7 @@
 from pyjamas.ui.Image import Image
 from pyjamas.ui.Hidden import Hidden
 from pyjamas import Window
-from pyjamas.ui.KeyboardListener import KEY_ESCAPE, KEY_ENTER
+from pyjamas.ui.KeyboardListener import KEY_ENTER
 import re
 from pyjamas.Timer import Timer
 
@@ -158,13 +158,13 @@
             # the widget looses the focus. Using a timer with
             # any delay value > 0 would do the trick.
             if sender == self.login_box:
-                Timer(5, lambda: self.login_pass_box.setFocus(True))
+                Timer(5, lambda timer: self.login_pass_box.setFocus(True))
             elif sender == self.login_pass_box:
                 self.onLogin(None)
             elif sender == self.register_login_box:
-                Timer(5, lambda: self.email_box.setFocus(True))
+                Timer(5, lambda timer: self.email_box.setFocus(True))
             elif sender == self.email_box:
-                Timer(5, lambda: self.register_pass_box.setFocus(True))
+                Timer(5, lambda timer: self.register_pass_box.setFocus(True))
             elif sender == self.register_pass_box:
                 self.onRegister(None)
 
--- a/libervia.py	Tue Mar 25 16:09:12 2014 +0100
+++ b/libervia.py	Wed Mar 26 17:34:01 2014 +0100
@@ -151,7 +151,7 @@
         if isinstance(errobj['message'], dict) and errobj['message']['faultCode'] == 0:
             Window.alert('You are not allowed to connect to server')
         else:
-            def _timerCb():
+            def _timerCb(timer):
                 self.host.bridge_signals.call('getSignals', self.host._getSignalsCB)
             Timer(notify=_timerCb).schedule(self.retry_delay)
             self.retry_delay *= 2