forked from M-Labs/artiq
1
0
Fork 0

gui: improve error handling

This commit is contained in:
Sebastien Bourdeauducq 2015-12-08 18:57:53 +08:00
parent 0da89557da
commit ed08352f67
2 changed files with 26 additions and 14 deletions

View File

@ -202,7 +202,7 @@ class _ArgumentEditor(QtGui.QTreeWidget):
try:
arginfo = await self.manager.compute_arginfo(self.expurl)
except:
logger.warning("Could not recompute argument '%s' of '%s'",
logger.error("Could not recompute argument '%s' of '%s'",
name, self.expurl, exc_info=True)
argument = self.manager.get_submission_arguments(self.expurl)[name]
@ -362,7 +362,7 @@ class _ExperimentDock(dockarea.Dock):
except:
# May happen when experiment has been removed
# from repository/explist
logger.warning("failed to submit '%s'",
logger.error("Failed to submit '%s'",
self.expurl, exc_info=True)
def reqterm_clicked(self):
@ -371,7 +371,7 @@ class _ExperimentDock(dockarea.Dock):
except:
# May happen when experiment has been removed
# from repository/explist
logger.warning("failed to request termination of instances of '%s'",
logger.error("Failed to request termination of instances of '%s'",
self.expurl, exc_info=True)
def _recompute_arguments_clicked(self):
@ -381,7 +381,7 @@ class _ExperimentDock(dockarea.Dock):
try:
arginfo = await self.manager.compute_arginfo(self.expurl)
except:
logger.warning("Could not recompute arguments of '%s'",
logger.error("Could not recompute arguments of '%s'",
self.expurl, exc_info=True)
self.manager.initialize_submission_arguments(self.expurl, arginfo)

View File

@ -9,17 +9,22 @@ from pyqtgraph import LayoutWidget
from artiq.gui.models import DictSyncTreeSepModel
logger = logging.getLogger(__name__)
class _OpenFileDialog(QtGui.QDialog):
def __init__(self, parent, exp_manager):
QtGui.QDialog.__init__(self, parent=parent)
self.setWindowTitle("Open file outside repository")
self.exp_manager = exp_manager
grid = QtGui.QGridLayout()
self.setLayout(grid)
grid.addWidget(QtGui.QLabel("Filename:"), 0, 0)
filename = QtGui.QLineEdit()
grid.addWidget(filename, 0, 1)
self.filename = QtGui.QLineEdit()
grid.addWidget(self.filename, 0, 1)
buttons = QtGui.QDialogButtonBox(
QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
@ -27,10 +32,17 @@ class _OpenFileDialog(QtGui.QDialog):
buttons.accepted.connect(self.accept)
buttons.rejected.connect(self.reject)
def open_file():
file = filename.text()
asyncio.ensure_future(exp_manager.open_file(file))
self.accepted.connect(open_file)
self.accepted.connect(self.open_file)
def open_file(self):
file = self.filename.text()
async def open_task():
try:
await self.exp_manager.open_file(file)
except:
logger.error("Failed to open file '%s'",
file, exc_info=True)
asyncio.ensure_future(open_task())
class Model(DictSyncTreeSepModel):