'''
Created on Oct 10, 2010

@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
from tkinter import Toplevel, StringVar, N, S, E, W, EW, DISABLED, NORMAL, messagebox
try:
    from tkinter.ttk import Frame, Button, Label, Entry
except ImportError:
    from ttk import Frame, Button, Label, Entry
from arelle.CntlrWinTooltip import ToolTip
from arelle.UiUtil import checkbox, gridCombobox
import sys
try:
    import regex as re
except ImportError:
    import re

'''
caller checks accepted, if True, caller retrieves url
'''
def askUserPassword(parent, host, realm, untilDoneEvent, result):
    dialog = DialogUserPassword(parent, _("Authentication Request"), host=host, realm=realm)
    if dialog.accepted:
        result.append( (dialog.user, dialog.password) )
    else:
        result.append( None )
    untilDoneEvent.set()

def askProxy(parent, priorProxySettings):
    if isinstance(priorProxySettings,(tuple,list)) and len(priorProxySettings) == 5:
        useOsProxy, urlAddr, urlPort, user, password = priorProxySettings