def init(inputCallback): global signatureMethodHmacSha1, token, consumer sDict = config.getConfigDict("auth", secrets) changed = False for key, value in sDict.items(): if value == "": sDict[key] = inputCallback(_("Enter the following secret variable: {}").format(key)) changed = True if changed: config.setDict("auth", sDict) config.saveConfig() signatureMethodHmacSha1 = oauth.SignatureMethod_HMAC_SHA1() token = oauth.Token(sDict["oauth_token"], sDict["oauth_token_secret"]) consumer = oauth.Consumer(sDict["consumer_key"], sDict["consumer_secret"])
def confirmAction(name, title, content): ''' Called to determine if an action needs confirmation. In case yes, shows confirm dialog. Saves if the user has checked "Do not ask again". :param name: str, identifier of the confirmation :param title: str, translated confirm dialog title :param content: str, translated confirm dialog content ''' if config.configFile.getboolean('confirm', name): response = showConfirm(title, content) if response['result'] and response['confirm']: config.configFile.set('confirm', name, str(False)) config.saveConfig() if not response['result']: return False return True