comparison src/browser/sat_browser/libervia_widget.py @ 662:ebb602d8b3f2 frontends_multi_profiles

browser_side: replace all instances of 'str' with 'unicode'
author souliane <souliane@mailoo.org>
date Tue, 03 Mar 2015 06:51:13 +0100
parents 8e7d4de56e75
children 423182fea41c
comparison
equal deleted inserted replaced
661:2664fe93ceb3 662:ebb602d8b3f2
46 46
47 import dialog 47 import dialog
48 import base_menu 48 import base_menu
49 import base_widget 49 import base_widget
50 import base_panel 50 import base_panel
51
52
53 unicode = str # FIXME: pyjamas workaround
51 54
52 55
53 # FIXME: we need to group several unrelated panels/widgets in this module because of isinstance tests and other references to classes (e.g. if we separate Drag n Drop classes in a separate module, we'll have cyclic import because of the references to LiberviaWidget in DropCell). 56 # FIXME: we need to group several unrelated panels/widgets in this module because of isinstance tests and other references to classes (e.g. if we separate Drag n Drop classes in a separate module, we'll have cyclic import because of the references to LiberviaWidget in DropCell).
54 # TODO: use a more generic method (either use duck typing, or register classes in a generic way, without hard references), then split classes in separate modules 57 # TODO: use a more generic method (either use duck typing, or register classes in a generic way, without hard references), then split classes in separate modules
55 58
356 359
357 def __init__(self, host, title='', info=None, selectable=False): 360 def __init__(self, host, title='', info=None, selectable=False):
358 """Init the widget 361 """Init the widget
359 362
360 @param host (SatWebFrontend): SatWebFrontend instance 363 @param host (SatWebFrontend): SatWebFrontend instance
361 @param title (str): title shown in the header of the widget 364 @param title (unicode): title shown in the header of the widget
362 @param info (str, callable): info shown in the header of the widget 365 @param info (unicode, callable): info shown in the header of the widget
363 @param selectable (bool): True is widget can be selected by user 366 @param selectable (bool): True is widget can be selected by user
364 """ 367 """
365 VerticalPanel.__init__(self) 368 VerticalPanel.__init__(self)
366 DropCell.__init__(self, host) 369 DropCell.__init__(self, host)
367 ClickHandler.__init__(self) 370 ClickHandler.__init__(self)
370 self._setting_button_id = HTMLPanel.createUniqueId() 373 self._setting_button_id = HTMLPanel.createUniqueId()
371 self._close_button_id = HTMLPanel.createUniqueId() 374 self._close_button_id = HTMLPanel.createUniqueId()
372 self._title = Label(title) 375 self._title = Label(title)
373 self._title.setStyleName('widgetHeader_title') 376 self._title.setStyleName('widgetHeader_title')
374 if info is not None: 377 if info is not None:
375 if isinstance(info, str): 378 if isinstance(info, unicode):
376 self._info = HTML(info) 379 self._info = HTML(info)
377 else: # the info will be set by a callback 380 else: # the info will be set by a callback
378 assert callable(info) 381 assert callable(info)
379 self._info = HTML() 382 self._info = HTML()
380 info(self._info.setHTML) 383 info(self._info.setHTML)