diff --git a/CHANGELOG b/CHANGELOG
index 81a8f64..c082a85 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,5 @@
+0.7.4
+ - enh: add user preference for default recipe
0.7.3
- fix: segmentation fault due to mixing threading.Thread with PyQt6
- enh: introduce logging and make logging Path available to the user
diff --git a/mpl_data_cast/gui/main.py b/mpl_data_cast/gui/main.py
index 732d802..70116e7 100644
--- a/mpl_data_cast/gui/main.py
+++ b/mpl_data_cast/gui/main.py
@@ -74,8 +74,13 @@ def __init__(self, *args, **kwargs):
recipes = mpldc_recipe.get_available_recipe_names()
for rr in recipes:
self.comboBox_recipe.addItem(rr, rr)
- # Set default recipe to "CatchAll"
- default = recipes.index("CatchAll")
+ # Set recipe according to preferences
+ recipe_settings = self.settings.value("main/recipe",
+ "CatchAll")
+ if recipe_settings in recipes:
+ default = recipes.index(recipe_settings)
+ else:
+ default = recipes.index("CatchAll")
self.comboBox_recipe.setCurrentIndex(default)
self.on_recipe_changed()
diff --git a/mpl_data_cast/gui/preferences.py b/mpl_data_cast/gui/preferences.py
index 1b6109a..921f9e3 100644
--- a/mpl_data_cast/gui/preferences.py
+++ b/mpl_data_cast/gui/preferences.py
@@ -4,6 +4,7 @@
from PyQt6 import uic, QtCore, QtWidgets
+from .. import recipe as mpldc_recipe
from ..util import is_dir_writable
@@ -21,10 +22,15 @@ def __init__(self, parent, *args, **kwargs):
self.settings = QtCore.QSettings()
self.parent = parent
+ # Populate the recipe list
+ self.available_recipes = mpldc_recipe.get_available_recipe_names()
+ for rr in self.available_recipes:
+ self.comboBox_recipe.addItem(rr, rr)
#: configuration keys, corresponding widgets, and defaults
self.config_pairs = [
["main/output_path", self.lineEdit_output_path,
pathlib.Path.home()],
+ ["main/recipe", self.comboBox_recipe, "CatchAll"]
]
self.reload()
@@ -50,6 +56,9 @@ def reload(self):
widget.setText(str(value))
elif isinstance(widget, QtWidgets.QSpinBox):
widget.setValue(int(value))
+ elif widget is self.comboBox_recipe:
+ recipe_idx = self.available_recipes.index(str(value))
+ widget.setCurrentIndex(recipe_idx)
else:
raise NotImplementedError("No rule for '{}'".format(key))
@@ -68,6 +77,8 @@ def on_settings_ok(self):
value = str(pathlib.Path.home())
elif isinstance(widget, QtWidgets.QSpinBox):
value = int(widget.value())
+ elif isinstance(widget, QtWidgets.QComboBox):
+ value = widget.currentData()
else:
raise NotImplementedError("No rule for '{}'".format(key))
self.settings.setValue(key, value)
diff --git a/mpl_data_cast/gui/preferences.ui b/mpl_data_cast/gui/preferences.ui
index de939ab..5b1646b 100644
--- a/mpl_data_cast/gui/preferences.ui
+++ b/mpl_data_cast/gui/preferences.ui
@@ -17,43 +17,61 @@
../../../../.designer/backup../../../../.designer/backup
-
+
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
+
+
-
-
-
-
+
-
+
- Select directory
+ Default output directory:
-
+ -
+
+
+ Select directory
+
+
+
+
+
+ -
+
-
-
+
- Default output directory:
+ Default recipe:
+
+
+
+ -
+
+
+ QComboBox::InsertAlphabetically
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
-