def ask_for_password(): global my_password FOO.change_flow(True) while FOO.flow_control_is(True): my_password = FOO.question(""" Now please enter your custom password. Create a new one if you don't have one already. Password: """) if not FOO.ANNOYANCE and my_password: FOO.text(""" Oops, sorry! That was plain-text. Don't worry, this is no error, it's just that \ I can't help it, because there's no cross-platform Python \ function that I know of which has predictable 'asterisk' behavior.""", """ Also, you're the developer, it's up to you to create your desired behavior. I'm \ but a humble automatic TUTORIAL.""", end = "") FOO.ANNOYANCE = True elif not my_password: if not FOO.ANNOYANCE2: FOO.text(""" Really!? No password? Well, we've got a badass here, your call.""", end = "") FOO.ANNOYANCE2 = True else: FOO.text("<blank password>", end = "", skip = True) FOO.yn_question(""" Do you want to change your password?""")
def ask_for_keys(force_change = False): ## Asks for keys, what else? global client_id, client_secret, password, keys if force_change: FOO.change_flow(True) else: FOO.yn_question ("""\ Do you want to set up new keys?""") while FOO.flow_control_is(True): FOO.text(""" Please type in your keys as asked""", skip = True) client_id = FOO.question ("... Client ID ..: ") client_secret = FOO.question (". Client Secret : ") password = FOO.question ("... Password ...: ") keys = {'client_id': client_id, 'client_secret': client_secret, 'password': password} FOO.yn_question ("""\ Do you want to make any changes to the previous keys?""") FOO.text(""" Alright! It seems you have your keys ready and you're good to go! """)
## 2: @567 [1] You see? It took you about half a second to read the sentence in line [1]. FOO.text("",""" That nonsense over there is our very own event logging. Admittedly, this was programmed before becoming \ aware that Python has logging functions on its own. Nevertheless this one suits our purposes: you get an entry number "n:", followed by a timestamp "@ms", \ then an optional follow-up indicator [m] when the entry refers to a previous operation, and then the \ explanation of whatever has just happened.""", """\ Now, back to the keys: You'll notice that some keys_loc.json file was mentioned, this file contains an index \ of the location of your key files, once they are created. """) ## Asking for username while not FOO.flow_control_is(True): username = FOO.question(""" Now please enter your username: """) while not username: FOO.text("Name cannot be blank.", skip = True) username = FOO.question(""" Now please enter your username: """) FOO.text(""" Nice to meet you {username}.""".format(username = username), skip = True) if not FOO.ANNOYANCE: FOO.text("""\ I am TUTORIAL, and as you can see, I'm a very basic user interface.""", skip = True) FOO.ANNOYANCE = True FOO.yn_question("""Are you sure your username is correct?""") FOO.text(""" The next step is to attempt retrieving your keys using retrieve_keys(). This function automatically calls \