Skip to content

Commit

Permalink
Revert "Python 3.10 fixes"
Browse files Browse the repository at this point in the history
This reverts commit 03e4967.

These fixes are for Kirkstone, not for develop
  • Loading branch information
WanWizard committed Apr 22, 2024
1 parent 03e4967 commit 0c459eb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
3 changes: 1 addition & 2 deletions lib/gdi/picload.cpp
Expand Up @@ -1391,10 +1391,9 @@ RESULT ePicLoad::setPara(PyObject *val)
return 0;
else {
ePyObject fast = PySequence_Fast(val, "");
ePyObject pas = PySequence_Fast_GET_ITEM(fast, 2);
int width = PyLong_AsLong(PySequence_Fast_GET_ITEM(fast, 0));
int height = PyLong_AsLong(PySequence_Fast_GET_ITEM(fast, 1));
double aspectRatio = PyFloat_Check(pas) ? PyFloat_AsDouble(pas) : PyLong_AsDouble(pas);
double aspectRatio = PyLong_AsLong(PySequence_Fast_GET_ITEM(fast, 2));
int as = PyLong_AsLong(PySequence_Fast_GET_ITEM(fast, 3));
bool useCache = PyLong_AsLong(PySequence_Fast_GET_ITEM(fast, 4));
int resizeType = PyLong_AsLong(PySequence_Fast_GET_ITEM(fast, 5));
Expand Down
38 changes: 19 additions & 19 deletions lib/gui/elistboxcontent.cpp
Expand Up @@ -172,7 +172,7 @@ int eListboxPythonStringContent::getMaxItemTextWidth()
}
}
}

return m_max_text_width + (m_text_offset*2);
}

Expand Down Expand Up @@ -290,7 +290,7 @@ void eListboxPythonStringContent::paint(gPainter &painter, eWindowStyle &style,
if (item == Py_None)
{
/* seperator */
if (isverticallb)
if (isverticallb)
{
int half_height = m_itemsize.height() / 2;
painter.fill(eRect(offset.x() + half_height, offset.y() + half_height - 2, m_itemsize.width() - m_itemsize.height(), 4));
Expand Down Expand Up @@ -1025,7 +1025,7 @@ int eListboxPythonMultiContent::getMaxItemTextWidth()
}

}

return m_max_text_width + (m_text_offset*2);
}

Expand All @@ -1047,7 +1047,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
local_style = m_listbox->getLocalStyle();
isverticallb = m_listbox->getOrientation() == 1;
}

painter.clip(itemregion);

if(local_style) {
Expand Down Expand Up @@ -1225,10 +1225,10 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
continue;

const char *string = (PyUnicode_Check(pstring)) ? PyUnicode_AsUTF8(pstring) : "<not-a-string>";
int x = (PyFloat_Check(px) ? (int)PyFloat_AsDouble(px) : PyLong_AsLong(px)) + offset.x();
int y = (PyFloat_Check(py) ? (int)PyFloat_AsDouble(py) : PyLong_AsLong(py)) + offset.y();
int width = PyFloat_Check(pwidth) ? (int)PyFloat_AsDouble(pwidth) : PyLong_AsLong(pwidth);
int height = PyFloat_Check(pheight) ? (int)PyFloat_AsDouble(pheight) : PyLong_AsLong(pheight);
int x = PyLong_AsLong(px) + offset.x();
int y = PyLong_AsLong(py) + offset.y();
int width = PyLong_AsLong(pwidth);
int height = PyLong_AsLong(pheight);
int flags = PyLong_AsLong(pflags);
int fnt = PyLong_AsLong(pfnt);
int bwidth = pborderWidth ? PyLong_AsLong(pborderWidth) : 0;
Expand Down Expand Up @@ -1258,7 +1258,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
painter.setRadius(cornerRadius, cornerEdges);
painter.drawRectangle(itemRect);
}
else
else
{
gRegion rc(rect);
bool mustClear = (selected && pbackColorSelected) || (!selected && pbackColor);
Expand Down Expand Up @@ -1365,11 +1365,11 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
pbackColorSelected=ePyObject();
}

int x = (PyFloat_Check(px) ? (int)PyFloat_AsDouble(px) : PyLong_AsLong(px)) + offset.x();
int y = (PyFloat_Check(py) ? (int)PyFloat_AsDouble(py) : PyLong_AsLong(py)) + offset.y();
int width = PyFloat_Check(pwidth) ? (int)PyFloat_AsDouble(pwidth) : PyLong_AsLong(pwidth);
int height = PyFloat_Check(pheight) ? (int)PyFloat_AsDouble(pheight) : PyLong_AsLong(pheight);
int filled = PyFloat_Check(pfilled_perc) ? (int)PyFloat_AsDouble(pfilled_perc) : PyLong_AsLong(pfilled_perc);
int x = PyLong_AsLong(px) + offset.x();
int y = PyLong_AsLong(py) + offset.y();
int width = PyLong_AsLong(pwidth);
int height = PyLong_AsLong(pheight);
int filled = PyLong_AsLong(pfilled_perc);

if ((filled < 0) && data) /* if the string is in a negative number, it refers to the 'data' list. */
filled = PyLong_AsLong(PyTuple_GetItem(data, -filled));
Expand Down Expand Up @@ -1455,10 +1455,10 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
if (ppixmap == Py_None)
continue;

int x = (PyFloat_Check(px) ? (int)PyFloat_AsDouble(px) : PyLong_AsLong(px)) + offset.x();
int y = (PyFloat_Check(py) ? (int)PyFloat_AsDouble(py) : PyLong_AsLong(py)) + offset.y();
int width = PyFloat_Check(pwidth) ? (int)PyFloat_AsDouble(pwidth) : PyLong_AsLong(pwidth);
int height = PyFloat_Check(pheight) ? (int)PyFloat_AsDouble(pheight) : PyLong_AsLong(pheight);
int x = PyLong_AsLong(px) + offset.x();
int y = PyLong_AsLong(py) + offset.y();
int width = PyLong_AsLong(pwidth);
int height = PyLong_AsLong(pheight);
int flags = 0;
int radius = 0;
int edges = 0;
Expand Down Expand Up @@ -1506,7 +1506,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
}
}



error_out:
if (buildfunc_ret)
Expand Down

0 comments on commit 0c459eb

Please sign in to comment.