Mercurial > libervia-web
comparison browser_side/panels.py @ 73:447dc8ac181b
Adrien's uniBox design integration + lastPopup style
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 18 Jun 2011 01:21:45 +0200 |
parents | c335675eef7c |
children | 4b4c0b9e2533 |
comparison
equal
deleted
inserted
replaced
72:dae64124ff24 | 73:447dc8ac181b |
---|---|
28 from pyjamas.ui.ScrollPanel import ScrollPanel | 28 from pyjamas.ui.ScrollPanel import ScrollPanel |
29 from pyjamas.ui.TabPanel import TabPanel | 29 from pyjamas.ui.TabPanel import TabPanel |
30 from pyjamas.ui.HTMLPanel import HTMLPanel | 30 from pyjamas.ui.HTMLPanel import HTMLPanel |
31 from pyjamas.ui.Grid import Grid | 31 from pyjamas.ui.Grid import Grid |
32 from pyjamas.ui.DialogBox import DialogBox | 32 from pyjamas.ui.DialogBox import DialogBox |
33 from pyjamas.ui.AutoComplete import AutoCompleteTextBox | 33 from pyjamas.ui.TextArea import TextArea |
34 from pyjamas.ui.MenuBar import MenuBar | 34 from pyjamas.ui.MenuBar import MenuBar |
35 from pyjamas.ui.MenuBarPopupPanel import MenuBarPopupPanel | 35 from pyjamas.ui.MenuBarPopupPanel import MenuBarPopupPanel |
36 from pyjamas.ui.MenuItem import MenuItem | 36 from pyjamas.ui.MenuItem import MenuItem |
37 from pyjamas.ui.ListBox import ListBox | 37 from pyjamas.ui.ListBox import ListBox |
38 from pyjamas.ui.Label import Label | 38 from pyjamas.ui.Label import Label |
80 print self.popup.getOffsetWidth() | 80 print self.popup.getOffsetWidth() |
81 self.popup.setPopupPosition(Window.getClientWidth() - | 81 self.popup.setPopupPosition(Window.getClientWidth() - |
82 self.popup.getOffsetWidth() - 22, | 82 self.popup.getOffsetWidth() - 22, |
83 self.getAbsoluteTop() + | 83 self.getAbsoluteTop() + |
84 self.getOffsetHeight() - 1) | 84 self.getOffsetHeight() - 1) |
85 self.popup.addStyleName('menuLastPopup') | |
85 | 86 |
86 | 87 |
87 class Menu(SimplePanel): | 88 class Menu(SimplePanel): |
88 | 89 |
89 def __init__(self, host): | 90 def __init__(self, host): |
370 self.setStyleName('uniBoxPanel') | 371 self.setStyleName('uniBoxPanel') |
371 self.unibox = UniBox(host) | 372 self.unibox = UniBox(host) |
372 self.unibox.setWidth('100%') | 373 self.unibox.setWidth('100%') |
373 self.add(self.unibox) | 374 self.add(self.unibox) |
374 | 375 |
375 class UniBox(AutoCompleteTextBox): | 376 class UniBox(TextArea): #AutoCompleteTextBox): |
376 """This text box is used as a main typing point, for message, microblog, etc""" | 377 """This text box is used as a main typing point, for message, microblog, etc""" |
377 | 378 |
378 def __init__(self, host): | 379 def __init__(self, host): |
379 AutoCompleteTextBox.__init__(self) | 380 TextArea.__init__(self) |
381 #AutoCompleteTextBox.__init__(self) | |
380 self._popup = None | 382 self._popup = None |
381 self._timer = Timer(notify=self._timeCb) | 383 self._timer = Timer(notify=self._timeCb) |
382 self.host = host | 384 self.host = host |
385 self.setStyleName('uniBox') | |
383 | 386 |
384 def addKey(self, key): | 387 def addKey(self, key): |
385 self.getCompletionItems().completions.append(key) | 388 return |
389 #self.getCompletionItems().completions.append(key) | |
386 | 390 |
387 def removeKey(self, key): | 391 def removeKey(self, key): |
388 try: | 392 try: |
389 self.getCompletionItems().completions.remove(key) | 393 self.getCompletionItems().completions.remove(key) |
390 except KeyError: | 394 except KeyError: |
478 mess_type = "groupchat" if _chat.type=='group' else "chat" | 482 mess_type = "groupchat" if _chat.type=='group' else "chat" |
479 self.host.bridge.call('sendMessage', None, str(_chat.target), _txt, '', mess_type) | 483 self.host.bridge.call('sendMessage', None, str(_chat.target), _txt, '', mess_type) |
480 self.setText('') | 484 self.setText('') |
481 self._timeCb(None) #we remove the popup | 485 self._timeCb(None) #we remove the popup |
482 | 486 |
483 def complete(self): | 487 """def complete(self): |
488 | |
484 #self.visible=False #XXX: self.visible is not unset in pyjamas when ENTER is pressed and a completion is done | 489 #self.visible=False #XXX: self.visible is not unset in pyjamas when ENTER is pressed and a completion is done |
485 #XXX: fixed directly on pyjamas, if the patch is accepted, no need to walk around this | 490 #XXX: fixed directly on pyjamas, if the patch is accepted, no need to walk around this |
486 return AutoCompleteTextBox.complete(self) | 491 return AutoCompleteTextBox.complete(self)""" |
487 | 492 |
488 class MicroblogEntry(SimplePanel): | 493 class MicroblogEntry(SimplePanel): |
489 | 494 |
490 def __init__(self, mblog_entry): | 495 def __init__(self, mblog_entry): |
491 SimplePanel.__init__(self) | 496 SimplePanel.__init__(self) |