Mercurial > libervia-web
annotate browser_side/xmlui.py @ 338:80016abf3ad3
server_side: raised default security_limit to 5
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 04 Feb 2014 16:49:21 +0100 |
parents | ea1be522ba88 |
children | 2067d6241927 |
rev | line source |
---|---|
143 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
4 """ | |
5 Libervia: a Salut à Toi frontend | |
165 | 6 Copyright (C) 2011, 2012, 2013 Jérôme Poisson <goffi@goffi.org> |
143 | 7 |
8 This program is free software: you can redistribute it and/or modify | |
9 it under the terms of the GNU Affero General Public License as published by | |
10 the Free Software Foundation, either version 3 of the License, or | |
11 (at your option) any later version. | |
12 | |
13 This program is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU Affero General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU Affero General Public License | |
19 along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 """ | |
21 | |
22 from pyjamas.ui.VerticalPanel import VerticalPanel | |
23 from pyjamas.ui.HorizontalPanel import HorizontalPanel | |
24 from pyjamas.ui.CellPanel import CellPanel | |
25 from pyjamas.ui.TabPanel import TabPanel | |
26 from pyjamas.ui.Grid import Grid | |
27 from pyjamas.ui.Label import Label | |
28 from pyjamas.ui.TextBoxBase import TextBoxBase | |
29 from pyjamas.ui.TextBox import TextBox | |
30 from pyjamas.ui.PasswordTextBox import PasswordTextBox | |
31 from pyjamas.ui.TextArea import TextArea | |
32 from pyjamas.ui.CheckBox import CheckBox | |
33 from pyjamas.ui.ListBox import ListBox | |
34 from pyjamas.ui.Button import Button | |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
35 from pyjamas.ui.HTML import HTML |
143 | 36 from nativedom import NativeDOM |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
37 from sat_frontends.tools import xmlui |
337 | 38 from sat.core.i18n import _ |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
39 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
40 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
41 class EmptyWidget(xmlui.EmptyWidget, Label): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
42 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
43 def __init__(self, parent): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
44 Label.__init__(self, '') |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
45 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
46 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
47 class TextWidget(xmlui.TextWidget, Label): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
48 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
49 def __init__(self, parent, value): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
50 Label.__init__(self, value) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
51 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
52 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
53 class LabelWidget(xmlui.LabelWidget, TextWidget): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
54 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
55 def __init__(self, parent, value): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
56 TextWidget.__init__(self, parent, value+": ") |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
57 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
58 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
59 class JidWidget(xmlui.JidWidget, TextWidget): |
337 | 60 |
61 def __init__(self, parent, value): | |
62 TextWidget.__init__(self, parent, value) | |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
63 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
64 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
65 class DividerWidget(xmlui.DividerWidget, HTML): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
66 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
67 def __init__(self, parent, style='line'): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
68 HTML.__init__(self, "<hr/>") # gof: TODO: |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
69 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
70 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
71 class StringWidget(xmlui.StringWidget, TextBox): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
72 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
73 def __init__(self, parent, value): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
74 TextBox.__init__(self) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
75 self.setText(value) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
76 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
77 def _xmluiGetValue(self): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
78 return self.getText() |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
79 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
80 def _xmluiOnChange(self, callback): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
81 self.addhangeListener(callback) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
82 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
83 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
84 class PasswordWidget(xmlui.PasswordWidget, PasswordTextBox): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
85 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
86 def __init__(self, parent, value): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
87 TextBox.__init__(self) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
88 self.setText(value) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
89 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
90 def _xmluiGetValue(self): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
91 return self.getText() |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
92 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
93 def _xmluiOnChange(self, callback): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
94 self.addChangeListener(callback) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
95 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
96 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
97 class TextBoxWidget(xmlui.TextBoxWidget, TextArea): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
98 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
99 def __init__(self, parent, value): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
100 TextArea.__init__(self) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
101 self.setText(value) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
102 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
103 def _xmluiGetValue(self): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
104 return self.getText() |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
105 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
106 def _xmluiOnChange(self, callback): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
107 self.addChangeListener(callback) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
108 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
109 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
110 class BoolWidget(xmlui.BoolWidget, CheckBox): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
111 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
112 def __init__(self, parent, state): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
113 CheckBox.__init__(self) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
114 self.setChecked(state) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
115 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
116 def _xmluiGetValue(self): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
117 return "true" if self.isChecked() else "false" |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
118 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
119 def _xmluiOnChange(self, callback): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
120 self.addClickListener(callback) |
143 | 121 |
122 | |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
123 class ButtonWidget(xmlui.ButtonWidget, Button): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
124 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
125 def __init__(self, parent, value, click_callback): |
337 | 126 Button.__init__(self, value) |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
127 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
128 def _xmluiOnClick(self, event): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
129 self.addClickListener(callback) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
130 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
131 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
132 class ListWidget(xmlui.ListWidget, ListBox): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
133 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
134 def __init__(self, parent, options, flags): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
135 ListBox.__init__(self) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
136 self.setMultipleSelect('single' not in flags) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
137 for option in options: |
337 | 138 self.addItem(option[1]) |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
139 self._xmlui_attr_map = {label: value for value, label in options} |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
140 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
141 def _xmluiSelectValue(self, value): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
142 try: |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
143 label = [label for label, _value in self._xmlui_attr_map.items() if _value == value][0] |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
144 except IndexError: |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
145 print(_("WARNING: Can't find value [%s] to select" % value)) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
146 return |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
147 self.selectItem(label) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
148 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
149 def _xmluiGetSelectedValues(self): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
150 ret = [] |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
151 for label in self.getSelectedItemText(): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
152 ret.append(self._xmlui_attr_map[label]) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
153 return ret |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
154 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
155 def _xmluiOnChange(self, callback): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
156 self.addChangeListener(callback) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
157 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
158 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
159 class LiberviaContainer(object): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
160 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
161 def _xmluiAppend(self, widget): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
162 self.append(widget) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
163 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
164 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
165 class AdvancedListContainer(xmlui.AdvancedListContainer, Grid): |
143 | 166 |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
167 def __init__(self, parent, columns, selectable='no'): |
337 | 168 Grid.__init__(self, 0, columns) |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
169 self.columns = columns |
337 | 170 self.row = -1 |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
171 self.col = 0 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
172 self._xmlui_rows_idx = [] |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
173 self._xmlui_selectable = selectable != 'no' |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
174 self._xmlui_selected_row = None |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
175 self.addTableListener(self) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
176 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
177 def onCellClicked(self, grid, row, col): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
178 if not self._xmlui_selectable: |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
179 return |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
180 self._xmlui_selected_row = row |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
181 try: |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
182 self._xmlui_select_cb(self) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
183 except AttributeError: |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
184 print "WARNING: no select callback set" |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
185 |
143 | 186 |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
187 def _xmluiAppend(self, widget): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
188 self.setWidget(self.row, self.col, widget) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
189 self.col += 1 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
190 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
191 def _xmluiAddRow(self, idx): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
192 self.row += 1 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
193 self.col = 0 |
337 | 194 self._xmlui_rows_idx.insert(self.row, idx) |
195 self.resizeRows(self.row+1) | |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
196 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
197 def _xmluiGetSelectedWidgets(self): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
198 return [self.getWidget(self._xmlui_selected_row, col) for col in range(self.columns)] |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
199 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
200 def _xmluiGetSelectedIndex(self): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
201 try: |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
202 return self._xmlui_rows_idx[self._xmlui_selected_row] |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
203 except TypeError: |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
204 return None |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
205 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
206 def _xmluiOnSelect(self, callback): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
207 self._xmlui_select_cb = callback |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
208 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
209 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
210 class PairsContainer(xmlui.PairsContainer, Grid): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
211 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
212 def __init__(self, parent): |
247
fe83837d3491
browser_side: removed some trailing spaces
Goffi <goffi@goffi.org>
parents:
229
diff
changeset
|
213 Grid.__init__(self, 0, 0) |
143 | 214 self.row = 0 |
215 self.col = 0 | |
216 | |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
217 def _xmluiAppend(self, widget): |
143 | 218 if self.col == 0: |
219 self.resize(self.row+1, 2) | |
220 self.setWidget(self.row, self.col, widget) | |
221 self.col += 1 | |
222 if self.col == 2: | |
223 self.row +=1 | |
224 self.col = 0 | |
247
fe83837d3491
browser_side: removed some trailing spaces
Goffi <goffi@goffi.org>
parents:
229
diff
changeset
|
225 |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
226 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
227 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
228 class TabsContainer(LiberviaContainer, xmlui.TabsContainer, TabPanel): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
229 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
230 def __init__(self, parent): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
231 TabPanel.__init__(self) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
232 self.setStyleName('liberviaTabPanel') |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
233 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
234 def _xmluiAddTab(self, label): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
235 tab_panel = VerticalContainer(self) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
236 self.add(tab_panel, label) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
237 if len(self.getChildren()) == 1: |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
238 self.selectTab(0) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
239 return tab_panel |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
240 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
241 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
242 class VerticalContainer(LiberviaContainer, xmlui.VerticalContainer, VerticalPanel): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
243 __bases__ = (LiberviaContainer, xmlui.VerticalContainer, VerticalPanel) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
244 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
245 def __init__(self, parent): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
246 VerticalPanel.__init__(self) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
247 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
248 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
249 class WidgetFactory(object): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
250 # XXX: __getattr__ doesn't work here for an unknown reason |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
251 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
252 def createVerticalContainer(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
253 instance = VerticalContainer(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
254 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
255 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
256 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
257 def createPairsContainer(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
258 instance = PairsContainer(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
259 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
260 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
261 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
262 def createTabsContainer(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
263 instance = TabsContainer(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
264 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
265 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
266 |
337 | 267 def createAdvancedListContainer(self, *args, **kwargs): |
268 instance = AdvancedListContainer(*args, **kwargs) | |
269 instance._xmlui_main = self._xmlui_main | |
270 return instance | |
271 | |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
272 def createEmptyWidget(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
273 instance = EmptyWidget(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
274 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
275 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
276 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
277 def createTextWidget(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
278 instance = TextWidget(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
279 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
280 return instance |
247
fe83837d3491
browser_side: removed some trailing spaces
Goffi <goffi@goffi.org>
parents:
229
diff
changeset
|
281 |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
282 def createLabelWidget(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
283 instance = LabelWidget(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
284 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
285 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
286 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
287 def createJidWidget(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
288 instance = JidWidget(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
289 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
290 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
291 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
292 def createDividerWidget(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
293 instance = DividerWidget(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
294 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
295 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
296 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
297 def createStringWidget(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
298 instance = StringWidget(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
299 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
300 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
301 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
302 def createPasswordWidget(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
303 instance = PasswordWidget(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
304 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
305 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
306 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
307 def createTextBoxWidget(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
308 instance = TextBoxWidget(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
309 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
310 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
311 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
312 def createBoolWidget(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
313 instance = BoolWidget(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
314 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
315 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
316 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
317 def createButtonWidget(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
318 instance = ButtonWidget(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
319 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
320 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
321 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
322 def createListWidget(self, *args, **kwargs): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
323 instance = ListWidget(*args, **kwargs) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
324 instance._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
325 return instance |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
326 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
327 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
328 # def __getattr__(self, attr): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
329 # if attr.startswith("create"): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
330 # cls = globals()[attr[6:]] |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
331 # cls._xmlui_main = self._xmlui_main |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
332 # return cls |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
333 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
334 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
335 class XMLUI(xmlui.XMLUI, VerticalPanel): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
336 widget_factory = WidgetFactory() |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
337 |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
338 def __init__(self, host, xml_data, title = None, flags = None): |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
339 self.widget_factory._xmlui_main = self |
143 | 340 self.dom = NativeDOM() |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
341 dom_parse = lambda xml_data: self.dom.parseString(xml_data) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
342 VerticalPanel.__init__(self) |
143 | 343 self.setSize('100%', '100%') |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
344 xmlui.XMLUI.__init__(self, host, xml_data, title, flags, dom_parse) |
143 | 345 |
346 def setCloseCb(self, close_cb): | |
347 self.close_cb = close_cb | |
348 | |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
349 def _xmluiClose(self): |
143 | 350 if self.close_cb: |
351 self.close_cb() | |
352 else: | |
353 print "WARNING: no close method defined" | |
354 | |
337 | 355 def _xmluiLaunchAction(self, action_id, data): |
356 self.host.launchAction(action_id, data) | |
357 | |
358 def _xmluiSetParam(self, name, value, category): | |
359 self.host.bridge.call('setParam', None, name, value, category) | |
360 | |
143 | 361 def constructUI(self, xml_data): |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
362 super(XMLUI, self).constructUI(xml_data) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
363 self.add(self.main_cont) |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
364 self.setCellHeight(self.main_cont, '100%') |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
365 if self.type == 'form': |
143 | 366 hpanel = HorizontalPanel() |
367 hpanel.add(Button('Submit',self.onFormSubmitted)) | |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
368 if not 'NO_CANCEL' in self.flags: |
143 | 369 hpanel.add(Button('Cancel',self.onFormCancelled)) |
370 self.add(hpanel) | |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
371 elif self.type == 'param': |
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
372 assert(isinstance(self.children[0][0],TabPanel)) |
143 | 373 hpanel = HorizontalPanel() |
335
e8c26e24a6c7
browser side: refactored XMLUI to use the new sat_frontends.tools.xmlui.XMLUI class, first draft
Goffi <goffi@goffi.org>
parents:
325
diff
changeset
|
374 hpanel.add(Button('Cancel', lambda ignore: self._xmluiClose())) |
247
fe83837d3491
browser_side: removed some trailing spaces
Goffi <goffi@goffi.org>
parents:
229
diff
changeset
|
375 hpanel.add(Button('Save', self.onSaveParams)) |
143 | 376 self.add(hpanel) |