comparison browser_side/panels.py @ 422:20c508f9b32a

browser side: fixed bad use of Timer
author Goffi <goffi@goffi.org>
date Wed, 26 Mar 2014 17:34:01 +0100
parents ae598511850d
children 19bd203daa27
comparison
equal deleted inserted replaced
421:39b07289ff42 422:20c508f9b32a
134 def onKeyPress(self, sender, keycode, modifiers): 134 def onKeyPress(self, sender, keycode, modifiers):
135 _txt = self.getText() 135 _txt = self.getText()
136 136
137 def history_cb(text): 137 def history_cb(text):
138 self.setText(text) 138 self.setText(text)
139 Timer(5, lambda: self.setCursorPos(len(text))) 139 Timer(5, lambda timer: self.setCursorPos(len(text)))
140 140
141 if keycode == KEY_ENTER: 141 if keycode == KEY_ENTER:
142 if _txt: 142 if _txt:
143 self._selected_cache.onTextEntered(_txt) 143 self._selected_cache.onTextEntered(_txt)
144 self.host._updateInputHistory(_txt) 144 self.host._updateInputHistory(_txt)
898 print "FIXME: MicroblogPanel.vpanel should be wrapped in a ScrollPanel!" 898 print "FIXME: MicroblogPanel.vpanel should be wrapped in a ScrollPanel!"
899 removeStyle = lambda entry: entry.removeStyleName('selected_entry') 899 removeStyle = lambda entry: entry.removeStyleName('selected_entry')
900 if not self.host.uni_box or not entry.comments: 900 if not self.host.uni_box or not entry.comments:
901 entry.addStyleName('selected_entry') # blink the clicked entry 901 entry.addStyleName('selected_entry') # blink the clicked entry
902 clicked_entry = entry # entry may be None when the timer is done 902 clicked_entry = entry # entry may be None when the timer is done
903 Timer(500, lambda: removeStyle(clicked_entry)) 903 Timer(500, lambda timer: removeStyle(clicked_entry))
904 if not self.host.uni_box: 904 if not self.host.uni_box:
905 return # unibox is disabled 905 return # unibox is disabled
906 # from here the previous behavior (toggle main item selection) is conserved 906 # from here the previous behavior (toggle main item selection) is conserved
907 entry = entry if entry.comments else None 907 entry = entry if entry.comments else None
908 if self.selected_entry == entry: 908 if self.selected_entry == entry: