Mercurial > libervia-backend
annotate frontends/src/wix/xmlui.py @ 1188:bf2927e6a0f5
frontends (dbus): error is not truncated anymore if it's not a SàT error.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 08 Sep 2014 21:23:21 +0200 |
parents | e2e1e27a3680 |
children | f91e7028e2c3 |
rev | line source |
---|---|
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/python |
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
4 # wix: a SAT frontend |
811 | 5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jérôme Poisson (goffi@goffi.org) |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
10 # (at your option) any later version. |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
15 # GNU Affero General Public License for more details. |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 |
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 |
771 | 22 from sat.core.i18n import _ |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 import wx |
1011 | 24 from sat.core.log import getLogger |
25 log = getLogger(__name__) | |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
26 from sat_frontends.tools import xmlui |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
27 from sat_frontends.constants import Const as C |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
29 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
30 class EventWidget(object): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
31 """ Used to manage change event of widgets """ |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
32 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
33 def _xmluiOnChange(self, callback): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
34 """ Call callback with widget as only argument """ |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
35 def change_cb(event): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
36 callback(self) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
37 self.Bind(self._xmlui_change_event, change_cb) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
38 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
39 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
40 class WixWidget(object): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
41 _xmlui_proportion = 0 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
42 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
43 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
44 class ValueWidget(WixWidget): |
976
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
45 |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
46 def _xmluiSetValue(self, value): |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
47 self.SetValue(value) |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
48 |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
49 def _xmluiGetValue(self): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
50 return self.GetValue() |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
51 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
52 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
53 class EmptyWidget(WixWidget, xmlui.EmptyWidget, wx.Window): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
54 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
55 def __init__(self, _xmlui_parent): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
56 wx.Window.__init__(self, _xmlui_parent, -1) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
57 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
58 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
59 class TextWidget(WixWidget, xmlui.TextWidget, wx.StaticText): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
60 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
61 def __init__(self, _xmlui_parent, value): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
62 wx.StaticText.__init__(self, _xmlui_parent, -1, value) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
63 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
64 |
804
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
65 class LabelWidget(xmlui.LabelWidget, TextWidget): |
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
66 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
67 def __init__(self, _xmlui_parent, value): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
68 super(LabelWidget, self).__init__(_xmlui_parent, value+": ") |
804
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
69 |
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
70 |
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
71 class JidWidget(xmlui.JidWidget, TextWidget): |
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
72 pass |
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
73 |
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
74 |
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
75 class DividerWidget(WixWidget, xmlui.DividerWidget, wx.StaticLine): |
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
76 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
77 def __init__(self, _xmlui_parent, style='line'): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
78 wx.StaticLine.__init__(self, _xmlui_parent, -1) |
804
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
79 |
5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
Goffi <goffi@goffi.org>
parents:
803
diff
changeset
|
80 |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
81 class StringWidget(EventWidget, ValueWidget, xmlui.StringWidget, wx.TextCtrl): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
82 _xmlui_change_event = wx.EVT_TEXT |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
83 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
84 def __init__(self, _xmlui_parent, value, read_only=False): |
1085
7a39ae3950f7
frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
Goffi <goffi@goffi.org>
parents:
1011
diff
changeset
|
85 style = wx.TE_READONLY if read_only else 0 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
86 wx.TextCtrl.__init__(self, _xmlui_parent, -1, value, style=style) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
87 self._xmlui_proportion = 1 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
88 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
89 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
90 class PasswordWidget(EventWidget, ValueWidget, xmlui.PasswordWidget, wx.TextCtrl): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
91 _xmlui_change_event = wx.EVT_TEXT |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
92 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
93 def __init__(self, _xmlui_parent, value, read_only=False): |
1085
7a39ae3950f7
frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
Goffi <goffi@goffi.org>
parents:
1011
diff
changeset
|
94 style = wx.TE_PASSWORD |
7a39ae3950f7
frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
Goffi <goffi@goffi.org>
parents:
1011
diff
changeset
|
95 if read_only: |
7a39ae3950f7
frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
Goffi <goffi@goffi.org>
parents:
1011
diff
changeset
|
96 style |= wx.TE_READONLY |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
97 wx.TextCtrl.__init__(self, _xmlui_parent, -1, value, style=style) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
98 self._xmlui_proportion = 1 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
99 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
100 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
101 class TextBoxWidget(EventWidget, ValueWidget, xmlui.TextBoxWidget, wx.TextCtrl): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
102 _xmlui_change_event = wx.EVT_TEXT |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
103 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
104 def __init__(self, _xmlui_parent, value, read_only=False): |
1085
7a39ae3950f7
frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
Goffi <goffi@goffi.org>
parents:
1011
diff
changeset
|
105 style = wx.TE_MULTILINE |
7a39ae3950f7
frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
Goffi <goffi@goffi.org>
parents:
1011
diff
changeset
|
106 if read_only: |
7a39ae3950f7
frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
Goffi <goffi@goffi.org>
parents:
1011
diff
changeset
|
107 style |= wx.TE_READONLY |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
108 wx.TextCtrl.__init__(self, _xmlui_parent, -1, value, style=style) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
109 self._xmlui_proportion = 1 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
110 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
111 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
112 class BoolWidget(EventWidget, ValueWidget, xmlui.BoolWidget, wx.CheckBox): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
113 _xmlui_change_event = wx.EVT_CHECKBOX |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
114 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
115 def __init__(self, _xmlui_parent, state, read_only=False): |
1085
7a39ae3950f7
frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
Goffi <goffi@goffi.org>
parents:
1011
diff
changeset
|
116 style = wx.CHK_2STATE |
7a39ae3950f7
frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
Goffi <goffi@goffi.org>
parents:
1011
diff
changeset
|
117 if read_only: |
7a39ae3950f7
frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
Goffi <goffi@goffi.org>
parents:
1011
diff
changeset
|
118 style |= wx.TE_READONLY |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
119 wx.CheckBox.__init__(self, _xmlui_parent, -1, "", style=wx.CHK_2STATE) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
120 self.SetValue(state) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
121 self._xmlui_proportion = 1 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
122 |
976
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
123 def _xmluiSetValue(self, value): |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
124 self.SetValue(value == 'true') |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
125 |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
126 def _xmluiGetValue(self): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
127 return "true" if self.GetValue() else "false" |
762
aed7d99276b8
core (xml_tools), frontends: added a prefix to XMLUI form names in result data, to avoid name conflicts (e.g.: if a form has name "submit", and this name is also used internally by SàT)
Goffi <goffi@goffi.org>
parents:
760
diff
changeset
|
128 |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
129 |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
130 class ButtonWidget(EventWidget, WixWidget, xmlui.ButtonWidget, wx.Button): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
131 _xmlui_change_event = wx.EVT_BUTTON |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
132 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
133 def __init__(self, _xmlui_parent, value, click_callback): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
134 wx.Button.__init__(self, _xmlui_parent, -1, value) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
135 self._xmlui_click_callback = click_callback |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
136 _xmlui_parent.Bind(wx.EVT_BUTTON, lambda evt: click_callback(evt.GetEventObject()), self) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
137 self._xmlui_parent = _xmlui_parent |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
138 |
976
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
139 def _xmluiOnClick(self, callback): |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
140 self._xmlui_parent.Bind(wx.EVT_BUTTON, lambda evt: callback(evt.GetEventObject()), self) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
141 |
968
75f3b3b430ff
tools, frontends, memory: param definition and XMLUI handle multi-selection for list widgets:
souliane <souliane@mailoo.org>
parents:
865
diff
changeset
|
142 |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
143 class ListWidget(EventWidget, WixWidget, xmlui.ListWidget, wx.ListBox): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
144 _xmlui_change_event = wx.EVT_LISTBOX |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
145 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
146 def __init__(self, _xmlui_parent, options, selected, flags): |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
147 styles = wx.LB_MULTIPLE if not 'single' in flags else wx.LB_SINGLE |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
148 wx.ListBox.__init__(self, _xmlui_parent, -1, choices=[option[1] for option in options], style=styles) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
149 self._xmlui_attr_map = {label: value for value, label in options} |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
150 self._xmlui_proportion = 1 |
968
75f3b3b430ff
tools, frontends, memory: param definition and XMLUI handle multi-selection for list widgets:
souliane <souliane@mailoo.org>
parents:
865
diff
changeset
|
151 self._xmluiSelectValues(selected) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
152 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
153 def _xmluiSelectValue(self, value): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
154 try: |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
155 label = [label for label, _value in self._xmlui_attr_map.items() if _value == value][0] |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
156 except IndexError: |
1011 | 157 log.warning(_("Can't find value [%s] to select" % value)) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
158 return |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
159 for idx in xrange(self.GetCount()): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
160 self.SetSelection(idx, self.GetString(idx) == label) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
161 |
968
75f3b3b430ff
tools, frontends, memory: param definition and XMLUI handle multi-selection for list widgets:
souliane <souliane@mailoo.org>
parents:
865
diff
changeset
|
162 def _xmluiSelectValues(self, values): |
976
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
163 labels = [label for label, _value in self._xmlui_attr_map.items() if _value in values] |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
164 for idx in xrange(self.GetCount()): |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
165 self.SetSelection(idx, self.GetString(idx) in labels) |
968
75f3b3b430ff
tools, frontends, memory: param definition and XMLUI handle multi-selection for list widgets:
souliane <souliane@mailoo.org>
parents:
865
diff
changeset
|
166 |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
167 def _xmluiGetSelectedValues(self): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
168 ret = [] |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
169 labels = [self.GetString(idx) for idx in self.GetSelections()] |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
170 for label in labels: |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
171 ret.append(self._xmlui_attr_map[label]) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
172 return ret |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
173 |
976
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
174 def _xmluiAddValues(self, values, select=True): |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
175 selected = self._xmluiGetSelectedValues() |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
176 for value in values: |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
177 if value not in self._xmlui_attr_map.values(): |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
178 wx.ListBox.Append(self, value) |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
179 self._xmlui_attr_map[value] = value |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
180 if value not in selected: |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
181 selected.append(value) |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
182 self._xmluiSelectValues(selected) |
68faf7d77a42
frontends (xmlui): add setter methods + fixes:
souliane <souliane@mailoo.org>
parents:
975
diff
changeset
|
183 |
91 | 184 |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
185 class WixContainer(object): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
186 _xmlui_proportion = 1 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
187 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
188 def _xmluiAppend(self, widget): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
189 self.sizer.Add(widget, self._xmlui_proportion, flag=wx.EXPAND) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
190 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
191 |
805
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
192 class AdvancedListContainer(WixContainer, xmlui.AdvancedListContainer, wx.ScrolledWindow): |
803
f100fd8d279f
core, frontends: implementation of AdvancedListContainer first draft + misc:
Goffi <goffi@goffi.org>
parents:
802
diff
changeset
|
193 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
194 def __init__(self, _xmlui_parent, columns, selectable='no'): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
195 wx.ScrolledWindow.__init__(self, _xmlui_parent) |
805
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
196 self._xmlui_selectable = selectable != 'no' |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
197 if selectable: |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
198 columns += 1 |
803
f100fd8d279f
core, frontends: implementation of AdvancedListContainer first draft + misc:
Goffi <goffi@goffi.org>
parents:
802
diff
changeset
|
199 self.sizer = wx.FlexGridSizer(cols=columns) |
f100fd8d279f
core, frontends: implementation of AdvancedListContainer first draft + misc:
Goffi <goffi@goffi.org>
parents:
802
diff
changeset
|
200 self.SetSizer(self.sizer) |
805
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
201 self._xmlui_select_cb = None |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
202 self._xmlui_select_idx = None |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
203 self._xmlui_select_widgets = [] |
803
f100fd8d279f
core, frontends: implementation of AdvancedListContainer first draft + misc:
Goffi <goffi@goffi.org>
parents:
802
diff
changeset
|
204 |
805
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
205 def _xmluiAddRow(self, idx): |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
206 # XXX: select_button is a Q&D way to implement row selection |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
207 # FIXME: must be done properly |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
208 if not self._xmlui_selectable: |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
209 return |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
210 select_button = wx.Button(self, wx.ID_OK, label=_("select")) |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
211 self.sizer.Add(select_button) |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
212 def click_cb(event, idx=idx): |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
213 cb = self._xmlui_select_cb |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
214 self._xmlui_select_idx = idx |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
215 # TODO: fill self._xmlui_select_widgets |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
216 if cb is not None: |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
217 cb(self) |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
218 event.Skip() |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
219 self.Bind(wx.EVT_BUTTON, click_cb) |
803
f100fd8d279f
core, frontends: implementation of AdvancedListContainer first draft + misc:
Goffi <goffi@goffi.org>
parents:
802
diff
changeset
|
220 |
805
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
221 def _xmluiGetSelectedWidgets(self): |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
222 return self._xmlui_select_widgets |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
223 |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
224 def _xmluiGetSelectedIndex(self): |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
225 return self._xmlui_select_idx |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
226 |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
227 def _xmluiOnSelect(self, callback): |
7c05c39156a2
core (XMLUI), frontends: advancedListContainer part 2:
Goffi <goffi@goffi.org>
parents:
804
diff
changeset
|
228 self._xmlui_select_cb = callback |
803
f100fd8d279f
core, frontends: implementation of AdvancedListContainer first draft + misc:
Goffi <goffi@goffi.org>
parents:
802
diff
changeset
|
229 |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
230 class PairsContainer(WixContainer, xmlui.PairsContainer, wx.Panel): |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
231 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
232 def __init__(self, _xmlui_parent): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
233 wx.Panel.__init__(self, _xmlui_parent) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
234 self.sizer = wx.FlexGridSizer(cols=2) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
235 self.sizer.AddGrowableCol(1) #The growable column need most of time to be the right one in pairs |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
236 self.SetSizer(self.sizer) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
237 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
238 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
239 class TabsContainer(WixContainer, xmlui.TabsContainer, wx.Notebook): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
240 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
241 def __init__(self, _xmlui_parent): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
242 wx.Notebook.__init__(self, _xmlui_parent, -1, style=wx.NB_LEFT if self._xmlui_main.type=='param' else 0) |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
243 |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
244 def _xmluiAddTab(self, label): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
245 tab_panel = wx.Panel(self, -1) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
246 tab_panel.sizer = wx.BoxSizer(wx.VERTICAL) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
247 tab_panel.SetSizer(tab_panel.sizer) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
248 self.AddPage(tab_panel, label) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
249 VerticalContainer._xmluiAdapt(tab_panel) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
250 return tab_panel |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
251 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
252 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
253 class VerticalContainer(WixContainer, xmlui.VerticalContainer, wx.Panel): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
254 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
255 def __init__(self, _xmlui_parent): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
256 wx.Panel.__init__(self, _xmlui_parent) |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
257 self.sizer = wx.BoxSizer(wx.VERTICAL) |
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
258 self.SetSizer(self.sizer) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
259 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
260 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
261 ## Dialogs ## |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
262 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
263 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
264 class WixDialog(object): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
265 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
266 def __init__(self, _xmlui_parent, level): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
267 self.host = _xmlui_parent.host |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
268 self.ok_cb = None |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
269 self.cancel_cb = None |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
270 if level == C.XMLUI_DATA_LVL_INFO: |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
271 self.flags = wx.ICON_INFORMATION |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
272 elif level == C.XMLUI_DATA_LVL_ERROR: |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
273 self.flags = wx.ICON_ERROR |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
274 else: |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
275 self.flags = wx.ICON_INFORMATION |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
276 log.warning(_("Unmanaged dialog level: %s") % level) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
277 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
278 def _xmluiShow(self): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
279 answer = self.ShowModal() |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
280 if answer == wx.ID_YES or answer == wx.ID_OK: |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
281 self._xmluiValidated() |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
282 else: |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
283 self._xmluiCancelled() |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
284 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
285 def _xmluiClose(self): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
286 self.Destroy() |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
287 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
288 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
289 class MessageDialog(WixDialog, xmlui.MessageDialog, wx.MessageDialog): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
290 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
291 def __init__(self, _xmlui_parent, title, message, level): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
292 WixDialog.__init__(self, _xmlui_parent, level) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
293 xmlui.MessageDialog.__init__(self, _xmlui_parent) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
294 self.flags |= wx.OK |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
295 wx.MessageDialog.__init__(self, _xmlui_parent.host, message, title, style = self.flags) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
296 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
297 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
298 class NoteDialog(xmlui.NoteDialog, MessageDialog): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
299 # TODO: separate NoteDialog |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
300 pass |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
301 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
302 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
303 class ConfirmDialog(WixDialog, xmlui.ConfirmDialog, wx.MessageDialog): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
304 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
305 def __init__(self, _xmlui_parent, title, message, level, buttons_set): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
306 WixDialog.__init__(self, _xmlui_parent, level) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
307 xmlui.ConfirmDialog.__init__(self, _xmlui_parent) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
308 if buttons_set == C.XMLUI_DATA_BTNS_SET_YESNO: |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
309 self.flags |= wx.YES_NO |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
310 else: |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
311 self.flags |= wx.OK | wx.CANCEL |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
312 wx.MessageDialog.__init__(self, _xmlui_parent.host, message, title, style = self.flags) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
313 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
314 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
315 class FileDialog(WixDialog, xmlui.FileDialog, wx.FileDialog): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
316 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
317 def __init__(self, _xmlui_parent, title, message, level, filetype): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
318 # TODO: message and filetype are not managed yet |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
319 WixDialog.__init__(self, _xmlui_parent, level) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
320 self.flags = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT # FIXME: use the legacy flags, but must manage cases like dir or open |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
321 xmlui.FileDialog.__init__(self, _xmlui_parent) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
322 wx.FileDialog.__init__(self, _xmlui_parent.host, title, style = self.flags) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
323 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
324 def _xmluiShow(self): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
325 answer = self.ShowModal() |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
326 if answer == wx.ID_OK: |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
327 self._xmluiValidated({'path': self.GetPath()}) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
328 else: |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
329 self._xmluiCancelled() |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
330 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
331 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
332 class GenericFactory(object): |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
333 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
334 def __getattr__(self, attr): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
335 if attr.startswith("create"): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
336 cls = globals()[attr[6:]] |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
337 return cls |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
338 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
339 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
340 class WidgetFactory(GenericFactory): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
341 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
342 def __getattr__(self, attr): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
343 if attr.startswith("create"): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
344 cls = GenericFactory.__getattr__(self, attr) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
345 cls._xmlui_main = self._xmlui_main |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
346 return cls |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
347 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
348 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
349 class XMLUIPanel(xmlui.XMLUIPanel, wx.Frame): |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
350 """Create an user interface from a SàT XML""" |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
351 widget_factory = WidgetFactory() |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
352 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
353 def __init__(self, host, parsed_xml, title=None, flags = None,): |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
354 self.widget_factory._xmlui_main = self |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
355 xmlui.XMLUIPanel.__init__(self, host, parsed_xml, title, flags) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
356 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
357 def constructUI(self, parsed_dom): |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
358 style = wx.DEFAULT_FRAME_STYLE & ~wx.CLOSE_BOX if 'NO_CANCEL' in self.flags else wx.DEFAULT_FRAME_STYLE |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
359 wx.Frame.__init__(self, None, style=style) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
360 self.sizer = wx.BoxSizer(wx.VERTICAL) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
361 self.SetSizer(self.sizer) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
362 |
802
9007bb133009
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
796
diff
changeset
|
363 def postTreat(): |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
364 if self.title: |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
365 self.SetTitle(self.title) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
366 |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
367 if self.type == 'form': |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
368 dialogButtons = wx.StdDialogButtonSizer() |
802
9007bb133009
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
796
diff
changeset
|
369 submitButton = wx.Button(self.main_cont,wx.ID_OK, label=_("Submit")) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
370 dialogButtons.AddButton(submitButton) |
802
9007bb133009
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
796
diff
changeset
|
371 self.main_cont.Bind(wx.EVT_BUTTON, self.onFormSubmitted, submitButton) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
372 if not 'NO_CANCEL' in self.flags: |
802
9007bb133009
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
796
diff
changeset
|
373 cancelButton = wx.Button(self.main_cont,wx.ID_CANCEL) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
374 dialogButtons.AddButton(cancelButton) |
802
9007bb133009
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
796
diff
changeset
|
375 self.main_cont.Bind(wx.EVT_BUTTON, self.onFormCancelled, cancelButton) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
376 dialogButtons.Realize() |
802
9007bb133009
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
796
diff
changeset
|
377 self.main_cont.sizer.Add(dialogButtons, flag=wx.ALIGN_CENTER_HORIZONTAL) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
378 |
802
9007bb133009
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
796
diff
changeset
|
379 self.sizer.Add(self.main_cont, 1, flag=wx.EXPAND) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
380 self.sizer.Fit(self) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
381 self.Show() |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
382 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
383 super(XMLUIPanel, self).constructUI(parsed_dom, postTreat) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
384 if not 'NO_CANCEL' in self.flags: |
91 | 385 self.Bind(wx.EVT_CLOSE, self.onClose, self) |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
386 self.MakeModal() |
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
387 |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
388 def _xmluiClose(self): |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
389 self.MakeModal(False) |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
390 self.Destroy() |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
391 |
106 | 392 ###events |
393 | |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
394 def onParamChange(self, ctrl): |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
395 super(XMLUIPanel, self).onParamChange(ctrl) |
106 | 396 |
36 | 397 def onFormSubmitted(self, event): |
398 """Called when submit button is clicked""" | |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
399 button = event.GetEventObject() |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
400 super(XMLUIPanel, self).onFormSubmitted(button) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
401 |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
402 def onClose(self, event): |
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
403 """Close event: we have to send the form.""" |
1011 | 404 log.debug(_("close")) |
796
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
405 if self.type == 'param': |
46aa5ada61bf
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
771
diff
changeset
|
406 self.onSaveParams() |
802
9007bb133009
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
796
diff
changeset
|
407 else: |
9007bb133009
core, frontends: XMLUI refactoring:
Goffi <goffi@goffi.org>
parents:
796
diff
changeset
|
408 self._xmluiClose() |
35
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
409 event.Skip() |
c45deebb40a5
Wix: Registration form management (not finished yet)
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
410 |
1106
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
411 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
412 class XMLUIDialog(xmlui.XMLUIDialog): |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
413 dialog_factory = WidgetFactory() |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
414 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
415 |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
416 xmlui.registerClass(xmlui.CLASS_PANEL, XMLUIPanel) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
417 xmlui.registerClass(xmlui.CLASS_DIALOG, XMLUIDialog) |
e2e1e27a3680
frontends: XMLUI refactoring + dialogs:
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
418 create = xmlui.create |