|
1
|
|
|
# -*- coding: utf-8 -*- |
|
2
|
|
|
# |
|
3
|
|
|
# This file is part of Glances. |
|
4
|
|
|
# |
|
5
|
|
|
# Copyright (C) 2022 Nicolargo <[email protected]> |
|
6
|
|
|
# |
|
7
|
|
|
# Glances is free software; you can redistribute it and/or modify |
|
8
|
|
|
# it under the terms of the GNU Lesser 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
|
|
|
# Glances 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 Lesser General Public License for more details. |
|
16
|
|
|
# |
|
17
|
|
|
# You should have received a copy of the GNU Lesser General Public License |
|
18
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
19
|
|
|
|
|
20
|
|
|
"""Manage unicode message for Glances output.""" |
|
21
|
|
|
|
|
22
|
|
|
_unicode_message = { |
|
23
|
|
|
'ARROW_LEFT': [u'\u2190', u'<'], |
|
24
|
|
|
'ARROW_RIGHT': [u'\u2192', u'>'], |
|
25
|
|
|
'ARROW_UP': [u'\u2191', u'^'], |
|
26
|
|
|
'ARROW_DOWN': [u'\u2193', u'v'], |
|
27
|
|
|
'CHECK': [u'\u2713', u''], |
|
28
|
|
|
'PROCESS_SELECTOR': [u'>', u'>'], |
|
29
|
|
|
'MEDIUM_LINE': [u'\u23AF', u'-'], |
|
30
|
|
|
'LOW_LINE': [u'\u2581', u'_'], |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
def unicode_message(key, args=None): |
|
35
|
|
|
"""Return the unicode message for the given key.""" |
|
36
|
|
|
if args and hasattr(args, 'disable_unicode') and args.disable_unicode: |
|
37
|
|
|
return _unicode_message[key][1] |
|
38
|
|
|
else: |
|
39
|
|
|
return _unicode_message[key][0] |
|
40
|
|
|
|