Krita Source Code Documentation
Loading...
Searching...
No Matches
PythonPlugin Class Reference

#include <PythonPluginManager.h>

Public Member Functions

QString comment () const
 
QString desktopFilePath () const
 
const QString & errorReason () const
 
bool isBroken () const
 
bool isEnabled () const
 
bool isUnstable () const
 
bool isValid () const
 
QString manual ()
 
QString moduleFilePathPart () const
 
QString moduleName () const
 
QString name () const
 
QVariant property (const QString &name) const
 
QString statusText ()
 

Private Member Functions

 PythonPlugin ()
 

Private Attributes

bool m_broken {false}
 
QString m_comment
 
QString m_desktopFilePath
 
bool m_enabled {false}
 
QString m_errorReason
 
bool m_loaded {false}
 
QString m_manual
 
QString m_manualPath
 
QString m_moduleName
 
QString m_name
 
QMap< QString, QVariant > m_properties
 
bool m_unstable {false}
 

Friends

class PythonPluginManager
 

Detailed Description

Represents a Python described in the plugin's .desktop file.

Definition at line 22 of file PythonPluginManager.h.

Constructor & Destructor Documentation

◆ PythonPlugin()

PythonPlugin::PythonPlugin ( )
inlineprivate

Definition at line 84 of file PythonPluginManager.h.

84 {
85 m_properties["X-Python-Dependencies"] = QStringList();
86 }
QList< QString > QStringList
QMap< QString, QVariant > m_properties

References m_properties.

Member Function Documentation

◆ comment()

QString PythonPlugin::comment ( ) const
inline

Definition at line 76 of file PythonPluginManager.h.

77 {
78 return m_comment;
79 }

References m_comment.

◆ desktopFilePath()

QString PythonPlugin::desktopFilePath ( ) const
inline

Definition at line 66 of file PythonPluginManager.h.

67 {
68 return m_desktopFilePath;
69 }

References m_desktopFilePath.

◆ errorReason()

const QString & PythonPlugin::errorReason ( ) const
inline

Definition at line 36 of file PythonPluginManager.h.

37 {
38 return m_errorReason;
39 }

References m_errorReason.

◆ isBroken()

bool PythonPlugin::isBroken ( ) const
inline

Definition at line 46 of file PythonPluginManager.h.

47 {
48 return m_broken;
49 }

References m_broken.

◆ isEnabled()

bool PythonPlugin::isEnabled ( ) const
inline

Definition at line 41 of file PythonPluginManager.h.

42 {
43 return m_enabled;
44 }

References m_enabled.

◆ isUnstable()

bool PythonPlugin::isUnstable ( ) const
inline

Definition at line 51 of file PythonPluginManager.h.

52 {
53 return m_unstable;
54 }

References m_unstable.

◆ isValid()

bool PythonPlugin::isValid ( ) const

Definition at line 60 of file PythonPluginManager.cpp.

61{
62 dbgScript << "Got Krita/PythonPlugin: " << name()
63 << ", module-path=" << moduleName()
64 ;
65 // Make sure mandatory properties are here
66 if (m_name.isEmpty()) {
67 dbgScript << "Ignore desktop file w/o a name";
68 return false;
69 }
70 if (m_moduleName.isEmpty()) {
71 dbgScript << "Ignore desktop file w/o a module to import";
72 return false;
73 }
74
75 return true;
76}
QString name() const
QString moduleName() const
#define dbgScript
Definition kis_debug.h:60

References dbgScript, m_moduleName, m_name, moduleName(), and name().

◆ manual()

QString PythonPlugin::manual ( )

Definition at line 47 of file PythonPluginManager.cpp.

48{
49 if (m_manual.isNull() && !m_manualPath.isEmpty()) {
50 QFile f(m_manualPath);
51 if (f.open(QFile::ReadOnly)) {
52 QByteArray ba = f.readAll();
53 f.close();
54 m_manual = QString::fromUtf8(ba);
55 }
56 }
57 return m_manual;
58}

References m_manual, and m_manualPath.

◆ moduleFilePathPart()

QString PythonPlugin::moduleFilePathPart ( ) const

Transforms the Python module name into a file path part

Definition at line 41 of file PythonPluginManager.cpp.

42{
43 QString filePath = m_moduleName;
44 return filePath.replace(".", "/");
45}

References m_moduleName.

◆ moduleName()

QString PythonPlugin::moduleName ( ) const
inline

Definition at line 61 of file PythonPluginManager.h.

62 {
63 return m_moduleName;
64 }

References m_moduleName.

◆ name()

QString PythonPlugin::name ( ) const
inline

Definition at line 56 of file PythonPluginManager.h.

57 {
58 return m_name;
59 }

References m_name.

◆ property()

QVariant PythonPlugin::property ( const QString & name) const
inline

Definition at line 71 of file PythonPluginManager.h.

72 {
73 return m_properties.value(name, "");
74 }

References m_properties, and name().

◆ statusText()

QString PythonPlugin::statusText ( )

Definition at line 78 of file PythonPluginManager.cpp.

79{
80 if (isBroken()) {
81 return i18nc("@item:intable plugin status", "Broken");
82 } else if (isUnstable()) {
83 return i18nc("@item:intable plugin status", "Unstable");
84 } else if (isEnabled()) {
85 return i18nc("@item:intable plugin status", "Loaded");
86 } else {
87 return i18nc("@item:intable plugin status", "Not loaded");
88 }
89}
bool isBroken() const
bool isEnabled() const
bool isUnstable() const

References isBroken(), isEnabled(), and isUnstable().

Friends And Related Symbol Documentation

◆ PythonPluginManager

friend class PythonPluginManager
friend

Definition at line 82 of file PythonPluginManager.h.

Member Data Documentation

◆ m_broken

bool PythonPlugin::m_broken {false}
private

Definition at line 90 of file PythonPluginManager.h.

90{false};

◆ m_comment

QString PythonPlugin::m_comment
private

Definition at line 97 of file PythonPluginManager.h.

◆ m_desktopFilePath

QString PythonPlugin::m_desktopFilePath
private

Definition at line 96 of file PythonPluginManager.h.

◆ m_enabled

bool PythonPlugin::m_enabled {false}
private

Definition at line 89 of file PythonPluginManager.h.

89{false};

◆ m_errorReason

QString PythonPlugin::m_errorReason
private

Definition at line 88 of file PythonPluginManager.h.

◆ m_loaded

bool PythonPlugin::m_loaded {false}
private

Definition at line 92 of file PythonPluginManager.h.

92{false};

◆ m_manual

QString PythonPlugin::m_manual
private

Definition at line 99 of file PythonPluginManager.h.

◆ m_manualPath

QString PythonPlugin::m_manualPath
private

Definition at line 98 of file PythonPluginManager.h.

◆ m_moduleName

QString PythonPlugin::m_moduleName
private

Definition at line 95 of file PythonPluginManager.h.

◆ m_name

QString PythonPlugin::m_name
private

Definition at line 94 of file PythonPluginManager.h.

◆ m_properties

QMap<QString, QVariant> PythonPlugin::m_properties
private

Definition at line 101 of file PythonPluginManager.h.

◆ m_unstable

bool PythonPlugin::m_unstable {false}
private

Definition at line 91 of file PythonPluginManager.h.

91{false};

The documentation for this class was generated from the following files: