コード例 #1
0
def __main():
    # a conf in a separate file for the gui
    ex_conf = upref.load_conf(os.path.join(
        os.path.dirname(__file__), "example1.conf"))

    # get the data from the user
    data_ex1 = upref.get_pref(ex_conf, "example1")

    print("Ex1: url=%s" % data_ex1['url'])

    # remove the data
    upref.remove_pref("example1")

    data_ex1 = upref.get_pref(ex_conf, "example1")
    print("Ex1: url=%s" % data_ex1['url'])
    data_ex1 = upref.get_pref(ex_conf, "example1")
    print("Ex1: url=%s" % data_ex1['url'])

    print("I want somme data from the user that i could use now")
    print("I want to save it in a cool place")
    print("The second time, the data will be there.")
コード例 #2
0
ファイル: example04.py プロジェクト: IIXIXII/upref
def __main():
    # a conf in a separate file for the gui
    ex_conf = upref.load_conf(
        os.path.join(os.path.dirname(__file__), "example2.conf"))

    # get the data from the user
    data = upref.get_pref(ex_conf, "example2")

    print("The url of the super app is %s" % data['url'])
    print("Your login is %s" % data['login'])

    print("It is the wrong login !!!!")
    print("Remove it")
    upref.set_pref({'login': None}, name="example2")
コード例 #3
0
def __main():
    print("I want somme data from the user that i could use now")
    print("I want to save it in a coll place")
    print("The second time, the data will be there.")

    data = upref.get_pref(
        {
            'login': {
                'label': 'Your login'
            },
            'passwd': {
                'label': "Your secret password"
            },
        },
        name="myprog")

    print("Your login is %s" % data['login'])
    print("Your password is %s" % data['passwd'])
コード例 #4
0
ファイル: translate.py プロジェクト: IIXIXII/pymdtools
def _translation_parameter():
    data_conf = {
        'provider': {
            'label': "Provider for the translation",
            'description': "There is two provider : microsoft or mymemory",
            'value': 'mymemory',
        },
        'secret_access_key': {
            'label': "Secret key ",
            'description': "Secrect key to access the service",
            'value': '',
        },
    }
    parameter = upref.get_pref(data_conf, name="translation")

    secret_key = parameter['secret_access_key']
    if secret_key is None or len(secret_key) < 1:
        del parameter['secret_access_key']

    parameter['provider'] = parameter['provider'].lower()

    return parameter
コード例 #5
0
ファイル: example01.py プロジェクト: IIXIXII/upref
import upref

user_data = upref.get_pref(
    {"url": {"label": "The application url"}},
    "example01")

print("URL is {}".format(user_data['url']))
コード例 #6
0
ファイル: example02.py プロジェクト: IIXIXII/upref
import upref

data = upref.get_pref(
    {
        'login': {
            'label': "Your login"
        },
        'passwd': {
            'label': "Your secret password",
            'type': "Password"
        },
    },
    name="example02")
print("Your login is %s" % data['login'])
print("Your password (not so secret) is %s" % data['passwd'])