comparison browser_side/panels.py @ 334:9c6be29c714a

browser side: removed logging imports: it's not working correctly with pyjamas
author Goffi <goffi@goffi.org>
date Tue, 04 Feb 2014 16:49:20 +0100
parents 36927be51481
children 2067d6241927
comparison
equal deleted inserted replaced
333:c01397d18026 334:9c6be29c714a
56 from constants import Const 56 from constants import Const
57 from plugin_xep_0085 import ChatStateMachine 57 from plugin_xep_0085 import ChatStateMachine
58 from sat_frontends.tools.games import SYMBOLS 58 from sat_frontends.tools.games import SYMBOLS
59 from sat_frontends.tools.strings import addURLToText 59 from sat_frontends.tools.strings import addURLToText
60 60
61 import logging
62
63 61
64 class UniBoxPanel(HorizontalPanel): 62 class UniBoxPanel(HorizontalPanel):
65 """Panel containing the UniBox""" 63 """Panel containing the UniBox"""
66 64
67 def __init__(self, host): 65 def __init__(self, host):
355 try: 353 try:
356 self.service = data['comments_service'] if self.comments else data['service'] 354 self.service = data['comments_service'] if self.comments else data['service']
357 self.node = data['comments_node'] if self.comments else data['node'] 355 self.node = data['comments_node'] if self.comments else data['node']
358 self.hash = (self.service, self.node) 356 self.hash = (self.service, self.node)
359 except KeyError: 357 except KeyError:
360 logging.error("Warning: can't manage item [%s] some keys are missing in microblog data (%s)" % (self.id, data.keys())) 358 print "Warning: can't manage item [%s] some keys are missing in microblog data (%s)" % (self.id, str(data))
361 self.comments = False 359 self.comments = False
362 360
363 361
364 class MicroblogEntry(SimplePanel, ClickHandler, FocusHandler, KeyboardHandler): 362 class MicroblogEntry(SimplePanel, ClickHandler, FocusHandler, KeyboardHandler):
365 363
841 839
842 def setSelectedEntry(self, entry): 840 def setSelectedEntry(self, entry):
843 try: 841 try:
844 self.vpanel.getParent().ensureVisible(entry) # scroll to the clicked entry 842 self.vpanel.getParent().ensureVisible(entry) # scroll to the clicked entry
845 except AttributeError: 843 except AttributeError:
846 logging.error("FIXME: MicroblogPanel.vpanel should be wrapped in a ScrollPanel!") 844 print "FIXME: MicroblogPanel.vpanel should be wrapped in a ScrollPanel!"
847 removeStyle = lambda entry: entry.removeStyleName('selected_entry') 845 removeStyle = lambda entry: entry.removeStyleName('selected_entry')
848 if not self.host.uni_box or not entry.comments: 846 if not self.host.uni_box or not entry.comments:
849 entry.addStyleName('selected_entry') # blink the clicked entry 847 entry.addStyleName('selected_entry') # blink the clicked entry
850 clicked_entry = entry # entry may be None when the timer is done 848 clicked_entry = entry # entry may be None when the timer is done
851 Timer(500, lambda: removeStyle(clicked_entry)) 849 Timer(500, lambda: removeStyle(clicked_entry))