comparison libervia/frontends/quick_frontend/constants.py @ 4074:26b7ed2817da

refactoring: rename `sat_frontends` to `libervia.frontends`
author Goffi <goffi@goffi.org>
date Fri, 02 Jun 2023 14:12:38 +0200
parents sat_frontends/quick_frontend/constants.py@4b842c1fb686
children
comparison
equal deleted inserted replaced
4073:7c5654c54fed 4074:26b7ed2817da
1 #!/usr/bin/env python3
2
3
4 # Primitivus: a SAT frontend
5 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
6
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
16
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 from libervia.backend.core import constants
21 from libervia.backend.core.i18n import _
22 from collections import OrderedDict # only available from python 2.7
23
24
25 class Const(constants.Const):
26
27 PRESENCE = OrderedDict(
28 [
29 ("", _("Online")),
30 ("chat", _("Free for chat")),
31 ("away", _("Away from keyboard")),
32 ("dnd", _("Do not disturb")),
33 ("xa", _("Extended away")),
34 ]
35 )
36
37 # from plugin_misc_text_syntaxes
38 SYNTAX_XHTML = "XHTML"
39 SYNTAX_CURRENT = "@CURRENT@"
40 SYNTAX_TEXT = "text"
41
42 # XMLUI
43 SAT_FORM_PREFIX = "SAT_FORM_"
44 SAT_PARAM_SEPARATOR = "_XMLUI_PARAM_" # used to have unique elements names
45 XMLUI_STATUS_VALIDATED = "validated"
46 XMLUI_STATUS_CANCELLED = constants.Const.XMLUI_DATA_CANCELLED
47
48 # Roster
49 CONTACT_GROUPS = "groups"
50 CONTACT_RESOURCES = "resources"
51 CONTACT_MAIN_RESOURCE = "main_resource"
52 CONTACT_SPECIAL = "special"
53 CONTACT_SPECIAL_GROUP = "group" # group chat special entity
54 CONTACT_SELECTED = "selected"
55 # used in handler to track where the contact is coming from
56 CONTACT_PROFILE = "profile"
57 CONTACT_SPECIAL_ALLOWED = (CONTACT_SPECIAL_GROUP,) # allowed values for special flag
58 # set of forbidden names for contact data
59 CONTACT_DATA_FORBIDDEN = {
60 CONTACT_GROUPS,
61 CONTACT_RESOURCES,
62 CONTACT_MAIN_RESOURCE,
63 CONTACT_SELECTED,
64 CONTACT_PROFILE,
65 }
66
67 # Chats
68 CHAT_STATE_ICON = {
69 "": " ",
70 "active": "✔",
71 "inactive": "☄",
72 "gone": "✈",
73 "composing": "✎",
74 "paused": "…",
75 }
76
77 # Blogs
78 ENTRY_MODE_TEXT = "text"
79 ENTRY_MODE_RICH = "rich"
80 ENTRY_MODE_XHTML = "xhtml"
81
82 # Widgets management
83 # FIXME: should be in quick_frontend.constant, but Libervia doesn't inherit from it
84 WIDGET_NEW = "NEW"
85 WIDGET_KEEP = "KEEP"
86 WIDGET_RAISE = "RAISE"
87 WIDGET_RECREATE = "RECREATE"
88
89 # Updates (generic)
90 UPDATE_DELETE = "DELETE"
91 UPDATE_MODIFY = "MODIFY"
92 UPDATE_ADD = "ADD"
93 UPDATE_SELECTION = "SELECTION"
94 # high level update (i.e. not item level but organisation of items)
95 UPDATE_STRUCTURE = "STRUCTURE"
96
97 LISTENERS = {
98 "avatar",
99 "nicknames",
100 "presence",
101 "selected",
102 "notification",
103 "notificationsClear",
104 "widgetNew",
105 "widgetDeleted",
106 "profile_plugged",
107 "contactsFilled",
108 "disconnect",
109 "gotMenus",
110 "menu",
111 "progress_finished",
112 "progress_error",
113 }
114
115 # Notifications
116 NOTIFY_MESSAGE = "MESSAGE" # a message has been received
117 NOTIFY_MENTION = "MENTION" # user has been mentionned
118 NOTIFY_PROGRESS_END = "PROGRESS_END" # a progression has finised
119 NOTIFY_GENERIC = "GENERIC" # a notification which has not its own type
120 NOTIFY_ALL = (NOTIFY_MESSAGE, NOTIFY_MENTION, NOTIFY_PROGRESS_END, NOTIFY_GENERIC)