Mercurial > libervia-backend
comparison sat_frontends/jp/base.py @ 3378:67e306cae157
jp: don't guess background when stdout is not a tty
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 15 Oct 2020 14:44:42 +0200 |
parents | 9d0df638c8b4 |
children | 2f0be2b7de68 |
comparison
equal
deleted
inserted
replaced
3377:297389b1563c | 3378:67e306cae157 |
---|---|
118 def get_config(self, name, section='jp', default=None): | 118 def get_config(self, name, section='jp', default=None): |
119 """Retrieve a setting value from sat.conf""" | 119 """Retrieve a setting value from sat.conf""" |
120 return config.getConfig(self.sat_conf, section, name, default=default) | 120 return config.getConfig(self.sat_conf, section, name, default=default) |
121 | 121 |
122 def guess_background(self): | 122 def guess_background(self): |
123 if not sys.stdout.isatty(): | |
124 return 'dark' | |
123 stdin_fd = sys.stdin.fileno() | 125 stdin_fd = sys.stdin.fileno() |
124 old_settings = termios.tcgetattr(stdin_fd) | 126 old_settings = termios.tcgetattr(stdin_fd) |
125 try: | 127 try: |
126 tty.setraw(sys.stdin.fileno()) | 128 tty.setraw(sys.stdin.fileno()) |
127 # we request background color | 129 # we request background color |