Skip to content

Commit 76623ec

Browse files
committed
enh: apply button in upload settings only affects cache location
1 parent c7d71c8 commit 76623ec

3 files changed

Lines changed: 29 additions & 22 deletions

File tree

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- fix: correctly handle dataset IDs and names in `DBExtract`
33
- fix: `get_datasets_user_shared` failed when many circles/collections exist
44
- enh: allow to disable update check on startup via settings
5+
- enh: apply button in upload settings only affects cache location
56
- ref: decorate PyQtSlots
67
- tests: restore previous users settings after testing
78
0.17.3

dcoraid/gui/preferences/dlg_preferences.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def __init__(self, *args, **kwargs):
3232

3333
self.setWindowTitle("DCOR-Aid Preferences")
3434
# general
35-
self.checkBox_check_updates.toggled.connect(self.on_check_for_updates)
35+
self.checkBox_check_updates.toggled.connect(
36+
self.on_general_check_for_updates)
3637
# server
3738
self.show_server.connect(self.on_show_server)
3839
self.show_user.connect(self.on_show_user)
@@ -46,7 +47,10 @@ def __init__(self, *args, **kwargs):
4647
# uploads
4748
self.toolButton_uploads_cache_browse.clicked.connect(
4849
self.on_uploads_browse)
49-
self.toolButton_uploads_apply.clicked.connect(self.on_uploads_apply)
50+
self.toolButton_uploads_path_apply.clicked.connect(
51+
self.on_uploads_path_apply)
52+
self.checkBox_upload_write_task_id.toggled.connect(
53+
self.on_uploads_write_task_id)
5054
# downloads
5155
self.toolButton_downloads_browse.clicked.connect(
5256
self.on_downloads_browse)
@@ -114,7 +118,7 @@ def init_uploads(self):
114118
self.checkBox_upload_write_task_id.blockSignals(False)
115119

116120
@QtCore.pyqtSlot(bool)
117-
def on_check_for_updates(self, check_for_updates):
121+
def on_general_check_for_updates(self, check_for_updates):
118122
self.settings.setValue("check for updates",
119123
int(bool(check_for_updates)))
120124

@@ -203,11 +207,17 @@ def on_downloads_browse(self):
203207
if path and pathlib.Path(path).exists():
204208
self.lineEdit_downloads_path.setText(path)
205209

206-
@QtCore.pyqtSlot()
207-
def on_uploads_apply(self):
208-
utwdid = int(self.checkBox_upload_write_task_id.isChecked())
209-
self.settings.setValue("uploads/update task with dataset id", utwdid)
210+
def on_uploads_browse(self):
211+
default = self.settings.value("uploads/cache path", ".")
212+
path = QtWidgets.QFileDialog.getExistingDirectory(
213+
self,
214+
"Choose upload cache location",
215+
default,
216+
)
217+
self.lineEdit_uploads_cache.setText(path)
210218

219+
@QtCore.pyqtSlot()
220+
def on_uploads_path_apply(self):
211221
current = self.settings.value("uploads/cache path", ".")
212222
path_cache = self.lineEdit_uploads_cache.text()
213223
self.settings.setValue("uploads/cache path", path_cache)
@@ -219,14 +229,10 @@ def on_uploads_apply(self):
219229
msg.setWindowTitle("Please restart DCOR-Aid")
220230
msg.exec()
221231

222-
def on_uploads_browse(self):
223-
default = self.settings.value("uploads/cache path", ".")
224-
path = QtWidgets.QFileDialog.getExistingDirectory(
225-
self,
226-
"Choose upload cache location",
227-
default,
228-
)
229-
self.lineEdit_uploads_cache.setText(path)
232+
@QtCore.pyqtSlot(bool)
233+
def on_uploads_write_task_id(self, check_for_updates):
234+
self.settings.setValue("uploads/update task with dataset id",
235+
int(bool(check_for_updates)))
230236

231237
@QtCore.pyqtSlot()
232238
def on_show_server(self):

dcoraid/gui/preferences/dlg_preferences.ui

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@
228228
</property>
229229
</widget>
230230
</item>
231+
<item>
232+
<widget class="QToolButton" name="toolButton_uploads_path_apply">
233+
<property name="text">
234+
<string>Apply</string>
235+
</property>
236+
</widget>
237+
</item>
231238
</layout>
232239
</item>
233240
<item>
@@ -256,13 +263,6 @@ dataset identifier assigned to it by CKAN/DCOR.</string>
256263
</property>
257264
</spacer>
258265
</item>
259-
<item>
260-
<widget class="QToolButton" name="toolButton_uploads_apply">
261-
<property name="text">
262-
<string>Apply</string>
263-
</property>
264-
</widget>
265-
</item>
266266
</layout>
267267
</item>
268268
<item>

0 commit comments

Comments
 (0)