Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

Browse Source

Disabling manual path entry is a suite option now

Michael Hanke 2 years ago
parent
commit
89b8954b96

+ 2 - 0
datalad_gooey/param_form_utils.py

@@ -219,6 +219,8 @@ def _get_parameter_widget_factory(
         type_widget = functools.partial(
             pw.PathParamWidget,
             pathtype=QFileDialog.Directory,
+            disable_manual_edit=active_suite.get('options', {}).get(
+                'disable_manual_path_input', False),
             basedir=basedir)
     elif name == 'path':
         type_widget = functools.partial(

+ 3 - 6
datalad_gooey/param_widgets.py

@@ -3,7 +3,6 @@ from types import MappingProxyType
 from typing import (
     Any,
     Dict,
-    List,
 )
 
 from PySide6.QtCore import (
@@ -22,8 +21,6 @@ from PySide6.QtWidgets import (
     QWidget,
 )
 
-from datalad import cfg as dlcfg
-
 from .resource_provider import gooey_resources
 from .utils import _NoValue
 
@@ -278,6 +275,7 @@ class StrParamWidget(QLineEdit, GooeyParamWidgetMixin):
 class PathParamWidget(QWidget, GooeyParamWidgetMixin):
     def __init__(self, basedir=None,
                  pathtype: QFileDialog.FileMode = QFileDialog.AnyFile,
+                 disable_manual_edit: bool = False,
                  parent=None):
         """Supported `pathtype` values are
 
@@ -298,9 +296,8 @@ class PathParamWidget(QWidget, GooeyParamWidgetMixin):
 
         # the main widget is a simple line edit
         self._edit = QLineEdit(self)
-        # TODO this must be configurable in the suite specification
-        if dlcfg.obtain('datalad.gooey.active-suite') == 'gooey-simplified':
-            # in simplified mode we do not allow manual entry of paths
+        if disable_manual_edit:
+            # in e.g. simplified mode we do not allow manual entry of paths
             # to avoid confusions re interpretation of relative paths
             # https://github.com/datalad/datalad-gooey/issues/106
             self._edit.setDisabled(True)

+ 3 - 0
datalad_gooey/simplified_api.py

@@ -247,6 +247,9 @@ annexed_file_api['get'] = annexed_file_get
 gooey_suite = dict(
     title='Simplified',
     description='Simplified access to the most essential operations',
+    options=dict(
+        disable_manual_path_input=True,
+    ),
     apis=dict(
         dataset=dataset_api,
         directory=directory_api,