Mercurial > libervia-backend
comparison frontends/src/constants.py @ 1290:faa1129559b8 frontends_multi_profiles
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
/!\ not finished, everything is still instable !
- bridge: DBus bridge has been modified to allow blocking call to be called in the same way as asynchronous calls
- bridge: calls with a callback and no errback are now possible, default errback log the error
- constants: removed hack to manage presence without OrderedDict, as an OrderedDict like class has been implemented in Libervia
- core: getLastResource has been removed and replaced by getMainResource (there is a global better management of resources)
- various style improvments: use of constants when possible, fixed variable overlaps, import of module instead of direct class import
- frontends: printInfo and printMessage methods in (Quick)Chat are more generic (use of extra instead of timestamp)
- frontends: bridge creation and option parsing (command line arguments) are now specified by the frontend in QuickApp __init__
- frontends: ProfileManager manage a more complete plug sequence (some stuff formerly manage in contact_list have moved to ProfileManager)
- quick_frontend (quick_widgets): QuickWidgetsManager is now iterable (all widgets are then returned), or can return an iterator on a specific class (return all widgets of this class) with getWidgets
- frontends: tools.jid can now be used in Pyjamas, with some care
- frontends (XMLUI): profile is now managed
- core (memory): big improvment on entities cache management (and specially resource management)
- core (params/exceptions): added PermissionError
- various fixes and improvments, check diff for more details
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 24 Jan 2015 01:00:29 +0100 |
parents | 5968fd8d2248 |
children | 0db0013c59dd |
comparison
equal
deleted
inserted
replaced
1289:653f2e2eea31 | 1290:faa1129559b8 |
---|---|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 | 20 |
21 from sat.core import constants | 21 from sat.core import constants |
22 from sat.core.i18n import _, D_ | 22 from sat.core.i18n import _, D_ |
23 | 23 from collections import OrderedDict # only available from python 2.7 |
24 try: | |
25 from collections import OrderedDict # only available from python 2.7 | |
26 except ImportError: | |
27 try: | |
28 from ordereddict import OrderedDict | |
29 except ImportError: | |
30 pass # libervia can not import external libraries | |
31 | 24 |
32 | 25 |
33 def getPresence(): | 26 def getPresence(): |
34 """We cannot do it directly in the Const class, if it is not encapsulated | 27 """We cannot do it directly in the Const class, if it is not encapsulated |
35 in a method we get a JS runtime SyntaxError: "missing ) in parenthetical". | 28 in a method we get a JS runtime SyntaxError: "missing ) in parenthetical". |
36 # TODO: merge this definition with those in primitivus.constants and wix.constants | 29 # TODO: merge this definition with those in primitivus.constants and wix.constants |
37 """ | 30 """ |
38 try: | |
39 presence = OrderedDict([("", _("Online")), | |
40 ("chat", _("Free for chat")), | |
41 ("away", _("Away from keyboard")), | |
42 ("dnd", _("Do not disturb")), | |
43 ("xa", _("Extended away"))]) | |
44 except TypeError: | |
45 presence = {"": _("Online"), | |
46 "chat": _("Free for chat"), | |
47 "away": _("Away from keyboard"), | |
48 "dnd": _("Do not disturb"), | |
49 "xa": _("Extended away") | |
50 } | |
51 return presence | |
52 | 31 |
53 | 32 |
54 class Const(constants.Const): | 33 class Const(constants.Const): |
55 | 34 |
56 PRESENCE = getPresence() | 35 PRESENCE = OrderedDict([("", _("Online")), |
36 ("chat", _("Free for chat")), | |
37 ("away", _("Away from keyboard")), | |
38 ("dnd", _("Do not disturb")), | |
39 ("xa", _("Extended away"))]) | |
57 | 40 |
58 # from plugin_misc_text_syntaxes | 41 # from plugin_misc_text_syntaxes |
59 SYNTAX_XHTML = "XHTML" | 42 SYNTAX_XHTML = "XHTML" |
60 SYNTAX_CURRENT = "@CURRENT@" | 43 SYNTAX_CURRENT = "@CURRENT@" |
61 SYNTAX_TEXT = "text" | 44 SYNTAX_TEXT = "text" |
76 "paused": u"⦷" | 59 "paused": u"⦷" |
77 } | 60 } |
78 | 61 |
79 # Roster | 62 # Roster |
80 GROUP_NOT_IN_ROSTER = D_('Not in roster') | 63 GROUP_NOT_IN_ROSTER = D_('Not in roster') |
64 | |
65 #Chats | |
66 CHAT_ONE2ONE = 'one2one' | |
67 CHAT_GROUP = 'group' |