def testHandlePyroErrors(self): def timeout(): raise Pyro4.errors.TimeoutError() def comms(): raise Pyro4.errors.CommunicationError() self._testDialogShowsWithText(handlePyroErrors(timeout), "Communication with the controller timed out.") self._testDialogShowsWithText(handlePyroErrors(comms), "(CommunicationError)") self._testDialogShowsWithText(handlePyroErrors(comms, "Extra message"), "Extra message")
def testHandlePyroErrors(self): def timeout(): raise Pyro4.errors.TimeoutError() def comms(): raise Pyro4.errors.CommunicationError() self._testDialogShowsWithText( handlePyroErrors(timeout), "Communication with the controller timed out.") self._testDialogShowsWithText(handlePyroErrors(comms), "(CommunicationError)") self._testDialogShowsWithText(handlePyroErrors(comms, "Extra message"), "Extra message")
def makeContent(self): layout = QVBoxLayout() lblVersion = QLabel() lblVersion.setText("av-control version {0} (avx version {1})".format(_ui_version, _avx_version)) layout.addWidget(lblVersion) self.lv = LogViewer(self.controller, self.mainWindow) log = ExpandingButton() log.setText("Log") log.clicked.connect(self.showLog) layout.addWidget(log) btnAutoTrack = ExpandingButton() btnAutoTrack.setText("Recalibrate Extras scan converter") btnAutoTrack.clicked.connect(handlePyroErrors(lambda: self.controller["Extras Scan Converter"].recalibrate())) layout.addWidget(btnAutoTrack) btnQuit = ExpandingButton() btnQuit.setText("Exit AV Control") btnQuit.clicked.connect(self.mainWindow.close) layout.addWidget(btnQuit) return layout
def _safelyConnect(signal, slot): signal.connect(handlePyroErrors(slot))