[issue4254] _cursesmodule.c callable update_lines_cols()

2008-11-03 Thread Roland Brickl

New submission from Roland Brickl <[EMAIL PROTECTED]>:

curses.update_lines.cols() are normally usable within c programs. With
this change, it can now be used too. It only calls the preexisting
function that where only used internally. The cast in the return
statement are possibly false? But it works.
Because this aren't a big change, it would apply to some more
python-versions.

--
components: Extension Modules
files: _curses.diff
keywords: patch
messages: 75464
nosy: nemesis
severity: normal
status: open
title: _cursesmodule.c callable update_lines_cols()
type: feature request
versions: Python 2.5
Added file: http://bugs.python.org/file11932/_curses.diff

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4254>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4254] _cursesmodule.c callable update_lines_cols()

2008-11-03 Thread Roland Brickl

Roland Brickl <[EMAIL PROTECTED]> added the comment:

Hi Victor,

i use this to get updated versions of curses.COLS and curses.LINES in 
the fact of an curses.KEY_RESIZE event.
So i can use curses within python even without to have panels.
It seems that curses.panel are the prefered way to deal with terminal 
resizes.
The curses.resize[_]term() are only to change the terminal manualy.
What i also found in PyTone is more or less this functionality from 
update_lines_cols():

def getmaxyx(self):
# taken from http://dag.wieers.com/home-made/dstat/
try:
h, w = int(os.environ["LINES"]), int(os.environ["COLUMNS"])
except KeyError:
try:
h, w = curses.tigetnum('lines'), curses.tigetnum('cols')
except:
try:
s = struct.pack('', 0, 0, 0, 0)
x = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ,
s)
h, w = struct.unpack('', x)[:2]
except:
h, w = 25, 80

And please excuse me for the missing documentation. English aren't my 
native language so i would document it like:
Updates curses.LINES and curses.COLS :)

It's my first day here on the issue tracker.

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4254>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4254] _cursesmodule.c callable update_lines_cols()

2008-11-03 Thread Roland Brickl

Roland Brickl <[EMAIL PROTECTED]> added the comment:

>> i use this to get updated versions of curses.COLS and curses.LINES in
>> the fact of an curses.KEY_RESIZE event.

>I didn't know this event. Is a key in a special keyboard? Or an event 
>raised 
>by some curses internals?
Internal curses event.

>Oh I just realized that _curses functions have no documentation, 
>great :-/
Thats why python_curses should be more compatible to the existing 
c_curses documentations.

>> It's my first day here on the issue tracker.

Welcome on the tracker ;-)
Thanks.

Any questions? :)

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4254>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com