Mercurial > libervia-desktop-kivy
annotate libervia/desktop_kivy/core/dialog.py @ 508:d87b9a6b0b69
doc (calls): updated documentation to describe the new UI features:
fix 425
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 25 Oct 2023 15:29:33 +0200 |
parents | b3cedbee561d |
children |
rev | line source |
---|---|
203
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr//bin/env python2 |
379 | 2 |
203
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
493
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
4 #Libervia Desktop-Kivy |
461 | 5 # Copyright (C) 2016-2021 Jérôme Poisson (goffi@goffi.org) |
203
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # GNU Affero General Public License for more details. |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 """generic dialogs""" |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 |
493
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
22 from libervia.backend.core.i18n import _ |
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
23 from libervia.desktop_kivy.core.constants import Const as C |
203
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 from kivy.uix.boxlayout import BoxLayout |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 from kivy import properties |
493
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
26 from libervia.backend.core import log as logging |
203
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 log = logging.getLogger(__name__) |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 |
243 | 31 class MessageDialog(BoxLayout): |
32 title = properties.StringProperty() | |
33 message = properties.StringProperty() | |
34 level = properties.OptionProperty(C.XMLUI_DATA_LVL_INFO, options=C.XMLUI_DATA_LVLS) | |
35 close_cb = properties.ObjectProperty() | |
36 | |
37 | |
203
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 class ConfirmDialog(BoxLayout): |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 title = properties.StringProperty() |
312 | 40 message = properties.StringProperty(_("Are you sure?")) |
203
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 # callback for no/cancel |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 no_cb = properties.ObjectProperty() |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 # callback for yes/ok |
dbd2274fc78b
core: new core.dialog module with a ConfirmDialog
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 yes_cb = properties.ObjectProperty() |