annotate sat_frontends/primitivus/constants.py @ 3595:7510648e8e3a

core (memory/sqla): methods to manipulate pubsub tables
author Goffi <goffi@goffi.org>
date Thu, 29 Jul 2021 22:51:01 +0200
parents 75427f0a5445
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3137
559a625a236b fixed shebangs
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
1 #!/usr/bin/env python3
559a625a236b fixed shebangs
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
2
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 587
diff changeset
3 # Primitivus: a SAT frontend
3479
be6d91572633 date update
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
4 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
495
a726b234d3bf primitivus: moved constants in a separate file
Goffi <goffi@goffi.org>
parents:
diff changeset
5
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 587
diff changeset
6 # 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
7 # 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
8 # 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
9 # (at your option) any later version.
495
a726b234d3bf primitivus: moved constants in a separate file
Goffi <goffi@goffi.org>
parents:
diff changeset
10
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 587
diff changeset
11 # 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
12 # 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
13 # 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
14 # GNU Affero General Public License for more details.
495
a726b234d3bf primitivus: moved constants in a separate file
Goffi <goffi@goffi.org>
parents:
diff changeset
15
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 587
diff changeset
16 # 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
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
736
6246eb6d64a0 frontends: define the constants with classes and inheritance instance of using __builtin__
souliane <souliane@mailoo.org>
parents: 609
diff changeset
18
6246eb6d64a0 frontends: define the constants with classes and inheritance instance of using __builtin__
souliane <souliane@mailoo.org>
parents: 609
diff changeset
19 from sat_frontends.quick_frontend import constants
6246eb6d64a0 frontends: define the constants with classes and inheritance instance of using __builtin__
souliane <souliane@mailoo.org>
parents: 609
diff changeset
20
6246eb6d64a0 frontends: define the constants with classes and inheritance instance of using __builtin__
souliane <souliane@mailoo.org>
parents: 609
diff changeset
21
6246eb6d64a0 frontends: define the constants with classes and inheritance instance of using __builtin__
souliane <souliane@mailoo.org>
parents: 609
diff changeset
22 class Const(constants.Const):
495
a726b234d3bf primitivus: moved constants in a separate file
Goffi <goffi@goffi.org>
parents:
diff changeset
23
3487
75427f0a5445 primivitus: updated constants following global renaming, config section is now `tui` instead of `primitivus`
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
24 APP_NAME = "Libervia TUI"
75427f0a5445 primivitus: updated constants following global renaming, config section is now `tui` instead of `primitivus`
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
25 APP_COMPONENT = "TUI"
75427f0a5445 primivitus: updated constants following global renaming, config section is now `tui` instead of `primitivus`
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
26 APP_NAME_ALT = "Primitivus"
75427f0a5445 primivitus: updated constants following global renaming, config section is now `tui` instead of `primitivus`
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
27 APP_NAME_FILE = "libervia_tui"
75427f0a5445 primivitus: updated constants following global renaming, config section is now `tui` instead of `primitivus`
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
28 CONFIG_SECTION = APP_COMPONENT.lower()
736
6246eb6d64a0 frontends: define the constants with classes and inheritance instance of using __builtin__
souliane <souliane@mailoo.org>
parents: 609
diff changeset
29 PALETTE = [
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
30 ("title", "black", "light gray", "standout,underline"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
31 ("title_focus", "white,bold", "light gray", "standout,underline"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
32 ("selected", "default", "dark red"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
33 ("selected_focus", "default,bold", "dark red"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
34 ("default", "default", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
35 ("default_focus", "default,bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
36 ("cl_notifs", "yellow", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
37 ("cl_notifs_focus", "yellow,bold", "default"),
2993
d58dccd9e4b4 primitivus (contact list): fixed notifications counter for mentions:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
38 ("cl_mention", "light red", "default"),
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
39 ("cl_mention_focus", "dark red,bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
40 # Messages
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
41 ("date", "light gray", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
42 ("my_nick", "dark red,bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
43 ("other_nick", "dark cyan,bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
44 ("info_msg", "yellow", "default", "bold"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
45 ("msg_lang", "dark cyan", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
46 ("msg_mention", "dark red, bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
47 ("msg_status_received", "light green, bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
48 ("menubar", "light gray,bold", "dark red"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
49 ("menubar_focus", "light gray,bold", "dark green"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
50 ("selected_menu", "light gray,bold", "dark green"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
51 ("menuitem", "light gray,bold", "dark red"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
52 ("menuitem_focus", "light gray,bold", "dark green"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
53 ("notifs", "black,bold", "yellow"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
54 ("notifs_focus", "dark red", "yellow"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
55 ("card_neutral", "dark gray", "white", "standout,underline"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
56 ("card_neutral_selected", "dark gray", "dark green", "standout,underline"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
57 ("card_special", "brown", "white", "standout,underline"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
58 ("card_special_selected", "brown", "dark green", "standout,underline"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
59 ("card_red", "dark red", "white", "standout,underline"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
60 ("card_red_selected", "dark red", "dark green", "standout,underline"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
61 ("card_black", "black", "white", "standout,underline"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
62 ("card_black_selected", "black", "dark green", "standout,underline"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
63 ("directory", "dark cyan, bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
64 ("directory_focus", "dark cyan, bold", "dark green"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
65 ("separator", "brown", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
66 ("warning", "light red", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
67 ("progress_normal", "default", "brown"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
68 ("progress_complete", "default", "dark green"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
69 ("show_disconnected", "dark gray", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
70 ("show_normal", "default", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
71 ("show_normal_focus", "default, bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
72 ("show_chat", "dark green", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
73 ("show_chat_focus", "dark green, bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
74 ("show_away", "brown", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
75 ("show_away_focus", "brown, bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
76 ("show_dnd", "dark red", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
77 ("show_dnd_focus", "dark red, bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
78 ("show_xa", "dark red", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
79 ("show_xa_focus", "dark red, bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
80 ("resource", "light blue", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
81 ("resource_main", "dark blue", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
82 ("status", "yellow", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
83 ("status_focus", "yellow, bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
84 ("param_selected", "default, bold", "dark red"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
85 ("table_selected", "default, bold", "default"),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
86 ]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
87 PRESENCE = {
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2993
diff changeset
88 "unavailable": ("⨯", "show_disconnected"),
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2993
diff changeset
89 "": ("✔", "show_normal"),
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2993
diff changeset
90 "chat": ("✆", "show_chat"),
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2993
diff changeset
91 "away": ("✈", "show_away"),
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2993
diff changeset
92 "dnd": ("✖", "show_dnd"),
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2993
diff changeset
93 "xa": ("☄", "show_xa"),
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
94 }
1010
73a0b7f94674 primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents: 811
diff changeset
95 LOG_OPT_SECTION = APP_NAME.lower()
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
96 LOG_OPT_OUTPUT = (
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
97 "output",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
98 constants.Const.LOG_OPT_OUTPUT_SEP + constants.Const.LOG_OPT_OUTPUT_MEMORY,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
99 )
1159
85fd02356dba primitivus: key can be changed in config:
Goffi <goffi@goffi.org>
parents: 1010
diff changeset
100 CONFIG_OPT_KEY_PREFIX = "KEY_"
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
101
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
102 MENU_ID_MAIN = "MAIN_MENU"
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
103 MENU_ID_WIDGET = "WIDGET_MENU"
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
104
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
105 MODE_NORMAL = "NORMAL"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
106 MODE_INSERTION = "INSERTION"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
107 MODE_COMMAND = "COMMAND"
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1173
diff changeset
108
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
109 GROUP_DATA_FOLDED = "folded"