@@ -35,10 +35,11 @@ def __init__(self, *args, **kwargs):
3535 self .toolButton_server_update .clicked .connect (self .on_update_server )
3636 self .tabWidget .currentChanged .connect (self .on_tab_changed )
3737 self .toolButton_api_token_renew .clicked .connect (
38- self .on_api_token_renew )
38+ self .on_server_api_token_renew )
3939 self .toolButton_api_token_revoke .clicked .connect (
40- self .on_api_token_revoke )
41- self .toolButton_eye .clicked .connect (self .on_toggle_api_password_view )
40+ self .on_server_api_token_revoke )
41+ self .toolButton_eye .clicked .connect (
42+ self .on_server_toggle_api_password_view )
4243 # uploads
4344 self .toolButton_uploads_cache_browse .clicked .connect (
4445 self .on_uploads_browse )
@@ -112,22 +113,29 @@ def init_uploads(self):
112113 self .checkBox_upload_write_task_id .setChecked (bool (utwdid ))
113114 self .checkBox_upload_write_task_id .blockSignals (False )
114115
116+ @QtCore .pyqtSlot ()
117+ def on_downloads_browse (self ):
118+ default = self .settings .value ("downloads/default path" , "." )
119+ path = QtWidgets .QFileDialog .getExistingDirectory (
120+ self ,
121+ "Choose download location" ,
122+ default ,
123+ )
124+ if path and pathlib .Path (path ).exists ():
125+ self .lineEdit_downloads_path .setText (path )
126+
127+ @QtCore .pyqtSlot ()
128+ def on_downloads_path_apply (self ):
129+ path = self .lineEdit_downloads_path .text ()
130+ self .settings .setValue ("downloads/default path" , path )
131+
115132 @QtCore .pyqtSlot (bool )
116133 def on_general_check_for_updates (self , check_for_updates ):
117134 self .settings .setValue ("check for updates" ,
118135 int (bool (check_for_updates )))
119136
120137 @QtCore .pyqtSlot ()
121- def on_toggle_api_password_view (self ):
122- cur_em = self .lineEdit_api_key .echoMode ()
123- if cur_em == QtWidgets .QLineEdit .EchoMode .Normal :
124- new_em = QtWidgets .QLineEdit .EchoMode .PasswordEchoOnEdit
125- else :
126- new_em = QtWidgets .QLineEdit .EchoMode .Normal
127- self .lineEdit_api_key .setEchoMode (new_em )
128-
129- @QtCore .pyqtSlot ()
130- def on_api_token_renew (self ):
138+ def on_server_api_token_renew (self ):
131139 if self .ask_change_server_or_api_key ():
132140 api_key = self .settings .value ("auth/api key" )
133141 if len (api_key ) == 36 :
@@ -164,7 +172,7 @@ def on_api_token_renew(self):
164172 QtWidgets .QApplication .quit ()
165173
166174 @QtCore .pyqtSlot ()
167- def on_api_token_revoke (self ):
175+ def on_server_api_token_revoke (self ):
168176 if self .ask_change_server_or_api_key ():
169177 api_key = self .settings .value ("auth/api key" )
170178 if len (api_key ) == 36 :
@@ -188,46 +196,14 @@ def on_api_token_revoke(self):
188196 self .logger .info ("Exiting, because user revoked API token." )
189197 QtWidgets .QApplication .quit ()
190198
191- def on_downloads_browse (self ):
192- default = self .settings .value ("downloads/default path" , "." )
193- path = QtWidgets .QFileDialog .getExistingDirectory (
194- self ,
195- "Choose download location" ,
196- default ,
197- )
198- if path and pathlib .Path (path ).exists ():
199- self .lineEdit_downloads_path .setText (path )
200-
201- def on_downloads_path_apply (self ):
202- path = self .lineEdit_downloads_path .text ()
203- self .settings .setValue ("downloads/default path" , path )
204-
205- def on_uploads_browse (self ):
206- default = self .settings .value ("uploads/cache path" , "." )
207- path = QtWidgets .QFileDialog .getExistingDirectory (
208- self ,
209- "Choose upload cache location" ,
210- default ,
211- )
212- self .lineEdit_uploads_cache .setText (path )
213-
214199 @QtCore .pyqtSlot ()
215- def on_uploads_path_apply (self ):
216- current = self .settings .value ("uploads/cache path" , "." )
217- path_cache = self .lineEdit_uploads_cache .text ()
218- self .settings .setValue ("uploads/cache path" , path_cache )
219- if path_cache != current :
220- msg = QMessageBox ()
221- msg .setIcon (QMessageBox .Warning )
222- msg .setText ("In order for the new cache path to be used, please "
223- "restart DCOR-Aid!" )
224- msg .setWindowTitle ("Please restart DCOR-Aid" )
225- msg .exec ()
226-
227- @QtCore .pyqtSlot (bool )
228- def on_uploads_write_task_id (self , check_for_updates ):
229- self .settings .setValue ("uploads/update task with dataset id" ,
230- int (bool (check_for_updates )))
200+ def on_server_toggle_api_password_view (self ):
201+ cur_em = self .lineEdit_api_key .echoMode ()
202+ if cur_em == QtWidgets .QLineEdit .EchoMode .Normal :
203+ new_em = QtWidgets .QLineEdit .EchoMode .PasswordEchoOnEdit
204+ else :
205+ new_em = QtWidgets .QLineEdit .EchoMode .Normal
206+ self .lineEdit_api_key .setEchoMode (new_em )
231207
232208 @QtCore .pyqtSlot ()
233209 def on_show_server (self ):
@@ -297,6 +273,34 @@ def on_update_user(self):
297273 update_dict ["about" ] = self .plainTextEdit_user_about .toPlainText ()
298274 api .post ("user_update" , data = update_dict )
299275
276+ @QtCore .pyqtSlot ()
277+ def on_uploads_browse (self ):
278+ default = self .settings .value ("uploads/cache path" , "." )
279+ path = QtWidgets .QFileDialog .getExistingDirectory (
280+ self ,
281+ "Choose upload cache location" ,
282+ default ,
283+ )
284+ self .lineEdit_uploads_cache .setText (path )
285+
286+ @QtCore .pyqtSlot ()
287+ def on_uploads_path_apply (self ):
288+ current = self .settings .value ("uploads/cache path" , "." )
289+ path_cache = self .lineEdit_uploads_cache .text ()
290+ self .settings .setValue ("uploads/cache path" , path_cache )
291+ if path_cache != current :
292+ msg = QMessageBox ()
293+ msg .setIcon (QMessageBox .Warning )
294+ msg .setText ("In order for the new cache path to be used, please "
295+ "restart DCOR-Aid!" )
296+ msg .setWindowTitle ("Please restart DCOR-Aid" )
297+ msg .exec ()
298+
299+ @QtCore .pyqtSlot (bool )
300+ def on_uploads_write_task_id (self , check_for_updates ):
301+ self .settings .setValue ("uploads/update task with dataset id" ,
302+ int (bool (check_for_updates )))
303+
300304 @QtCore .pyqtSlot ()
301305 @show_wait_cursor
302306 def on_update_server (self ):
0 commit comments