File: glances_unicode.py

package info (click to toggle)
glances 4.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 11,832 kB
  • sloc: python: 16,009; makefile: 437; javascript: 351; sh: 168
file content (27 lines) | stat: -rw-r--r-- 747 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#
# This file is part of Glances.
#
# SPDX-FileCopyrightText: 2022 Nicolas Hennion <nicolas@nicolargo.com>
#
# SPDX-License-Identifier: LGPL-3.0-only
#

"""Manage unicode message for Glances output."""

_unicode_message = {
    'ARROW_LEFT': ['\u2190', '<'],
    'ARROW_RIGHT': ['\u2192', '>'],
    'ARROW_UP': ['\u2191', '^'],
    'ARROW_DOWN': ['\u2193', 'v'],
    'CHECK': ['\u2713', ''],
    'PROCESS_SELECTOR': ['>', '>'],
    'MEDIUM_LINE': ['\u2500', '─'],
    'LOW_LINE': ['\u2581', '_'],
}


def unicode_message(key, args=None):
    """Return the unicode message for the given key."""
    if args and hasattr(args, 'disable_unicode') and args.disable_unicode:
        return _unicode_message[key][1]
    return _unicode_message[key][0]