Beispiel #1
0
def getpass(prompt=None, stream=sys.stdout):
    NSBundle = ObjCClass("NSBundle")
    if NSBundle.mainBundle.bundlePath.pathExtension == "appex":
        return None
    
    if prompt is None:
        prompt = ""
        
    print(prompt, end="")
    
    PyInputHelper.userInput = None
    
    try:
        PyInputHelper.getPassWithPrompt(prompt, script=threading.current_thread().script_path)
    except AttributeError:
        PyInputHelper.getPassWithPrompt(prompt, script=None)
    
    
    while PyInputHelper.userInput is None or threading.currentThread() in ignoredThreads:
        continue
    
    userInput = PyInputHelper.userInput
    PyInputHelper.userInput = None
    
    return str(userInput)
Beispiel #2
0
def getpass(prompt=None, stream=sys.stdout):
    NSBundle = ObjCClass("NSBundle")
    if NSBundle.mainBundle.bundlePath.pathExtension == "appex":
        return None
    
    if prompt is None:
        prompt = ""
        
    print(prompt, end="")
    
    try:
        path = threading.current_thread().script_path
    except AttributeError:
        path = ""
    
    try:
        del PyInputHelper.userInput[path]
    except:
        pass
    
    try:
        PyInputHelper.getPassWithPrompt(prompt, script=threading.current_thread().script_path)
    except AttributeError:
        PyInputHelper.getPassWithPrompt(prompt, script=None)
    
    
    while path not in PyInputHelper.userInput or threading.currentThread() in ignoredThreads:
        time.sleep(0.2)
    
    userInput = PyInputHelper.userInput[path]
    del PyInputHelper.userInput[path]
    
    time.sleep(0.2)
    
    return str(userInput)
Beispiel #3
0
def getpass(prompt="Password: "******"NSBundle")
    if NSBundle.mainBundle.bundlePath.pathExtension == "appex":
        return None

    if prompt is None:
        prompt = ""

    print(prompt, end="")

    try:
        path = threading.current_thread().script_path
    except AttributeError:
        path = ""

    try:
        PyInputHelper.getPassWithPrompt(
            prompt, script=threading.current_thread().script_path)
    except AttributeError:
        PyInputHelper.getPassWithPrompt(prompt, script=None)

    userInput = PyInputHelper.waitForInput(path)

    if userInput == "<WILL INTERRUPT>":  #  Will raise KeyboardInterrupt, don't return
        while True:
            time.sleep(0.2)

    return str(userInput)
Beispiel #4
0
def getpass(prompt="", stream=sys.stdout):
    if __host__ is widget:
        return None

    NSBundle = ObjCClass("NSBundle")
    if NSBundle.mainBundle.bundlePath.pathExtension == "appex":
        return None

    PyInputHelper.userInput = None

    PyInputHelper.getPassWithPrompt(prompt)

    while PyInputHelper.userInput == None or threading.currentThread(
    ) in ignoredThreads:
        continue

    userInput = PyInputHelper.userInput
    PyInputHelper.userInput = None

    return str(userInput)