Mercurial > libervia-backend
annotate libervia/backend/tools/common/template_xmlui.py @ 4348:35d41de5b2aa @
doc (component): document use of Gateway Relayed Encryption:
fix 455
| author | Goffi <goffi@goffi.org> |
|---|---|
| date | Mon, 13 Jan 2025 01:23:22 +0100 |
| parents | 0d7bb4df2343 |
| children |
| rev | line source |
|---|---|
| 3028 | 1 #!/usr/bin/env python3 |
| 3137 | 2 |
| 2362 | 3 |
| 4 # SAT: a jabber client | |
| 3479 | 5 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org) |
| 2362 | 6 |
| 7 # This program is free software: you can redistribute it and/or modify | |
| 8 # it under the terms of the GNU Affero General Public License as published by | |
| 9 # the Free Software Foundation, either version 3 of the License, or | |
| 10 # (at your option) any later version. | |
| 11 | |
| 12 # This program is distributed in the hope that it will be useful, | |
| 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 # GNU Affero General Public License for more details. | |
| 16 | |
| 17 # You should have received a copy of the GNU Affero General Public License | |
| 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 19 | |
| 20 """ template XMLUI parsing | |
| 21 | |
| 22 XMLUI classes from this modules can then be iterated to create the template | |
| 23 """ | |
| 24 | |
|
3271
abca25af06d7
plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
25 from functools import partial |
|
4071
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4037
diff
changeset
|
26 from libervia.backend.core.log import getLogger |
|
4074
26b7ed2817da
refactoring: rename `sat_frontends` to `libervia.frontends`
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
27 from libervia.frontends.tools import xmlui |
|
26b7ed2817da
refactoring: rename `sat_frontends` to `libervia.frontends`
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
28 from libervia.frontends.tools import jid |
|
4270
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
29 |
|
2783
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
30 try: |
|
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
31 from jinja2 import Markup as safe |
|
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
32 except ImportError: |
|
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
33 # Safe marks XHTML values as usable as it. |
|
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
34 # If jinja2 is not there, we can use a simple lamba |
|
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
35 safe = lambda x: x |
| 2362 | 36 |
| 37 | |
|
3271
abca25af06d7
plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
38 log = getLogger(__name__) |
|
abca25af06d7
plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
39 |
|
abca25af06d7
plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
40 |
| 2362 | 41 ## Widgets ## |
| 42 | |
|
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
43 |
| 2362 | 44 class Widget(object): |
| 3028 | 45 category = "widget" |
| 2362 | 46 type = None |
| 47 enabled = True | |
| 48 read_only = True | |
| 49 | |
| 50 def __init__(self, xmlui_parent): | |
| 51 self.xmlui_parent = xmlui_parent | |
| 52 | |
| 53 @property | |
| 54 def name(self): | |
| 55 return self._xmlui_name | |
| 56 | |
| 57 | |
| 58 class ValueWidget(Widget): | |
| 59 def __init__(self, xmlui_parent, value): | |
| 60 super(ValueWidget, self).__init__(xmlui_parent) | |
| 61 self.value = value | |
| 62 | |
|
2367
9878635586f3
template (xmlui): added values property to be able to use always values even when there is only one value
Goffi <goffi@goffi.org>
parents:
2362
diff
changeset
|
63 @property |
|
9878635586f3
template (xmlui): added values property to be able to use always values even when there is only one value
Goffi <goffi@goffi.org>
parents:
2362
diff
changeset
|
64 def values(self): |
|
9878635586f3
template (xmlui): added values property to be able to use always values even when there is only one value
Goffi <goffi@goffi.org>
parents:
2362
diff
changeset
|
65 return [self.value] |
|
9878635586f3
template (xmlui): added values property to be able to use always values even when there is only one value
Goffi <goffi@goffi.org>
parents:
2362
diff
changeset
|
66 |
|
2455
7b02372f8734
template (xmlui): added labels property in ValueWidget (actually return values) and values property in OptionsWidget
Goffi <goffi@goffi.org>
parents:
2435
diff
changeset
|
67 @property |
|
7b02372f8734
template (xmlui): added labels property in ValueWidget (actually return values) and values property in OptionsWidget
Goffi <goffi@goffi.org>
parents:
2435
diff
changeset
|
68 def labels(self): |
|
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
69 # helper property, there is not label for ValueWidget |
|
2455
7b02372f8734
template (xmlui): added labels property in ValueWidget (actually return values) and values property in OptionsWidget
Goffi <goffi@goffi.org>
parents:
2435
diff
changeset
|
70 # but using labels make rendering more easy (one single method to call) |
|
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
71 # values are actually returned |
|
2455
7b02372f8734
template (xmlui): added labels property in ValueWidget (actually return values) and values property in OptionsWidget
Goffi <goffi@goffi.org>
parents:
2435
diff
changeset
|
72 return [self.value] |
|
7b02372f8734
template (xmlui): added labels property in ValueWidget (actually return values) and values property in OptionsWidget
Goffi <goffi@goffi.org>
parents:
2435
diff
changeset
|
73 |
| 2362 | 74 |
| 75 class InputWidget(ValueWidget): | |
| 76 def __init__(self, xmlui_parent, value, read_only=False): | |
| 77 super(InputWidget, self).__init__(xmlui_parent, value) | |
| 78 self.read_only = read_only | |
| 79 | |
| 80 | |
| 81 class OptionsWidget(Widget): | |
| 82 def __init__(self, xmlui_parent, options, selected, style): | |
| 83 super(OptionsWidget, self).__init__(xmlui_parent) | |
| 84 self.options = options | |
| 85 self.selected = selected | |
| 86 self.style = style | |
| 87 | |
|
2379
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
88 @property |
|
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
89 def values(self): |
|
2455
7b02372f8734
template (xmlui): added labels property in ValueWidget (actually return values) and values property in OptionsWidget
Goffi <goffi@goffi.org>
parents:
2435
diff
changeset
|
90 for value, label in self.items: |
|
7b02372f8734
template (xmlui): added labels property in ValueWidget (actually return values) and values property in OptionsWidget
Goffi <goffi@goffi.org>
parents:
2435
diff
changeset
|
91 yield value |
|
2379
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
92 |
|
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
93 @property |
|
3546
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
94 def value(self): |
|
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
95 if self.multi or self.no_select or len(self.selected) != 1: |
|
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
96 raise ValueError( |
|
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
97 "Can't get value for list with multiple selections or nothing selected" |
|
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
98 ) |
|
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
99 return self.selected[0] |
|
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
100 |
|
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
101 @property |
|
2379
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
102 def labels(self): |
|
2400
8253ea069781
template(XMLUI): added items property to ListWidget:
Goffi <goffi@goffi.org>
parents:
2397
diff
changeset
|
103 """return only labels from self.items""" |
|
8253ea069781
template(XMLUI): added items property to ListWidget:
Goffi <goffi@goffi.org>
parents:
2397
diff
changeset
|
104 for value, label in self.items: |
|
8253ea069781
template(XMLUI): added items property to ListWidget:
Goffi <goffi@goffi.org>
parents:
2397
diff
changeset
|
105 yield label |
|
8253ea069781
template(XMLUI): added items property to ListWidget:
Goffi <goffi@goffi.org>
parents:
2397
diff
changeset
|
106 |
|
8253ea069781
template(XMLUI): added items property to ListWidget:
Goffi <goffi@goffi.org>
parents:
2397
diff
changeset
|
107 @property |
|
8253ea069781
template(XMLUI): added items property to ListWidget:
Goffi <goffi@goffi.org>
parents:
2397
diff
changeset
|
108 def items(self): |
|
8253ea069781
template(XMLUI): added items property to ListWidget:
Goffi <goffi@goffi.org>
parents:
2397
diff
changeset
|
109 """return suitable items, according to style""" |
|
8253ea069781
template(XMLUI): added items property to ListWidget:
Goffi <goffi@goffi.org>
parents:
2397
diff
changeset
|
110 no_select = self.no_select |
|
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
111 for value, label in self.options: |
|
2400
8253ea069781
template(XMLUI): added items property to ListWidget:
Goffi <goffi@goffi.org>
parents:
2397
diff
changeset
|
112 if no_select or value in self.selected: |
|
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
113 yield value, label |
|
2379
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
114 |
|
2397
7fff98d64ab5
core (XMLUI), template(XMLUI): added flags to ListWidget:
Goffi <goffi@goffi.org>
parents:
2379
diff
changeset
|
115 @property |
|
7fff98d64ab5
core (XMLUI), template(XMLUI): added flags to ListWidget:
Goffi <goffi@goffi.org>
parents:
2379
diff
changeset
|
116 def inline(self): |
| 3028 | 117 return "inline" in self.style |
|
2397
7fff98d64ab5
core (XMLUI), template(XMLUI): added flags to ListWidget:
Goffi <goffi@goffi.org>
parents:
2379
diff
changeset
|
118 |
|
7fff98d64ab5
core (XMLUI), template(XMLUI): added flags to ListWidget:
Goffi <goffi@goffi.org>
parents:
2379
diff
changeset
|
119 @property |
|
7fff98d64ab5
core (XMLUI), template(XMLUI): added flags to ListWidget:
Goffi <goffi@goffi.org>
parents:
2379
diff
changeset
|
120 def no_select(self): |
| 3028 | 121 return "noselect" in self.style |
|
2397
7fff98d64ab5
core (XMLUI), template(XMLUI): added flags to ListWidget:
Goffi <goffi@goffi.org>
parents:
2379
diff
changeset
|
122 |
|
3546
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
123 @property |
|
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
124 def multi(self): |
|
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
125 return "multi" in self.style |
|
185601bc0cd3
tools (common/template_xmlui: add `multi` and `value` propertied to OptionsWidget
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
126 |
| 2362 | 127 |
| 128 class EmptyWidget(xmlui.EmptyWidget, Widget): | |
| 129 def __init__(self, _xmlui_parent): | |
| 130 Widget.__init__(self) | |
| 131 | |
| 132 | |
| 133 class TextWidget(xmlui.TextWidget, ValueWidget): | |
| 3028 | 134 type = "text" |
| 2362 | 135 |
| 136 | |
|
3271
abca25af06d7
plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
137 class JidWidget(xmlui.JidWidget, ValueWidget): |
|
abca25af06d7
plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
138 type = "jid" |
|
abca25af06d7
plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
139 |
|
abca25af06d7
plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
140 def __init__(self, xmlui_parent, value): |
|
abca25af06d7
plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
141 self.value = jid.JID(value) |
|
abca25af06d7
plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
142 |
|
abca25af06d7
plugin pubsub schema, tools (common/template xmlui): use a JID for publisher:
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
143 |
| 2362 | 144 class LabelWidget(xmlui.LabelWidget, ValueWidget): |
| 3028 | 145 type = "label" |
| 2362 | 146 |
|
2379
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
147 @property |
|
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
148 def for_name(self): |
|
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
149 try: |
|
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
150 return self._xmlui_for_name |
|
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
151 except AttributeError: |
|
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
152 return None |
| 2362 | 153 |
|
2379
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
154 |
|
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
155 class StringWidget(xmlui.StringWidget, InputWidget): |
| 3028 | 156 type = "string" |
| 2362 | 157 |
| 158 | |
|
2435
49884c579266
template (XMLUI): added JidInputWidget
Goffi <goffi@goffi.org>
parents:
2419
diff
changeset
|
159 class JidInputWidget(xmlui.JidInputWidget, StringWidget): |
| 3028 | 160 type = "jid" |
|
2435
49884c579266
template (XMLUI): added JidInputWidget
Goffi <goffi@goffi.org>
parents:
2419
diff
changeset
|
161 |
|
4270
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
162 |
|
2379
42a54cbc1872
template (xmlui): new properties + inheritance fix:
Goffi <goffi@goffi.org>
parents:
2367
diff
changeset
|
163 class TextBoxWidget(xmlui.TextWidget, InputWidget): |
| 3028 | 164 type = "textbox" |
| 2362 | 165 |
| 166 | |
|
2783
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
167 class XHTMLBoxWidget(xmlui.XHTMLBoxWidget, InputWidget): |
| 3028 | 168 type = "xhtmlbox" |
|
2783
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
169 |
|
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
170 def __init__(self, xmlui_parent, value, read_only=False): |
|
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
171 # XXX: XHTMLBoxWidget value must be cleaned (harmful XHTML must be removed) |
|
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
172 # This is normally done in the backend, the frontends should not need to |
|
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
173 # worry about it. |
|
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
174 super(XHTMLBoxWidget, self).__init__( |
|
4270
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
175 xmlui_parent=xmlui_parent, value=safe(value), read_only=read_only |
|
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
176 ) |
|
2783
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
177 |
|
442ab697f831
frontends, jp, templates: added XHTMLBox widget:
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
178 |
| 2362 | 179 class ListWidget(xmlui.ListWidget, OptionsWidget): |
| 3028 | 180 type = "list" |
| 2362 | 181 |
| 182 | |
| 183 ## Containers ## | |
| 184 | |
|
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
185 |
| 2362 | 186 class Container(object): |
| 3028 | 187 category = "container" |
| 2362 | 188 type = None |
| 189 | |
| 190 def __init__(self, xmlui_parent): | |
| 191 self.xmlui_parent = xmlui_parent | |
| 192 self.children = [] | |
| 193 | |
| 194 def __iter__(self): | |
| 195 return iter(self.children) | |
| 196 | |
|
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3546
diff
changeset
|
197 def _xmlui_append(self, widget): |
| 2362 | 198 self.children.append(widget) |
| 199 | |
|
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3546
diff
changeset
|
200 def _xmlui_remove(self, widget): |
|
2419
c38c54c47e16
frontends (xmlui): added an attribute to ignore some widgets (and their label) in create
Goffi <goffi@goffi.org>
parents:
2414
diff
changeset
|
201 self.children.remove(widget) |
|
c38c54c47e16
frontends (xmlui): added an attribute to ignore some widgets (and their label) in create
Goffi <goffi@goffi.org>
parents:
2414
diff
changeset
|
202 |
| 2362 | 203 |
| 204 class VerticalContainer(xmlui.VerticalContainer, Container): | |
| 3028 | 205 type = "vertical" |
| 2362 | 206 |
| 207 | |
| 208 class PairsContainer(xmlui.PairsContainer, Container): | |
| 3028 | 209 type = "pairs" |
| 2362 | 210 |
| 211 | |
| 212 class LabelContainer(xmlui.PairsContainer, Container): | |
| 3028 | 213 type = "label" |
| 2362 | 214 |
| 215 | |
| 216 ## Factory ## | |
| 217 | |
|
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
218 |
| 2362 | 219 class WidgetFactory(object): |
|
2669
bdb8276fd2da
frontends (xmlui): class_map is now an arg of create function:
Goffi <goffi@goffi.org>
parents:
2624
diff
changeset
|
220 |
| 2362 | 221 def __getattr__(self, attr): |
| 222 if attr.startswith("create"): | |
| 223 cls = globals()[attr[6:]] | |
| 224 return cls | |
| 225 | |
|
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
226 |
| 2362 | 227 ## Core ## |
| 228 | |
| 229 | |
| 230 class XMLUIPanel(xmlui.XMLUIPanel): | |
| 231 widget_factory = WidgetFactory() | |
| 232 | |
| 233 def show(self, *args, **kwargs): | |
| 234 raise NotImplementedError | |
| 235 | |
| 236 | |
| 237 class XMLUIDialog(xmlui.XMLUIDialog): | |
| 238 dialog_factory = WidgetFactory() | |
| 239 | |
| 240 def __init__(*args, **kwargs): | |
| 241 raise NotImplementedError | |
| 242 | |
| 243 | |
|
4270
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
244 create = partial( |
|
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
245 xmlui.create, |
|
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
246 class_map={xmlui.CLASS_PANEL: XMLUIPanel, xmlui.CLASS_DIALOG: XMLUIDialog}, |
|
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
247 ) |
