Mercurial > libervia-web
comparison browser_side/dialog.py @ 48:153de5d461a4
added Social Contract \o. (in French only so far)
- new infoDialog, to show widget, it's used here to show an external webpage
- some CSS tuning
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 26 May 2011 18:44:31 +0200 |
parents | a7ff1e6f1229 |
children | f1d2eb9b2523 |
comparison
equal
deleted
inserted
replaced
47:7cabe3c1a5f2 | 48:153de5d461a4 |
---|---|
24 from pyjamas.ui.PopupPanel import PopupPanel | 24 from pyjamas.ui.PopupPanel import PopupPanel |
25 from pyjamas.ui.DialogBox import DialogBox | 25 from pyjamas.ui.DialogBox import DialogBox |
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.HTML import HTML | 28 from pyjamas.ui.HTML import HTML |
29 from pyjamas.ui import HasAlignment | |
29 from pyjamas.ui.KeyboardListener import KEY_ESCAPE | 30 from pyjamas.ui.KeyboardListener import KEY_ESCAPE |
30 | 31 |
31 class ContactsChooser(DialogBox): | 32 class ContactsChooser(DialogBox): |
32 | 33 |
33 def __init__(self, host, callback, nb_contact=None, text='Please select contacts'): | 34 def __init__(self, host, callback, nb_contact=None, text='Please select contacts'): |
110 | 111 |
111 def onCancel(self): | 112 def onCancel(self): |
112 self.hide() | 113 self.hide() |
113 self.callback(False) | 114 self.callback(False) |
114 | 115 |
115 class SimpleDialog(DialogBox): | 116 class InfoDialog(DialogBox): |
117 """Dialog which just show a widget and a close button""" | |
116 | 118 |
117 def __init__(self, title, body, callback = None): | 119 def __init__(self, title, widget, callback = None): |
118 """Simple notice dialog box | 120 """Simple notice dialog box |
119 @param title: HTML put in the header | 121 @param title: HTML put in the header |
120 @param body: HTML put in the body""" | 122 @param body: widget put in the body""" |
121 DialogBox.__init__(self, centered=True) | 123 DialogBox.__init__(self, centered=True) |
122 self.callback = callback | 124 self.callback = callback |
123 _body = VerticalPanel() | 125 _body = VerticalPanel() |
126 _body.setSize('100%','100%') | |
127 _body.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) | |
124 _body.setSpacing(4) | 128 _body.setSpacing(4) |
125 _body.add(HTML(body)) | 129 _body.add(widget) |
130 _body.setCellWidth(widget, '100%') | |
126 _body.add(Button("Close", self.onClose)) | 131 _body.add(Button("Close", self.onClose)) |
127 _body.setStyleName("dialogBody") | |
128 self.setHTML(title) | 132 self.setHTML(title) |
129 self.setWidget(_body) | 133 self.setWidget(_body) |
134 self.panel.setWidth('100%') | |
130 | 135 |
131 def onClose(self): | 136 def onClose(self): |
132 self.hide() | 137 self.hide() |
133 if self.callback: | 138 if self.callback: |
134 self.callback() | 139 self.callback() |
140 | |
141 class SimpleDialog(InfoDialog): | |
142 | |
143 def __init__(self, title, body, callback = None): | |
144 InfoDialog.__init__(self, title, HTML(body), callback) | |
135 | 145 |
136 class PopupPanelWrapper(PopupPanel): | 146 class PopupPanelWrapper(PopupPanel): |
137 """This wrapper catch Escape event to avoid request cancellation by Firefox""" | 147 """This wrapper catch Escape event to avoid request cancellation by Firefox""" |
138 | 148 |
139 def onEventPreview(self, event): | 149 def onEventPreview(self, event): |