Mercurial > libervia-web
comparison browser_side/dialog.py @ 62:12e889a683ce SàT v0.2.0
server side: misc stuff:
- fixed lot of misuse in callbacks
- chat history fixed
- a visual indicator now appear when we have message waiting from a contact
- fixed About dialog size issue in webkit
- fixed Drag'n'Drop for webkit
- defaut room to join is now libervia@conference.libervia.org
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 31 May 2011 17:06:59 +0200 |
parents | e552a67b933d |
children | 9d8e79ac4c9c |
comparison
equal
deleted
inserted
replaced
61:80c490e6a1a7 | 62:12e889a683ce |
---|---|
26 from pyjamas.ui.ListBox import ListBox | 26 from pyjamas.ui.ListBox import ListBox |
27 from pyjamas.ui.Button import Button | 27 from pyjamas.ui.Button import Button |
28 from pyjamas.ui.TextBox import TextBox | 28 from pyjamas.ui.TextBox import TextBox |
29 from pyjamas.ui.Label import Label | 29 from pyjamas.ui.Label import Label |
30 from pyjamas.ui.HTML import HTML | 30 from pyjamas.ui.HTML import HTML |
31 from pyjamas.ui.Frame import Frame | |
31 from pyjamas.ui import HasAlignment | 32 from pyjamas.ui import HasAlignment |
32 from pyjamas.ui.KeyboardListener import KEY_ESCAPE, KEY_ENTER | 33 from pyjamas.ui.KeyboardListener import KEY_ESCAPE, KEY_ENTER |
33 | 34 |
34 class ContactsChooser(DialogBox): | 35 class ContactsChooser(DialogBox): |
35 | 36 |
61 button_panel.add(Button("Cancel", self.onCancel)) | 62 button_panel.add(Button("Cancel", self.onCancel)) |
62 content.add(button_panel) | 63 content.add(button_panel) |
63 self.setHTML(text) | 64 self.setHTML(text) |
64 self.setWidget(content) | 65 self.setWidget(content) |
65 | 66 |
66 def onChange(self): | 67 def onChange(self, sender): |
67 if self.nb_contact: | 68 if self.nb_contact: |
68 if len(self.contacts_list.getSelectedValues()) == self.nb_contact: | 69 if len(self.contacts_list.getSelectedValues()) == self.nb_contact: |
69 self.choose_button.setEnabled(True) | 70 self.choose_button.setEnabled(True) |
70 else: | 71 else: |
71 self.choose_button.setEnabled(False) | 72 self.choose_button.setEnabled(False) |
78 for contact in self.host.contact_panel.getConnected(): | 79 for contact in self.host.contact_panel.getConnected(): |
79 if contact not in [room.bare for room in self.host.room_list]: | 80 if contact not in [room.bare for room in self.host.room_list]: |
80 self.contacts_list.addItem(contact) | 81 self.contacts_list.addItem(contact) |
81 self.show() | 82 self.show() |
82 | 83 |
83 def onChoose(self): | 84 def onChoose(self, sender): |
84 self.hide() | 85 self.hide() |
85 self.callback(self.contacts_list.getSelectedValues()) | 86 self.callback(self.contacts_list.getSelectedValues()) |
86 | 87 |
87 def onCancel(self): | 88 def onCancel(self, sender): |
88 self.hide() | 89 self.hide() |
89 | 90 |
90 class GenericConfirmDialog(DialogBox): | 91 class GenericConfirmDialog(DialogBox): |
91 | 92 |
92 def __init__(self, widgets, callback, title='Confirmation'): | 93 def __init__(self, widgets, callback, title='Confirmation'): |
107 button_panel.add(Button("Cancel", self.onCancel)) | 108 button_panel.add(Button("Cancel", self.onCancel)) |
108 content.add(button_panel) | 109 content.add(button_panel) |
109 self.setHTML(title) | 110 self.setHTML(title) |
110 self.setWidget(content) | 111 self.setWidget(content) |
111 | 112 |
112 def onConfirm(self): | 113 def onConfirm(self, sender): |
113 self.hide() | 114 self.hide() |
114 self.callback(True) | 115 self.callback(True) |
115 | 116 |
116 def onCancel(self): | 117 def onCancel(self, sender): |
117 self.hide() | 118 self.hide() |
118 self.callback(False) | 119 self.callback(False) |
119 | 120 |
120 class ConfirmDialog(GenericConfirmDialog): | 121 class ConfirmDialog(GenericConfirmDialog): |
121 | 122 |
139 _close_button = Button("Close", self.onClose) | 140 _close_button = Button("Close", self.onClose) |
140 _body.add(_close_button) | 141 _body.add(_close_button) |
141 _body.setCellHorizontalAlignment(_close_button, HasAlignment.ALIGN_CENTER) | 142 _body.setCellHorizontalAlignment(_close_button, HasAlignment.ALIGN_CENTER) |
142 self.setHTML(title) | 143 self.setHTML(title) |
143 self.setWidget(_body) | 144 self.setWidget(_body) |
144 self.panel.setWidth('100%') | 145 if isinstance(widget, Frame): |
145 | 146 #Need this hack to have correct size for About box + Social Contract |
146 def onClose(self): | 147 #in Gecko & Webkit |
148 self.panel.setWidth('100%') | |
149 | |
150 def onClose(self, sender): | |
147 self.hide() | 151 self.hide() |
148 if self.callback: | 152 if self.callback: |
149 self.callback() | 153 self.callback() |
150 | 154 |
151 class InfoDialog(GenericDialog): | 155 class InfoDialog(GenericDialog): |