def onStart(self, *args, **kwarg): """ Verify user input and kick off the client's program if valid """ with transactUI(self): config = self.navbar.getActiveConfig() config.resetErrors() if config.isValid(): self.clientRunner.run(self.buildCliString()) self.showConsole() else: config.displayErrors() self.Layout()
def onStart(self, *args, **kwarg): """ Verify user input and kick off the client's program if valid """ with transactUI(self): config = self.navbar.getActiveConfig() config.resetErrors() if config.isValid(): self.clientRunner.run(self.buildCliString()) self.showConsole() else: config.displayErrors() self.Layout()
def onComplete(self, *args, **kwargs): """ Display the appropriate screen based on the success/fail of the host program """ with transactUI(self): if self.clientRunner.was_success(): self.showSuccess() if self.buildSpec.get('show_success_modal', True): wx.CallAfter(modals.showSuccess) else: if self.clientRunner.wasForcefullyStopped: self.showForceStopped() else: self.showError() wx.CallAfter(modals.showFailure)
def onComplete(self, *args, **kwargs): """ Display the appropriate screen based on the success/fail of the host program """ with transactUI(self): if self.clientRunner.was_success(): if self.buildSpec.get('return_to_config', False): self.showSettings() else: self.showSuccess() if self.buildSpec.get('show_success_modal', True): wx.CallAfter(modals.showSuccess) else: if self.clientRunner.wasForcefullyStopped: self.showForceStopped() else: self.showError() wx.CallAfter(modals.showFailure)
def onStartAsync(self, *args, **kwargs): with transactUI(self): try: errors = self.validateForm().getOrThrow() if errors: # TODO config = self.navbar.getActiveConfig() config.setErrors(errors) self.Layout() # TODO: account for tabbed layouts # TODO: scroll the first error into view # TODO: rather than just snapping to the top self.configs[0].Scroll(0, 0) else: if self.buildSpec['clear_before_run']: self.console.clear() self.clientRunner.run(self.buildCliString()) self.showConsole() except CalledProcessError as e: self.showError() self.console.appendText(str(e)) self.console.appendText( '\n\nThis failure happens when Gooey tries to invoke your ' 'code for the VALIDATE_FORM event and receives an expected ' 'error code in response.') wx.CallAfter(modals.showFailure) except JSONDecodeError as e: self.showError() self.console.appendText(str(e)) self.console.appendText( '\n\nGooey was unable to parse the response to the VALIDATE_FORM event. ' 'This can happen if you have additional logs to stdout beyond what Gooey ' 'expects.') wx.CallAfter(modals.showFailure) # for some reason, we have to delay the re-enabling of # the buttons by a few ms otherwise they pickup pending # events created while they were disabled. Trial and error # let to this solution. wx.CallLater(20, self.footer.start_button.Enable) wx.CallLater(20, self.footer.cancel_button.Enable)
def onEdit(self): """Return the user to the settings screen for further editing""" with transactUI(self): if self.buildSpec['poll_external_updates']: self.fetchExternalUpdates() self.showSettings()
def onEdit(self): """Return the user to the settings screen for further editing""" with transactUI(self): if self.buildSpec['poll_external_updates']: self.fetchExternalUpdates() self.showSettings()
def onEdit(self): """Return the user to the settings screen for further editing""" with transactUI(self): for config in self.configs: config.resetErrors() self.showSettings()