diff --git a/profile_manager/profile_manager.py b/profile_manager/profile_manager.py
index 9132c45..d747517 100644
--- a/profile_manager/profile_manager.py
+++ b/profile_manager/profile_manager.py
@@ -151,17 +151,29 @@ def change_target_profile(self, profile_name: str):
self.target_data_sources = collect_data_sources(self.target_qgis_ini_file)
self.target_plugins = collect_plugin_names(self.target_qgis_ini_file)
- def make_backup(self, profile_name: str) -> Optional[str]:
+ def make_backup(self, profile_name: str, backup_dir: str) -> Optional[str]:
"""Creates a backup of the specified profile.
Args:
profile_name (str): Name of the profile to back up
+ backup_dir (str): Directory where backup should be stored
Returns:
str: A message if an error occured.
"""
+ ######################################################################
+ backup_path = Path(backup_dir)
+
+ if not backup_path.exists():
+ QgsMessageLog.logMessage(
+ f"invalid backup path: {backup_dir}",
+ "Profile Manager",
+ level=Qgis.MessageLevel.Info,
+ )
+ # return ?
+ ######################################################################
ts = int(time.time())
- target_path = self.backup_path / str(ts)
+ target_path = backup_path / str(ts)
source_path = qgis_profiles_path() / profile_name
QgsMessageLog.logMessage(
f"Backing up profile {profile_name!r} to {target_path!r}",
diff --git a/profile_manager/profile_manager_dialog.py b/profile_manager/profile_manager_dialog.py
index a6fa0df..7c980de 100644
--- a/profile_manager/profile_manager_dialog.py
+++ b/profile_manager/profile_manager_dialog.py
@@ -163,8 +163,14 @@ def _set_qdt_profile_infos(self, qdt_profile_infos: QDTProfileInfos) -> None:
def export_qdt_handler(self) -> None:
"""Export selected profile as QDT profile"""
profile_path = self.qdt_file_widget.filePath()
- if profile_path:
+ backup_path = (
+ self.qdt_backup_file_widget.filePath()
+ ) # NEW sets backup_path from Widget
+ if profile_path and backup_path: # NEW check for both
source_profile_name = self.qdt_export_profile_cbx.currentText()
+ make = self.__profile_manager.make_backup(
+ source_profile_name, backup_path
+ ) # NEW idk how to name it tbh
export_profile_for_qdt(
profile_name=source_profile_name,
export_path=Path(profile_path),
diff --git a/profile_manager/profile_manager_dialog_base.ui b/profile_manager/profile_manager_dialog_base.ui
index c83e1a0..318c03e 100644
--- a/profile_manager/profile_manager_dialog_base.ui
+++ b/profile_manager/profile_manager_dialog_base.ui
@@ -6,8 +6,8 @@
0
0
- 701
- 503
+ 808
+ 673
@@ -20,7 +20,7 @@
-
- 0
+ 2
@@ -350,7 +350,56 @@
QDT Export
-
-
+
-
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Export
+
+
+
+ -
+
+
+ -
+
+
+ QgsFileWidget::GetDirectory
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ Export inactive plugins
+
+
+
+ -
+
+
+ -
@@ -363,107 +412,72 @@
- -
-
+
-
+
- QGIS min. version
+ Export folder
- -
-
+
-
+
- Description
+ Clear export folder
- -
-
-
- -
-
+
-
+
- Email
+ QGIS min. version
- -
-
-
- -
-
-
- -
-
+
-
+
- Clear export folder
+ QGIS max. version
- -
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
+
-
+
- Export inactive plugins
+ Email
- -
+
-
Version
- -
-
+
-
+
- Export
+ Description
- -
-
+
-
+
+
+ -
+
- QGIS max. version
+ Backup folder
- -
-
-
- -
-
-
- -
-
+
-
+
QgsFileWidget::GetDirectory
- -
-
-
- Export folder
-
-
-