Skip to content

Commit

Permalink
fix: minor issue with --version and some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Sep 16, 2021
1 parent 17d797f commit a54abba
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.7.2
- fix: when --version is passed, don't load the entire UI to prevent
uploads/downlodas from blocking in the background
- ref: add pyqtSlots where appropriate
0.7.1
- fix: handle connection errors on startup when no internet connection
is available (#34)
Expand Down
3 changes: 3 additions & 0 deletions dcoraid/gui/download/widget_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,17 @@ def set_job_list(self, jobs):
# This is the actual initialization
self.jobs = jobs

@QtCore.pyqtSlot(str)
def on_job_abort(self, resource_id):
self.jobs.abort_job(resource_id)

@QtCore.pyqtSlot(str)
def on_job_delete(self, resource_id):
self.jobs.remove_job(resource_id)
self.clearContents()
self.update_job_status()

@QtCore.pyqtSlot(str)
def on_download_finished(self, resource_id):
"""Triggers download_finished whenever a download is finished"""
if resource_id not in self._finished_downloads:
Expand Down
17 changes: 11 additions & 6 deletions dcoraid/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ def __init__(self, *args, **kwargs):
and exit.
"""
super(DCORAid, self).__init__(*args, **kwargs)

# if "--version" was specified, print the version and exit
if "--version" in sys.argv:
print(__version__)
QtWidgets.QApplication.processEvents(QtCore.QEventLoop.AllEvents,
300)
sys.exit(0)

# Settings are stored in the .ini file format. Even though
# `self.settings` may return integer/bool in the same session,
# in the next session, it will reliably return strings. Lists
Expand Down Expand Up @@ -69,12 +77,7 @@ def __init__(self, *args, **kwargs):
path_ui = pkg_resources.resource_filename(
"dcoraid.gui", "main.ui")
uic.loadUi(path_ui, self)
# if "--version" was specified, print the version and exit
if "--version" in sys.argv:
print(__version__)
QtWidgets.QApplication.processEvents(QtCore.QEventLoop.AllEvents,
300)
sys.exit(0)

# GUI
# Preferences dialog
self.dlg_pref = PreferencesDialog()
Expand Down Expand Up @@ -140,6 +143,7 @@ def close(self):
3000)
super(DCORAid, self).close()

@QtCore.pyqtSlot()
def on_action_about(self):
dcor = "https://dcor.mpl.mpg.de"
gh = "DCOR-dev/DCOR-Aid"
Expand All @@ -155,6 +159,7 @@ def on_action_about(self):
"DCOR-Aid {}".format(__version__),
about_text)

@QtCore.pyqtSlot()
def on_action_software(self):
libs = [dclab,
requests,
Expand Down
2 changes: 1 addition & 1 deletion dcoraid/gui/upload/widget_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def set_actions_item(self, row, col, job):
"""
wid = self.cellWidget(row, col)
if wid is None:
wid = TableCellActions(job)
wid = TableCellActions(job, parent=self)
wid.delete_job.connect(self.on_job_delete)
wid.abort_job.connect(self.on_job_abort)
self.setCellWidget(row, col, wid)
Expand Down

0 comments on commit a54abba

Please sign in to comment.