annotate frontends/src/jp/xmlui_manager.py @ 2504:67cc54b01a12

plugin file sharing component: first draft: this component act as an endpoint where a user can store and retrieve its files using Jingle.
author Goffi <goffi@goffi.org>
date Wed, 28 Feb 2018 18:28:39 +0100
parents 0046283a285d
children 65695b9343d3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2408
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/env python2
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # JP: a SàT frontend
2483
0046283a285d dates update
Goffi <goffi@goffi.org>
parents: 2419
diff changeset
5 # Copyright (C) 2009-2018 Jérôme Poisson (goffi@goffi.org)
2408
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # (at your option) any later version.
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
16
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
19
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
20 from sat.core.log import getLogger
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
21 log = getLogger(__name__)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 from sat_frontends.tools import xmlui as xmlui_manager
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
23 from sat_frontends.jp.constants import Const as C
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
24 from sat.tools.common.ansi import ANSI as A
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
25 from sat.core.i18n import _
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
26 from functools import partial
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
27
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
28 # workflow constants
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
29
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
30 SUBMIT = 'SUBMIT' # submit form
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
31
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
32
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
33
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
34 ## Widgets ##
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
35
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
36 class Base(object):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
37 """Base for Widget and Container"""
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
38 type = None
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
39 _root = None
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
40
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
41 def __init__(self, xmlui_parent):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
42 self.xmlui_parent = xmlui_parent
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
43 self.host = self.xmlui_parent.host
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
44
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
45 @property
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
46 def root(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
47 """retrieve main XMLUI parent class"""
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
48 if self._root is not None:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
49 return self._root
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
50 root = self
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
51 while not isinstance(root, xmlui_manager.XMLUIBase):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
52 root = root.xmlui_parent
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
53 self._root = root
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
54 return root
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
55
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
56 def disp(self, *args, **kwargs):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
57 self.host.disp(*args, **kwargs)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
58
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
59
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
60 class Widget(Base):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
61 category = u'widget'
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
62 enabled = True
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
63
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
64 @property
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
65 def name(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
66 return self._xmlui_name
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
67
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
68 def show(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
69 """display current widget
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
70
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
71 must be overriden by subclasses
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
72 """
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
73 raise NotImplementedError(self.__class__)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
74
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
75 def verboseName(self, elems=None, value=None):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
76 """add name in color to the elements
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
77
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
78 helper method to display name which can then be used to automate commands
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
79 elems is only modified if verbosity is > 0
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
80 @param elems(list[unicode], None): elements to display
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
81 None to display name directly
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
82 @param value(unicode, None): value to show
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
83 use self.name if None
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
84 """
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
85 if value is None:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
86 value = self.name
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
87 if self.host.verbosity:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
88 to_disp = [A.FG_MAGENTA,
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
89 u' ' if elems else u'',
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
90 u'({})'.format(value), A.RESET]
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
91 if elems is None:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
92 self.host.disp(A.color(*to_disp))
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
93 else:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
94 elems.extend(to_disp)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
95
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
96 class ValueWidget(Widget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
97
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
98 def __init__(self, xmlui_parent, value):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
99 super(ValueWidget, self).__init__(xmlui_parent)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
100 self.value = value
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
101
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
102 @property
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
103 def values(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
104 return [self.value]
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
105
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
106
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
107 class InputWidget(ValueWidget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
108
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
109 def __init__(self, xmlui_parent, value, read_only=False):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
110 super(InputWidget, self).__init__(xmlui_parent, value)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
111 self.read_only = read_only
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
112
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
113 def _xmluiGetValue(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
114 return self.value
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
115
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
116
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
117 class OptionsWidget(Widget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
118
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
119 def __init__(self, xmlui_parent, options, selected, style):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
120 super(OptionsWidget, self).__init__(xmlui_parent)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
121 self.options = options
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
122 self.selected = selected
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
123 self.style = style
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
124
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
125 @property
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
126 def values(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
127 return self.selected
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
128
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
129 @values.setter
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
130 def values(self, values):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
131 self.selected = values
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
132
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
133 @property
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
134 def value(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
135 return self.selected[0]
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
136
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
137 @value.setter
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
138 def value(self, value):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
139 self.selected = [value]
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
140
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
141 def _xmluiSelectValue(self, value):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
142 self.value = value
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
143
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
144 def _xmluiSelectValues(self, values):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
145 self.values = values
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
146
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
147 def _xmluiGetSelectedValues(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
148 return self.values
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
149
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
150 @property
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
151 def labels(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
152 """return only labels from self.items"""
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
153 for value, label in self.items:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
154 yield label
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
155
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
156 @property
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
157 def items(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
158 """return suitable items, according to style"""
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
159 no_select = self.no_select
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
160 for value,label in self.options:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
161 if no_select or value in self.selected:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
162 yield value,label
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
163
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
164 @property
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
165 def inline(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
166 return u'inline' in self.style
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
167
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
168 @property
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
169 def no_select(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
170 return u'noselect' in self.style
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
171
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
172
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
173 class EmptyWidget(xmlui_manager.EmptyWidget, Widget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
174
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
175 def __init__(self, _xmlui_parent):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
176 Widget.__init__(self)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
177
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
178
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
179 class TextWidget(xmlui_manager.TextWidget, ValueWidget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
180 type = u"text"
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
181
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
182 def show(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
183 self.host.disp(self.value)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
184
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
185
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
186 class LabelWidget(xmlui_manager.LabelWidget, ValueWidget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
187 type = u"label"
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
188
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
189 @property
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
190 def for_name(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
191 try:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
192 return self._xmlui_for_name
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
193 except AttributeError:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
194 return None
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
195
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
196 def show(self, no_lf=False, ansi=u''):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
197 """show label
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
198
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
199 @param no_lf(bool): same as for [JP.disp]
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
200 @param ansi(unicode): ansi escape code to print before label
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
201 """
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
202 self.disp(A.color(ansi, self.value), no_lf=no_lf)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
203
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
204
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
205 class StringWidget(xmlui_manager.StringWidget, InputWidget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
206 type = u"string"
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
207
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
208 def show(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
209 if self.read_only:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
210 self.disp(self.value)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
211 else:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
212 elems = []
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
213 self.verboseName(elems)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
214 if self.value:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
215 elems.append(_(u'(enter: {default})').format(default=self.value))
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
216 elems.extend([C.A_HEADER, u'> '])
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
217 value = raw_input(A.color(*elems))
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
218 if value:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
219 # TODO: empty value should be possible
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
220 # an escape key should be used for default instead of enter with empty value
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
221 self.value = value
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
222
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
223
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
224
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
225 class JidInputWidget(xmlui_manager.JidInputWidget, StringWidget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
226 type = u'jid_input'
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
227
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
228
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
229 class TextBoxWidget(xmlui_manager.TextWidget, StringWidget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
230 type = u"textbox"
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
231
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
232
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
233 class ListWidget(xmlui_manager.ListWidget, OptionsWidget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
234 type = u'list'
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
235 # TODO: handle flags, notably multi
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
236
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
237 def show(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
238 if not self.options:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
239 return
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
240
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
241 # list display
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
242 self.verboseName()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
243
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
244 for idx, (value, label) in enumerate(self.options):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
245 elems = []
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
246 if not self.root.readonly:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
247 elems.extend([C.A_SUBHEADER, unicode(idx), A.RESET, u': '])
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
248 elems.append(label)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
249 self.verboseName(elems, value)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
250 self.disp(A.color(*elems))
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
251
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
252 if self.root.readonly:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
253 return
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
254
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
255 if len(self.options) == 1:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
256 # we have only one option, no need to ask
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
257 self.value = self.options[0][0]
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
258 return
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
259
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
260 # we ask use to choose an option
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
261 choice = None
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
262 limit_max = len(self.options)-1
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
263 while choice is None or choice<0 or choice>limit_max:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
264 choice = raw_input(A.color(C.A_HEADER, _(u'your choice (0-{max}): ').format(max=limit_max)))
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
265 try:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
266 choice = int(choice)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
267 except ValueError:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
268 choice = None
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
269 self.value = self.options[choice][0]
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
270 self.disp('')
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
271
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
272
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
273 class BoolWidget(xmlui_manager.BoolWidget, InputWidget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
274 type = u'bool'
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
275
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
276 def show(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
277 disp_true = A.color(A.FG_GREEN, u'TRUE')
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
278 disp_false = A.color(A.FG_RED,u'FALSE')
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
279 if self.read_only:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
280 self.disp(disp_true if self.value else disp_false)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
281 else:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
282 self.disp(A.color(C.A_HEADER, u'0: ', disp_false))
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
283 self.disp(A.color(C.A_HEADER, u'1: ', disp_true))
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
284 choice = None
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
285 while choice not in ('0', '1'):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
286 elems = [C.A_HEADER, _(u'your choice (0,1): ')]
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
287 self.verboseName(elems)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
288 choice = raw_input(A.color(*elems))
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
289 self.value = bool(int(choice))
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
290 self.disp('')
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
291
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
292 def _xmluiGetValue(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
293 return C.boolConst(self.value)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
294
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
295 ## Containers ##
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
296
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
297 class Container(Base):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
298 category = u'container'
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
299
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
300 def __init__(self, xmlui_parent):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
301 super(Container, self).__init__(xmlui_parent)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
302 self.children = []
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
303
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
304 def __iter__(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
305 return iter(self.children)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
306
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
307 def _xmluiAppend(self, widget):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
308 self.children.append(widget)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
309
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
310 def show(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
311 for child in self.children:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
312 child.show()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
313
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
314
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
315 class VerticalContainer(xmlui_manager.VerticalContainer, Container):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
316 type = u'vertical'
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
317
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
318
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
319 class PairsContainer(xmlui_manager.PairsContainer, Container):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
320 type = u'pairs'
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
321
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
322
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
323 class LabelContainer(xmlui_manager.PairsContainer, Container):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
324 type = u'label'
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
325
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
326 def show(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
327 for child in self.children:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
328 no_lf = False
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
329 # we check linked widget type
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
330 # to see if we want the label on the same line or not
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
331 if child.type == u'label':
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
332 for_name = child.for_name
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
333 if for_name is not None:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
334 for_widget = self.root.widgets[for_name]
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
335 wid_type = for_widget.type
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
336 if wid_type in ('text', 'string', 'jid_input'):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
337 no_lf = True
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
338 elif wid_type == 'bool' and for_widget.read_only:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
339 no_lf = True
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
340 child.show(no_lf=no_lf, ansi=A.FG_CYAN)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
341 else:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
342 child.show()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
343
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
344 ## Dialogs ##
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
345
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
346
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
347 class Dialog(object):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
348
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
349 def __init__(self, xmlui_parent):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
350 self.xmlui_parent = xmlui_parent
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
351 self.host = self.xmlui_parent.host
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
352
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
353 def disp(self, *args, **kwargs):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
354 self.host.disp(*args, **kwargs)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
355
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
356 def show(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
357 """display current dialog
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
358
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
359 must be overriden by subclasses
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
360 """
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
361 raise NotImplementedError(self.__class__)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
362
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
363
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
364 class NoteDialog(xmlui_manager.NoteDialog, Dialog):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
365
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
366 def show(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
367 # TODO: handle title and level
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
368 self.disp(self.message)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
369
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
370 def __init__(self, _xmlui_parent, title, message, level):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
371 Dialog.__init__(self, _xmlui_parent)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
372 xmlui_manager.NoteDialog.__init__(self, _xmlui_parent)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
373 self.title, self.message, self.level = title, message, level
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
374
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
375 ## Factory ##
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
376
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
377
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
378 class WidgetFactory(object):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
379
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
380 def __getattr__(self, attr):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
381 if attr.startswith("create"):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
382 cls = globals()[attr[6:]]
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
383 return cls
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
384
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
385
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
386 class XMLUIPanel(xmlui_manager.XMLUIPanel):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
387 widget_factory = WidgetFactory()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
388 _actions = 0 # use to keep track of bridge's launchAction calls
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
389 readonly = False
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
390 workflow = None
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
391 _submit_cb = None
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
392
2419
c38c54c47e16 frontends (xmlui): added an attribute to ignore some widgets (and their label) in create
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
393 def __init__(self, host, parsed_dom, title=None, flags=None, callback=None, ignore=None, profile=None):
c38c54c47e16 frontends (xmlui): added an attribute to ignore some widgets (and their label) in create
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
394 xmlui_manager.XMLUIPanel.__init__(self,
c38c54c47e16 frontends (xmlui): added an attribute to ignore some widgets (and their label) in create
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
395 host,
c38c54c47e16 frontends (xmlui): added an attribute to ignore some widgets (and their label) in create
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
396 parsed_dom,
c38c54c47e16 frontends (xmlui): added an attribute to ignore some widgets (and their label) in create
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
397 title = title,
c38c54c47e16 frontends (xmlui): added an attribute to ignore some widgets (and their label) in create
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
398 flags = flags,
c38c54c47e16 frontends (xmlui): added an attribute to ignore some widgets (and their label) in create
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
399 ignore = ignore,
c38c54c47e16 frontends (xmlui): added an attribute to ignore some widgets (and their label) in create
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
400 profile=host.profile)
2408
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
401 self.submitted = False
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
402
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
403 @property
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
404 def command(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
405 return self.host.command
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
406
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
407 def show(self, workflow=None):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
408 """display the panel
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
409
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
410 @param workflow(list, None): command to execute if not None
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
411 put here for convenience, the main workflow is the class attribute
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
412 (because workflow can continue in subclasses)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
413 command are a list of consts or lists:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
414 - SUBMIT is the only constant so far, it submits the XMLUI
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
415 - list must contain widget name/widget value to fill
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
416 """
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
417 if workflow:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
418 XMLUIPanel.workflow = workflow
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
419 if XMLUIPanel.workflow:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
420 self.runWorkflow()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
421 else:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
422 self.main_cont.show()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
423
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
424 def runWorkflow(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
425 """loop into workflow commands and execute commands
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
426
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
427 SUBMIT will interrupt workflow (which will be continue on callback)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
428 @param workflow(list): same as [show]
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
429 """
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
430 workflow = XMLUIPanel.workflow
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
431 while True:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
432 try:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
433 cmd = workflow.pop(0)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
434 except IndexError:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
435 break
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
436 if cmd == SUBMIT:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
437 self.onFormSubmitted()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
438 self.submit_id = None # avoid double submit
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
439 return
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
440 elif isinstance(cmd, list):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
441 name, value = cmd
2412
7641bef56dcd jp (xmlui): fixed workflow when value is for a BoolWidget
Goffi <goffi@goffi.org>
parents: 2410
diff changeset
442 widget = self.widgets[name]
7641bef56dcd jp (xmlui): fixed workflow when value is for a BoolWidget
Goffi <goffi@goffi.org>
parents: 2410
diff changeset
443 if widget.type == 'bool':
7641bef56dcd jp (xmlui): fixed workflow when value is for a BoolWidget
Goffi <goffi@goffi.org>
parents: 2410
diff changeset
444 value = C.bool(value)
7641bef56dcd jp (xmlui): fixed workflow when value is for a BoolWidget
Goffi <goffi@goffi.org>
parents: 2410
diff changeset
445 widget.value = value
2408
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
446 self.show()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
447
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
448 def submitForm(self, callback=None):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
449 XMLUIPanel._submit_cb = callback
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
450 self.onFormSubmitted()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
451
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
452 def onFormSubmitted(self, ignore=None):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
453 # self.submitted is a Q&D workaround to avoid
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
454 # double submit when a workflow is set
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
455 if self.submitted:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
456 return
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
457 self.submitted = True
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
458 super(XMLUIPanel, self).onFormSubmitted(ignore)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
459
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
460 def _xmluiClose(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
461 pass
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
462
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
463 def _launchActionCb(self, data):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
464 XMLUIPanel._actions -= 1
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
465 assert XMLUIPanel._actions >= 0
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
466 if u'xmlui' in data:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
467 xmlui_raw = data['xmlui']
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
468 xmlui = xmlui_manager.create(self.host, xmlui_raw)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
469 xmlui.show()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
470 if xmlui.submit_id:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
471 xmlui.onFormSubmitted()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
472 # TODO: handle data other than XMLUI
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
473 if not XMLUIPanel._actions:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
474 if self._submit_cb is None:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
475 self.host.quit()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
476 else:
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
477 self._submit_cb()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
478
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
479 def _xmluiLaunchAction(self, action_id, data):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
480 XMLUIPanel._actions += 1
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
481 self.host.bridge.launchAction(
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
482 action_id,
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
483 data,
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
484 self.profile,
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
485 callback=self._launchActionCb,
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
486 errback=partial(self.command.errback,
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
487 msg=_(u"can't launch XMLUI action: {}"),
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
488 exit_code=C.EXIT_BRIDGE_ERRBACK))
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
489
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
490
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
491 class XMLUIDialog(xmlui_manager.XMLUIDialog):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
492 type = 'dialog'
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
493 dialog_factory = WidgetFactory()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
494 readonly = False
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
495
2410
40e6e779a253 jp (xmlui): XMLUIDialog.show has now a dummy argument, so workflow arguments can be put there
Goffi <goffi@goffi.org>
parents: 2408
diff changeset
496 def show(self, dummy=None):
2408
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
497 self.dlg.show()
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
498
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
499 def _xmluiClose(self):
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
500 pass
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
501
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
502
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
503 xmlui_manager.registerClass(xmlui_manager.CLASS_PANEL, XMLUIPanel)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
504 xmlui_manager.registerClass(xmlui_manager.CLASS_DIALOG, XMLUIDialog)
a870daeab15e jp: XMLUI implementation first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
505 create = xmlui_manager.create