mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
[py] Remove y, x params from box().
This commit is contained in:
parent
bbdd67c23d
commit
d1b47cc8a4
@ -25,8 +25,9 @@ SX = 10
|
|||||||
|
|
||||||
for y, (fg, bg) in enumerate(COLORS):
|
for y, (fg, bg) in enumerate(COLORS):
|
||||||
for x, box_chars in enumerate(BOX_CHARS):
|
for x, box_chars in enumerate(BOX_CHARS):
|
||||||
|
plane.cursor_move_yx(y * SY + 1, x * SX + 1);
|
||||||
nc.box(
|
nc.box(
|
||||||
plane, (y + 1) * SY - 1, (x + 1) * SX - 1, y * SY + 1, x * SX + 1,
|
plane, (y + 1) * SY - 1, (x + 1) * SX - 1,
|
||||||
box_chars,
|
box_chars,
|
||||||
fg=fg, bg=bg,
|
fg=fg, bg=bg,
|
||||||
# ctlword=0x1f9
|
# ctlword=0x1f9
|
||||||
|
@ -44,23 +44,21 @@ to_channel(PyObject* obj, uint32_t* channel) {
|
|||||||
static PyObject*
|
static PyObject*
|
||||||
pync_meth_box(PyObject* Py_UNUSED(self), PyObject* args, PyObject* kwargs) {
|
pync_meth_box(PyObject* Py_UNUSED(self), PyObject* args, PyObject* kwargs) {
|
||||||
static char* keywords[] = {
|
static char* keywords[] = {
|
||||||
"plane", "ystop", "xstop", "y", "x", "box_chars", "styles", "fg", "bg",
|
"plane", "ystop", "xstop", "box_chars", "styles", "fg", "bg",
|
||||||
"ctlword", NULL
|
"ctlword", NULL
|
||||||
};
|
};
|
||||||
NcPlaneObject* plane_arg;
|
NcPlaneObject* plane_arg;
|
||||||
unsigned ystop;
|
unsigned ystop;
|
||||||
unsigned xstop;
|
unsigned xstop;
|
||||||
int y = -1;
|
|
||||||
int x = -1;
|
|
||||||
const char* box_chars = NCBOXASCII;
|
const char* box_chars = NCBOXASCII;
|
||||||
uint16_t styles = 0;
|
uint16_t styles = 0;
|
||||||
PyObject* fg_arg = 0;
|
PyObject* fg_arg = 0;
|
||||||
PyObject* bg_arg = 0;
|
PyObject* bg_arg = 0;
|
||||||
unsigned ctlword = 0;
|
unsigned ctlword = 0;
|
||||||
if (!PyArg_ParseTupleAndKeywords(
|
if (!PyArg_ParseTupleAndKeywords(
|
||||||
args, kwargs, "O!II|iis$HOOI:box", keywords,
|
args, kwargs, "O!II|s$HOOI:box", keywords,
|
||||||
&NcPlane_Type, &plane_arg,
|
&NcPlane_Type, &plane_arg,
|
||||||
&ystop, &xstop, &y, &x, &box_chars,
|
&ystop, &xstop, &box_chars,
|
||||||
&styles, &fg_arg, &bg_arg, &ctlword))
|
&styles, &fg_arg, &bg_arg, &ctlword))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -92,20 +90,10 @@ pync_meth_box(PyObject* Py_UNUSED(self), PyObject* args, PyObject* kwargs) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y != 1 || x != -1) {
|
|
||||||
ret = ncplane_cursor_move_yx(plane, y, x);
|
|
||||||
if (ret < 0) {
|
|
||||||
PyErr_Format(
|
|
||||||
PyExc_RuntimeError, "ncplane_cursor_move_yx returned %i", ret);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ncplane_box(plane, &ul, &ur, &ll, &lr, &hl, &vl, ystop, xstop, ctlword);
|
ret = ncplane_box(plane, &ul, &ur, &ll, &lr, &hl, &vl, ystop, xstop, ctlword);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
PyErr_Format(PyExc_RuntimeError, "nplane_box returned %i", ret);
|
PyErr_Format(PyExc_RuntimeError, "nplane_box returned %i", ret);
|
||||||
|
|
||||||
done:
|
|
||||||
nccell_release(plane, &ul);
|
nccell_release(plane, &ul);
|
||||||
nccell_release(plane, &ur);
|
nccell_release(plane, &ur);
|
||||||
nccell_release(plane, &ll);
|
nccell_release(plane, &ll);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user