Compare commits

..

3 Commits

2 changed files with 55 additions and 42 deletions

View File

@@ -32,9 +32,9 @@ and run UPIWIN successfully. This document describes the process.
## Installing Libraries for UPIWIN
1. Use `sudo -i` to get a root command prompt.
2. Execute the command to install packaged libraries:
2. Execute the command to install packaged libraries and utilities:
apt install python3-dev libfreetype6-dev libpng-dev ttf-mscorefonts-installer
apt install python3-dev libfreetype6-dev libpng-dev libzip-dev ttf-mscorefonts-installer zip
3. Execute the commands to install the BCM2835 library:

View File

@@ -27,20 +27,11 @@
#include "ep_init.h"
#include "ep_types.h"
static PyObject *resfile_load_classmethod(ResFileType *cls, PyObject *args)
static PyObject *wrap_resource_file_handle(HRESFILE handle)
{
const char *filename;
PyObject *rc = NULL, *args, *kwargs;
ResFileObject *presfile;
HRESULT hr;
HRESFILE handle;
if (!PyArg_ParseTuple(args, "s", &filename))
return NULL;
hr = Rsrc_load_file((PCSTR)filename, &handle);
if (SUCCEEDED(hr))
{
args = PyTuple_New(0);
if (args)
{
@@ -57,7 +48,22 @@ static PyObject *resfile_load_classmethod(ResFileType *cls, PyObject *args)
}
Py_DECREF(args);
}
return rc;
}
static PyObject *resfile_load_classmethod(PyTypeObject *cls, PyObject *args)
{
const char *filename;
PyObject *rc = NULL;
HRESULT hr;
HRESFILE handle;
if (!PyArg_ParseTuple(args, "s", &filename))
return NULL;
hr = Rsrc_load_file((PCSTR)filename, &handle);
if (SUCCEEDED(hr))
{
rc = wrap_resource_file_handle(handle);
if (!rc)
{
Rsrc_close_file(handle);
@@ -77,19 +83,11 @@ static PyObject *resfile_close(ResFileObject *self, PyObject *args)
return NULL;
}
static PyObject *resfile_find_resource(ResFileObject *self, PyObject *args)
static PyObject *wrap_resource_handle(HRSRC hrsrc)
{
const char *name;
PyObject *rc = NULL, *args, *kwargs;
ResourceObject *pres;
HRSRC hrsrc;
HRESULT hr;
if (!PyArg_ParseTuple(args, "s", &name))
return NULL;
hr = Rsrc_find_resource(self->hresfile, (PCSTR)name, NULL, &hrsrc);
if (SUCCEEDED(hr))
{
args = PyTuple_New(0);
if (args)
{
@@ -106,7 +104,22 @@ static PyObject *resfile_find_resource(ResFileObject *self, PyObject *args)
}
Py_DECREF(args);
}
return rc;
}
static PyObject *resfile_find_resource(ResFileObject *self, PyObject *args)
{
const char *name;
PyObject *rc = NULL;
HRSRC hrsrc;
HRESULT hr;
if (!PyArg_ParseTuple(args, "s", &name))
return NULL;
hr = Rsrc_find_resource(self->hresfile, (PCSTR)name, NULL, &hrsrc);
if (SUCCEEDED(hr))
{
rc = wrap_resource_handle(hrsrc);
if (!rc)
{
Rsrc_free_resource(hrsrc);
@@ -114,7 +127,7 @@ static PyObject *resfile_find_resource(ResFileObject *self, PyObject *args)
}
}
else
PyErr_Format(PyExc_RuntimeError, "unable to load resource file '%s' (%08x)", filename, hr);
PyErr_Format(PyExc_RuntimeError, "unable to load resource ''%s' (%08x)", name, hr);
return rc;
}