File indexing completed on 2024-04-28 11:20:37

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2015 Minh Ngo <minh@fedoraproject.org>
0004 */
0005 
0006 #ifndef _PYTHONUTILS_H
0007 #define _PYTHONUTILS_H
0008 
0009 #include <QFile>
0010 #include <QDebug>
0011 
0012 inline QString fromSource(const QString& resourceName)
0013 {
0014     QFile text(resourceName);
0015     if (text.open(QIODevice::ReadOnly))
0016         return QString::fromUtf8(text.readAll());
0017     else
0018     {
0019         qWarning() << "Cantor Python resource" << resourceName << "didn't open - something wrong";
0020         return QString();
0021     }
0022 }
0023 
0024 #endif