File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
qgis_deployment_toolbelt/profiles Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,39 @@ def from_json(
188
188
** profile_data ,
189
189
)
190
190
191
+ @classmethod
192
+ def from_profile_folder (cls , input_profile_folder : Path ) -> Self :
193
+ """Create object from a QGIS profile folder. Must contain a QGIS/QGIS3.ini file.
194
+
195
+ Args:
196
+ input_profile_folder (Path): path to the folder containgin a QGIS plugin
197
+
198
+ Returns:
199
+ Self: instanciated object
200
+ """
201
+ # check that input path is a folder
202
+ check_path (
203
+ input_path = input_profile_folder ,
204
+ must_exists = True ,
205
+ must_be_a_folder = True ,
206
+ must_be_a_file = False ,
207
+ must_be_readable = True ,
208
+ )
209
+ # check if the folder contains a QGIS3.ini file
210
+ profile_qgis_ini = input_profile_folder / "QGIS/QGIS3.ini"
211
+ check_path (
212
+ input_path = profile_qgis_ini ,
213
+ must_be_a_file = True ,
214
+ must_be_readable = True ,
215
+ must_exists = True ,
216
+ )
217
+
218
+ # return new instance with loaded object
219
+ return cls (
220
+ folder = input_profile_folder .name ,
221
+ loaded_from_json = False ,
222
+ )
223
+
191
224
@property
192
225
def alias (self ) -> str :
193
226
"""Returns the profile's alias.
You can’t perform that action at this time.
0 commit comments