Skip to content
Snippets Groups Projects
Commit f0197394 authored by Honza Mach's avatar Honza Mach
Browse files

Reconstructing lost commits

parent 5ca4ce19
Branches
No related tags found
No related merge requests found
......@@ -288,10 +288,25 @@ TREE_STYLES = {
#-------------------------------------------------------------------------------
def is_terminal(fdesc):
"""
Check, if we are connected to any terminal-like device.
"""
try:
if not fdesc:
return False
return os.isatty(fdesc.fileno())
except:
return False
# Detect the terminal automatically after library initialization.
IS_TERMINAL = is_terminal(sys.stdout)
def terminal_size():
"""
Detect the current size of terminal window as a numer of rows and columns.
"""
if IS_TERMINAL:
try:
(rows, columns) = os.popen('stty size', 'r').read().split()
rows = int(rows)
......@@ -305,7 +320,7 @@ def terminal_size():
pass
return (80, 24)
# Detect the terminal size automatically after library initialization
# Detect the terminal size automatically after library initialization.
(TERMINAL_WIDTH, TERMINAL_HEIGHT) = terminal_size()
#-------------------------------------------------------------------------------
......
......@@ -23,7 +23,7 @@ with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
setup(
name = 'pydgets',
version = '0.6',
version = '0.9',
description = 'Console widget library for Python 3',
long_description = long_description,
classifiers = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment