示例#1
0
def getScreen(stdscr):
    return Screen(stdscr, 8, 4, [Text(1, 2, 'Register')],
                  [[TextInput(2, 2, "Name")], [TextInput(3, 2, "ShortDsc")],
                   [TextInput(4, 2, "Desc")], [TextInput(5, 2, "Value")],
                   [TextInput(6, 2, "Category")],
                   [AddButton(7, 1, "Add"),
                    BackButton(7, 3, "Back")]])
示例#2
0
def getScreen(stdscr):
    return Screen(
        stdscr, 8, 4, [Text(1, 2, 'Register')],
        [[TextInput(2, 2, "Username")], [TextInput(3, 2, "Password")],
         [TextInput(4, 2, "First")], [TextInput(5, 2, "Last")],
         [TextInput(6, 2, "Role")],
         [RegisterButton(7, 1, "Register"),
          BackButton(7, 3, "Back")]])
def getScreen(stdscr, donations):
    rows = len(donations) + 3
    donations = [[
        DonationButton(i + 2, 1, donations[i]['name'], donations[i])
    ] for i in range(len(donations))]
    donations += [[BackButton(rows - 1, 1, "Back")]]

    sess = utils.getSession()
    return Screen(stdscr, rows, 4, [], donations)
示例#4
0
def getScreen(stdscr):
    sess = utils.getSession()
    inps = [
        SearchButton(2, 1, "Search"),
        AddButton(2, 2, "Add"),
        BackButton(2, 3, "Back")
    ] if sess['role'] == 'employees' or sess['role'] == 'managers' else [
        SearchButton(2, 1, "Search"),
        BackButton(2, 3, "Back")
    ]
    return Screen(
        stdscr, 3, 4,
        [Text(1, 2, 'Would you like to add or search for donations?')], [inps])
def getScreen(stdscr, location):
    loc = {
        'name': 0,
        'type': 1,
        'latitude': 2,
        'longitude': 3,
        'address': 4,
        'phone': 5
    }
    txts = [
        Text(loc[k] + 1, 1,
             ((k.upper() + ': ').ljust(15)) + str(location[k]).ljust(50))
        for k in location.keys() if k in loc
    ]
    return Screen(stdscr, 8, 2, txts, [[BackButton(7, 1, "Back")]])
示例#6
0
def getScreen(stdscr):
    r = requests.get(API_URL + '/locations')
    js = r.json()
    rows = len(js['locations']) + 4
    locations = [[LocationButton(i + 2, 2, js['locations'][i]['name'], js['locations'][i])] for i in range(len(js['locations']))]
    locations += [[DonationsButton(rows - 1, 1, "Donations"), MapButton(rows - 1, 2, "Map"), BackButton(rows - 1, 3, "Back")]]

    sess = utils.getSession()
    return Screen(
        stdscr,
        rows,
        4,
        [
            Text(1, 2, 'Welcome %s %s you are a %s.' % (sess['firstname'], sess['lastname'], sess['role'][:len(sess['role']) - 1]))
        ],
        locations
    )
示例#7
0
def getScreen(stdscr, donation):
    don = {
        'name': 0,
        'locationid': 1,
        'tstamp': 2,
        'shortdescription': 3,
        'description': 4,
        'comments': 5,
        'value': 6,
        'category': 7
    }
    txts = [
        Text(don[k] + 1, 1,
             ((k.upper() + ': ').ljust(20)) + str(donation[k]).ljust(50))
        for k in donation.keys() if k in don
    ]
    return Screen(stdscr, 10, 2, txts, [[BackButton(9, 1, "Back")]])
示例#8
0
def getScreen(stdscr):
    return Screen(
        stdscr, 5, 4, [Text(1, 2, 'Search')],
        [[TextInput(2, 2, "Category")], [TextInput(3, 2, "Name")],
         [SearchResultsButton(4, 1, "Search"),
          BackButton(4, 3, "Back")]])
示例#9
0
def getScreen(stdscr):
    return Screen(
        stdscr, 5, 4, [Text(1, 2, 'Login')],
        [[TextInput(2, 2, "Username")], [TextInput(3, 2, "Password")],
         [LoginButton(4, 1, "Login"),
          BackButton(4, 3, "Back")]])
def getScreen(stdscr):
    return Screen(
        stdscr, 3, 4, [Text(1, 2, 'Welcome to Donation Tracker')],
        [[LoginButton(2, 1, "Login"),
          RegisterButton(2, 3, "Register")]])