def retryConnection(): """Tries to establish a Connection to Skype for configured amount of retries.""" retries=config.conf['advanced']['connectionRetries'] for retry in range(retries): currentConnectionRetry=retry+1 output.speak(_("Error! Skype attach timeout. Making retry %d of %d for 5 seconds.")%(currentConnectionRetry, retries)) time.sleep(5.000) try: globalVars.Skype.Attach() break except Skype4Py.errors.SkypeAPIError: if currentConnectionRetry>retries: output.speak(_("Error! Skype attach timeout. Please restart the application and try again. Exiting.")) interface.shutdown(silent=True) else: continue
def runUpdate(): globalVars.Frame.CloseDialog(downloadDLG) if fileName.endswith("Setup.exe"): info=_("Update ready to install! Choose Ok to exit %s and launch the update installation program.")%versionInfo.name else: info=_("Update ready! Choose Ok to continue.") msg=wx.MessageDialog(globalVars.Frame, info, _("Download completed"), wx.OK|wx.ICON_INFORMATION) globalVars.Frame.DisplayDialog(msg) answer=msg.ShowModal() if answer==wx.ID_OK: globalVars.Frame.CloseDialog(msg) logging.debug("Closing the application and starting the update.") try: interface.shutdown(False,True,False) wx.CallAfter(launcher.startNewProcess, fileName) except: logging.exception("Unable to launch the update process.")
def runUpdate(): globalVars.Frame.CloseDialog(downloadDLG) if fileName.endswith("Setup.exe"): info = _( "Update ready to install! Choose Ok to exit %s and launch the update installation program." ) % versionInfo.name else: info = _("Update ready! Choose Ok to continue.") msg = wx.MessageDialog(globalVars.Frame, info, _("Download completed"), wx.OK | wx.ICON_INFORMATION) globalVars.Frame.DisplayDialog(msg) answer = msg.ShowModal() if answer == wx.ID_OK: globalVars.Frame.CloseDialog(msg) logging.debug("Closing the application and starting the update.") try: interface.shutdown(False, True, False) wx.CallAfter(launcher.startNewProcess, fileName) except: logging.exception("Unable to launch the update process.")
def retryConnection(): """Tries to establish a Connection to Skype for configured amount of retries.""" retries = config.conf['advanced']['connectionRetries'] for retry in range(retries): currentConnectionRetry = retry + 1 output.speak( _("Error! Skype attach timeout. Making retry %d of %d for 5 seconds." ) % (currentConnectionRetry, retries)) time.sleep(5.000) try: globalVars.Skype.Attach() break except Skype4Py.errors.SkypeAPIError: if currentConnectionRetry > retries: output.speak( _("Error! Skype attach timeout. Please restart the application and try again. Exiting." )) interface.shutdown(silent=True) else: continue
if (initial - final) >= 25: count = count + 1 total_count = total_count + 1 print(f"{count}/{target_val}\tTotal: {total_count}") print(f"{initial} - {final}") if count == target_val: interface.toggle_relay_state() start_time = datetime.now() run_leds() count = 0 # Accounts for the occasional empty array, no valid values from ultrasonic elif (initial - final) == 0: continue time.sleep(3) # to avoid multiple detection time.sleep(0.1) # loop delay, should be less than detection delay except: GPIO.cleanup() if __name__ == "__main__": try: # If it was shut off using the "Close" button, reset the toggle on restart if interface.get_shutdown_state() == 1: interface.shutdown() run_sensors() except KeyboardInterrupt: GPIO.cleanup()