##// END OF EJS Templates
Fixing a few small bugs in the setup.py scripts. In setupbase.py, in find_scripts, ipython...
Fixing a few small bugs in the setup.py scripts. In setupbase.py, in find_scripts, ipython was spelled as lowercase. This didn't cause a problem on OS X as it is case insensitive. But on Linux, it crashed. Now ipython is spelled properly as "IPython". Also, kernel/config/tests and UserConfig were missing their __init__.py files. These have been added.

File last commit:

r88:34373562
r1254:19bd8e77
Show More
winconsole.py
46 lines | 1.4 KiB | text/x-python | PythonLexer
fperez
Small fix in ultraTB, and fix autocall....
r88 """Set of functions to work with console on Windows.
fperez
Add new winconsole module and fixes to page_dumb() to improve its behavior...
r65 """
fperez
Small fix in ultraTB, and fix autocall....
r88 #*****************************************************************************
# Copyright (C) 2005 Alexander Belchenko <bialix@ukr.net>
#
# This file is placed in the public domain.
#
#*****************************************************************************
fperez
Add new winconsole module and fixes to page_dumb() to improve its behavior...
r65
__author__ = 'Alexander Belchenko (e-mail: bialix AT ukr.net)'
__license__ = 'Public domain'
import struct
try:
import ctypes
except ImportError:
ctypes = None
def get_console_size(defaultx=80, defaulty=25):
""" Return size of current console.
This function try to determine actual size of current working
console window and return tuple (sizex, sizey) if success,
or default size (defaultx, defaulty) otherwise.
Dependencies: ctypes should be installed.
"""
if ctypes is None:
# no ctypes is found
return (defaultx, defaulty)
h = ctypes.windll.kernel32.GetStdHandle(-11)
csbi = ctypes.create_string_buffer(22)
res = ctypes.windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
if res:
(bufx, bufy, curx, cury, wattr,
left, top, right, bottom, maxx, maxy) = struct.unpack("hhhhHhhhhhh",
csbi.raw)
sizex = right - left + 1
sizey = bottom - top + 1
return (sizex, sizey)
else:
return (defaultx, defaulty)