Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
400a49ba
Commit
400a49ba
authored
Apr 11, 2007
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
parent
781aef2d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
4 deletions
+84
-4
Doc/lib/libcurses.tex
Doc/lib/libcurses.tex
+10
-0
Doc/whatsnew/whatsnew26.tex
Doc/whatsnew/whatsnew26.tex
+12
-0
Lib/test/test_curses.py
Lib/test/test_curses.py
+6
-0
Misc/ACKS
Misc/ACKS
+1
-0
Modules/_cursesmodule.c
Modules/_cursesmodule.c
+55
-4
No files found.
Doc/lib/libcurses.tex
View file @
400a49ba
...
...
@@ -646,6 +646,16 @@ Similar to \method{border()}, but both \var{ls} and \var{rs} are
corner characters are always used by this function.
\end{methoddesc}
\begin{methoddesc}
[window]
{
chgat
}{
\optional
{
y, x,
}
\optional
{
num,
}
attr
}
Sets the attributes of
\var
{
num
}
characters at the current cursor
position, or at position
\code
{
(
\var
{
y
}
,
\var
{
x
}
)
}
if supplied. If no
value of
\var
{
num
}
is given or
\var
{
num
}
= -1, the attribute will
be set on all the characters to the end of the line.
This function does not move the cursor. The changed line
will be touched using the
\method
{
touchline
}
method so that the
contents will be redisplayed by the next window refresh.
\end{methoddesc}
\begin{methoddesc}
[window]
{
clear
}{}
Like
\method
{
erase()
}
, but also causes the whole window to be repainted
upon next call to
\method
{
refresh()
}
.
...
...
Doc/whatsnew/whatsnew26.tex
View file @
400a49ba
...
...
@@ -135,6 +135,18 @@ print var[2], var.type # Equivalent
(Contributed by Raymond Hettinger.)
\item
New method in the
\module
{
curses
}
module:
for a window,
\method
{
chgat()
}
changes the display characters for a
certain number of characters on a single line.
\begin{verbatim}
# Boldface text starting at y=0,x=21
# and affecting the rest of the line.
stdscr.chgat(0,21, curses.A
_
BOLD)
\end{verbatim}
(Contributed by Fabian Kreutz.)
\item
New function in the
\module
{
heapq
}
module:
\function
{
merge(iter1, iter2, ...)
}
takes any number of iterables that return data
...
...
Lib/test/test_curses.py
View file @
400a49ba
...
...
@@ -129,6 +129,12 @@ def window_funcs(stdscr):
stdscr
.
touchline
(
5
,
5
,
0
)
stdscr
.
vline
(
'a'
,
3
)
stdscr
.
vline
(
'a'
,
3
,
curses
.
A_STANDOUT
)
stdscr
.
chgat
(
5
,
2
,
3
,
curses
.
A_BLINK
)
stdscr
.
chgat
(
3
,
curses
.
A_BOLD
)
stdscr
.
chgat
(
5
,
8
,
curses
.
A_UNDERLINE
)
stdscr
.
chgat
(
curses
.
A_BLINK
)
stdscr
.
refresh
()
stdscr
.
vline
(
1
,
1
,
'a'
,
3
)
stdscr
.
vline
(
1
,
1
,
'a'
,
3
,
curses
.
A_STANDOUT
)
...
...
Misc/ACKS
View file @
400a49ba
...
...
@@ -367,6 +367,7 @@ Damon Kohler
Joseph Koshy
Bob Kras
Holger Krekel
Fabian Kreutz
Hannu Krosing
Andrew Kuchling
Vladimir Kushnir
...
...
Modules/_cursesmodule.c
View file @
400a49ba
...
...
@@ -39,15 +39,15 @@ A number of SysV or ncurses functions don't have wrappers yet; if you need
a given function, add it and send a patch. Here's a list of currently
unsupported functions:
addchnstr addchstr c
hgat c
olor_set define_key
addchnstr addchstr color_set define_key
del_curterm delscreen dupwin inchnstr inchstr innstr keyok
mcprint mvaddchnstr mvaddchstr mvc
hgat mvc
ur mvinchnstr
mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr
mvwchgat
mcprint mvaddchnstr mvaddchstr mvcur mvinchnstr
mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr
mvwinchnstr mvwinchstr mvwinnstr newterm
restartterm ripoffline scr_dump
scr_init scr_restore scr_set scrl set_curterm set_term setterm
tgetent tgetflag tgetnum tgetstr tgoto timeout tputs
vidattr vidputs waddchnstr waddchstr
wchgat
vidattr vidputs waddchnstr waddchstr
wcolor_set winchnstr winchstr winnstr wmouse_trafo wscrl
Low-priority:
...
...
@@ -620,6 +620,56 @@ int py_mvwdelch(WINDOW *w, int y, int x)
}
#endif
/* chgat, added by Fabian Kreutz <fabian.kreutz at gmx.net> */
static
PyObject
*
PyCursesWindow_ChgAt
(
PyCursesWindowObject
*
self
,
PyObject
*
args
)
{
int
rtn
;
int
x
,
y
;
int
num
=
-
1
;
short
color
;
attr_t
attr
=
A_NORMAL
;
int
use_xy
=
FALSE
;
switch
(
PyTuple_Size
(
args
))
{
case
1
:
if
(
!
PyArg_ParseTuple
(
args
,
"l;attr"
,
&
attr
))
return
NULL
;
break
;
case
2
:
if
(
!
PyArg_ParseTuple
(
args
,
"il;n,attr"
,
&
num
,
&
attr
))
return
NULL
;
break
;
case
3
:
if
(
!
PyArg_ParseTuple
(
args
,
"iil;int,int,attr"
,
&
y
,
&
x
,
&
attr
))
return
NULL
;
use_xy
=
TRUE
;
break
;
case
4
:
if
(
!
PyArg_ParseTuple
(
args
,
"iiil;int,int,n,attr"
,
&
y
,
&
x
,
&
num
,
&
attr
))
return
NULL
;
use_xy
=
TRUE
;
break
;
default:
PyErr_SetString
(
PyExc_TypeError
,
"chgat requires 1 to 4 arguments"
);
return
NULL
;
}
color
=
(
short
)((
attr
>>
8
)
&
0xff
);
attr
=
attr
-
(
color
<<
8
);
if
(
use_xy
==
TRUE
)
{
rtn
=
mvwchgat
(
self
->
win
,
y
,
x
,
num
,
attr
,
color
,
NULL
);
touchline
(
self
->
win
,
y
,
1
);
}
else
{
getyx
(
self
->
win
,
y
,
x
);
rtn
=
wchgat
(
self
->
win
,
num
,
attr
,
color
,
NULL
);
touchline
(
self
->
win
,
y
,
1
);
}
return
PyCursesCheckERR
(
rtn
,
"chgat"
);
}
static
PyObject
*
PyCursesWindow_DelCh
(
PyCursesWindowObject
*
self
,
PyObject
*
args
)
...
...
@@ -1428,6 +1478,7 @@ static PyMethodDef PyCursesWindow_Methods[] = {
{
"attron"
,
(
PyCFunction
)
PyCursesWindow_wattron
,
METH_VARARGS
},
{
"attrset"
,
(
PyCFunction
)
PyCursesWindow_wattrset
,
METH_VARARGS
},
{
"bkgd"
,
(
PyCFunction
)
PyCursesWindow_Bkgd
,
METH_VARARGS
},
{
"chgat"
,
(
PyCFunction
)
PyCursesWindow_ChgAt
,
METH_VARARGS
},
{
"bkgdset"
,
(
PyCFunction
)
PyCursesWindow_BkgdSet
,
METH_VARARGS
},
{
"border"
,
(
PyCFunction
)
PyCursesWindow_Border
,
METH_VARARGS
},
{
"box"
,
(
PyCFunction
)
PyCursesWindow_Box
,
METH_VARARGS
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment