browser: cleanup

This commit is contained in:
Robert Jördens 2016-05-09 00:32:15 +02:00
parent 4fee2055a5
commit 4c78bb4950
1 changed files with 22 additions and 24 deletions

View File

@ -152,7 +152,7 @@ log_levels = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
class _ExperimentDock(QtWidgets.QMdiSubWindow): class _ExperimentDock(QtWidgets.QMdiSubWindow):
sigClosed = QtCore.pyqtSignal() sigClosed = QtCore.pyqtSignal()
def __init__(self, area, expurl, arguments, worker_handlers): def __init__(self, area, expurl, arguments):
QtWidgets.QMdiSubWindow.__init__(self) QtWidgets.QMdiSubWindow.__init__(self)
self.setWindowTitle(expurl) self.setWindowTitle(expurl)
self.setWindowIcon(QtWidgets.QApplication.style().standardIcon( self.setWindowIcon(QtWidgets.QApplication.style().standardIcon(
@ -168,7 +168,6 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
self._area = area self._area = area
self.expurl = expurl self.expurl = expurl
self.worker_handlers = worker_handlers
self.arguments = arguments self.arguments = arguments
self.argeditor = _ArgumentEditor(self) self.argeditor = _ArgumentEditor(self)
@ -195,25 +194,25 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
log_level.currentIndexChanged.connect(update_log_level) log_level.currentIndexChanged.connect(update_log_level)
self.log_level = log_level self.log_level = log_level
submit = QtWidgets.QPushButton("Analyze") run = QtWidgets.QPushButton("Analyze")
submit.setIcon(QtWidgets.QApplication.style().standardIcon( run.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_DialogOkButton)) QtWidgets.QStyle.SP_DialogOkButton))
submit.setToolTip("Run analysis stage (Ctrl+Return)") run.setToolTip("Run analysis stage (Ctrl+Return)")
submit.setShortcut("CTRL+RETURN") run.setShortcut("CTRL+RETURN")
submit.setSizePolicy(QtWidgets.QSizePolicy.Expanding, run.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Expanding) QtWidgets.QSizePolicy.Expanding)
self.layout.addWidget(submit, 1, 4, 2, 1) self.layout.addWidget(run, 1, 4, 2, 1)
submit.clicked.connect(self.submit_clicked) run.clicked.connect(self.run_clicked)
reqterm = QtWidgets.QPushButton("Terminate") terminate = QtWidgets.QPushButton("Terminate")
reqterm.setIcon(QtWidgets.QApplication.style().standardIcon( terminate.setIcon(QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_DialogCancelButton)) QtWidgets.QStyle.SP_DialogCancelButton))
reqterm.setToolTip("Terminate analysis (Ctrl+Backspace)") terminate.setToolTip("Terminate analysis (Ctrl+Backspace)")
reqterm.setShortcut("CTRL+BACKSPACE") terminate.setShortcut("CTRL+BACKSPACE")
reqterm.setSizePolicy(QtWidgets.QSizePolicy.Expanding, terminate.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Expanding) QtWidgets.QSizePolicy.Expanding)
self.layout.addWidget(reqterm, 3, 4) self.layout.addWidget(terminate, 3, 4)
reqterm.clicked.connect(self.reqterm_clicked) terminate.clicked.connect(self.terminate_clicked)
def dragEnterEvent(self, ev): def dragEnterEvent(self, ev):
if ev.mimeData().hasFormat("text/uri-list"): if ev.mimeData().hasFormat("text/uri-list"):
@ -262,16 +261,16 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
await self._recompute_arguments(arguments) await self._recompute_arguments(arguments)
def submit_clicked(self): def run_clicked(self):
try: try:
pass # TODO pass # TODO
except: except:
# May happen when experiment has been removed # May happen when experiment has been removed
# from repository/explist # from repository/explist
logger.error("Failed to submit '%s'", logger.error("Failed to run '%s'",
self.expurl, exc_info=True) self.expurl, exc_info=True)
def reqterm_clicked(self): def terminate_clicked(self):
try: try:
pass # TODO pass # TODO
except: except:
@ -395,13 +394,12 @@ class ExperimentsArea(QtWidgets.QMdiArea):
def open_experiment(self, expurl, arguments): def open_experiment(self, expurl, arguments):
try: try:
dock = _ExperimentDock(self, expurl, arguments, dock = _ExperimentDock(self, expurl, arguments)
self.worker_handlers)
except: except:
logger.warning("Failed to create experiment dock for %s, " logger.warning("Failed to create experiment dock for %s, "
"retrying with arguments reset", expurl, "retrying with arguments reset", expurl,
exc_info=True) exc_info=True)
dock = _ExperimentDock(self, expurl, {}, self.worker_handlers) dock = _ExperimentDock(self, expurl, {})
asyncio.ensure_future(dock._recompute_arguments()) asyncio.ensure_future(dock._recompute_arguments())
self.addSubWindow(dock) self.addSubWindow(dock)
dock.show() dock.show()