12 |
12 |
13 class PluginError(Exception): |
13 class PluginError(Exception): |
14 """ |
14 """ |
15 Class defining a special error for the plugin classes. |
15 Class defining a special error for the plugin classes. |
16 """ |
16 """ |
|
17 |
17 def __init__(self): |
18 def __init__(self): |
18 """ |
19 """ |
19 Constructor |
20 Constructor |
20 """ |
21 """ |
21 self._errorMessage = QCoreApplication.translate( |
22 self._errorMessage = QCoreApplication.translate( |
22 "PluginError", "Unspecific plugin error.") |
23 "PluginError", "Unspecific plugin error." |
23 |
24 ) |
|
25 |
24 def __repr__(self): |
26 def __repr__(self): |
25 """ |
27 """ |
26 Special method returning a representation of the exception. |
28 Special method returning a representation of the exception. |
27 |
29 |
28 @return string representing the error message |
30 @return string representing the error message |
29 """ |
31 """ |
30 return str(self._errorMessage) |
32 return str(self._errorMessage) |
31 |
33 |
32 def __str__(self): |
34 def __str__(self): |
33 """ |
35 """ |
34 Special method returning a string representation of the exception. |
36 Special method returning a string representation of the exception. |
35 |
37 |
36 @return string representing the error message |
38 @return string representing the error message |
37 """ |
39 """ |
38 return str(self._errorMessage) |
40 return str(self._errorMessage) |
39 |
41 |
40 |
42 |
41 class PluginPathError(PluginError): |
43 class PluginPathError(PluginError): |
42 """ |
44 """ |
43 Class defining an error raised, when the plugin paths were not found and |
45 Class defining an error raised, when the plugin paths were not found and |
44 could not be created. |
46 could not be created. |
45 """ |
47 """ |
|
48 |
46 def __init__(self, msg=None): |
49 def __init__(self, msg=None): |
47 """ |
50 """ |
48 Constructor |
51 Constructor |
49 |
52 |
50 @param msg message to be used by the exception (string) |
53 @param msg message to be used by the exception (string) |
51 """ |
54 """ |
52 if msg: |
55 if msg: |
53 self._errorMessage = msg |
56 self._errorMessage = msg |
54 else: |
57 else: |
55 self._errorMessage = QCoreApplication.translate( |
58 self._errorMessage = QCoreApplication.translate( |
56 "PluginError", |
59 "PluginError", "Plugin paths not found or not creatable." |
57 "Plugin paths not found or not creatable.") |
60 ) |
58 |
61 |
59 |
62 |
60 class PluginModulesError(PluginError): |
63 class PluginModulesError(PluginError): |
61 """ |
64 """ |
62 Class defining an error raised, when no plugin modules were found. |
65 Class defining an error raised, when no plugin modules were found. |
63 """ |
66 """ |
|
67 |
64 def __init__(self): |
68 def __init__(self): |
65 """ |
69 """ |
66 Constructor |
70 Constructor |
67 """ |
71 """ |
68 self._errorMessage = QCoreApplication.translate( |
72 self._errorMessage = QCoreApplication.translate( |
69 "PluginError", "No plugin modules found.") |
73 "PluginError", "No plugin modules found." |
|
74 ) |
70 |
75 |
71 |
76 |
72 class PluginLoadError(PluginError): |
77 class PluginLoadError(PluginError): |
73 """ |
78 """ |
74 Class defining an error raised, when there was an error during plugin |
79 Class defining an error raised, when there was an error during plugin |
75 loading. |
80 loading. |
76 """ |
81 """ |
|
82 |
77 def __init__(self, name): |
83 def __init__(self, name): |
78 """ |
84 """ |
79 Constructor |
85 Constructor |
80 |
86 |
81 @param name name of the plugin module (string) |
87 @param name name of the plugin module (string) |
82 """ |
88 """ |
83 self._errorMessage = QCoreApplication.translate( |
89 self._errorMessage = QCoreApplication.translate( |
84 "PluginError", |
90 "PluginError", "Error loading plugin module: {0}" |
85 "Error loading plugin module: {0}" |
|
86 ).format(name) |
91 ).format(name) |
87 |
92 |
88 |
93 |
89 class PluginActivationError(PluginError): |
94 class PluginActivationError(PluginError): |
90 """ |
95 """ |
91 Class defining an error raised, when there was an error during plugin |
96 Class defining an error raised, when there was an error during plugin |
92 activation. |
97 activation. |
93 """ |
98 """ |
|
99 |
94 def __init__(self, name): |
100 def __init__(self, name): |
95 """ |
101 """ |
96 Constructor |
102 Constructor |
97 |
103 |
98 @param name name of the plugin module (string) |
104 @param name name of the plugin module (string) |
99 """ |
105 """ |
100 self._errorMessage = QCoreApplication.translate( |
106 self._errorMessage = QCoreApplication.translate( |
101 "PluginError", |
107 "PluginError", "Error activating plugin module: {0}" |
102 "Error activating plugin module: {0}" |
|
103 ).format(name) |
108 ).format(name) |
104 |
109 |
105 |
110 |
106 class PluginModuleFormatError(PluginError): |
111 class PluginModuleFormatError(PluginError): |
107 """ |
112 """ |
108 Class defining an error raised, when the plugin module is invalid. |
113 Class defining an error raised, when the plugin module is invalid. |
109 """ |
114 """ |
|
115 |
110 def __init__(self, name, missing): |
116 def __init__(self, name, missing): |
111 """ |
117 """ |
112 Constructor |
118 Constructor |
113 |
119 |
114 @param name name of the plugin module (string) |
120 @param name name of the plugin module (string) |
115 @param missing description of the missing element (string) |
121 @param missing description of the missing element (string) |
116 """ |
122 """ |
117 self._errorMessage = QCoreApplication.translate( |
123 self._errorMessage = QCoreApplication.translate( |
118 "PluginError", |
124 "PluginError", "The plugin module {0} is missing {1}." |
119 "The plugin module {0} is missing {1}." |
|
120 ).format(name, missing) |
125 ).format(name, missing) |
121 |
126 |
122 |
127 |
123 class PluginClassFormatError(PluginError): |
128 class PluginClassFormatError(PluginError): |
124 """ |
129 """ |
125 Class defining an error raised, when the plugin module's class is invalid. |
130 Class defining an error raised, when the plugin module's class is invalid. |
126 """ |
131 """ |
|
132 |
127 def __init__(self, name, class_, missing): |
133 def __init__(self, name, class_, missing): |
128 """ |
134 """ |
129 Constructor |
135 Constructor |
130 |
136 |
131 @param name name of the plugin module (string) |
137 @param name name of the plugin module (string) |
132 @param class_ name of the class not satisfying the requirements |
138 @param class_ name of the class not satisfying the requirements |
133 (string) |
139 (string) |
134 @param missing description of the missing element (string) |
140 @param missing description of the missing element (string) |
135 """ |
141 """ |
136 self._errorMessage = QCoreApplication.translate( |
142 self._errorMessage = QCoreApplication.translate( |
137 "PluginError", |
143 "PluginError", "The plugin class {0} of module {1} is missing {2}." |
138 "The plugin class {0} of module {1} is missing {2}." |
|
139 ).format(class_, name, missing) |
144 ).format(class_, name, missing) |