示例#1
0
def scroll_button_display(object, class_type):
    text = 'scroll_button_display NOT SET UP FOR CLASS TYPE'
    bg="gray99"
    if class_type == 'task':
        from datetime import date
        from lib.task import Task
        till_due = Task.date_length(str(date.today()), object.due)
        till_deadline = ''
        text_deadline = ''
        if object.deadline != '':
            till_deadline = Task.date_length(str(date.today()), object.deadline)
            text_deadline = '[' + object.deadline + ' (' + str(till_deadline) + ')] '
        text = '[' + object.staff + '] '
        text += object.due + ' (' + str(till_due) + ')'
        text += ' - ' + object.property + ' - ' + text_deadline + object.message
        text += ' {' + object.next + '}'
        if till_due > 30: bg = 'grey'
        if till_due < 1: bg = 'orange'
        if till_due < 0: bg = 'tomato'
        if till_due < -5: bg = 'firebrick'
    if class_type == 'action':
        text = object.date + ' - ' + object.property + ' - ' + object.message
    if class_type == 'property':
        text = object.code + ' - ' + object.address
    if class_type == 'landlord':
        text =  object.code + ' - ' + object.surname + ', ' + object.first_names + ' (' + object.title + ') - ' + object.note
    if class_type == 'contact':
        text =  object.type + ' - ' + object.address + ' (' + object.note + ')'
    return text, bg
示例#2
0
    def see_window_right(window, user, number):
        row = 0
        column = 5
        Widget.line(window, user, '', row, column)
        column += 1

        break_line = ''
        for i in range(102): break_line += '-'

        text = '[' + user.task_list[number].staff + ']'
        text += ' (Startdate: ' + user.task_list[number].date + ')'
        text += ' Deadline: ' + user.task_list[number].deadline
        Widget.line(window, user, text, row, column)
        row += 1

        line = Property.address_from_code(user, user.task_list[number].property)
        Widget.title(window, user, line, row, column)
        row += 1

        text = 'Description: ' + user.task_list[number].message
        Widget.content(window, user, text, row, column)
        row += 1

        Widget.line(window, user, break_line, row, column)
        row += 1

        till_deadline = ''
        alert = False
        if user.task_list[number].deadline != '':
            till_deadline = Task.date_length(str(date.today()), user.task_list[number].deadline)
            if till_deadline < 1: alert = True
        line = 'Days till deadline: ' + str(till_deadline)
        Widget.line(window, user, line, row, column, alert)
        row += 1

        till_due = Task.date_length(str(date.today()), user.task_list[number].due)
        alert = False
        if till_due < 1: alert = True
        line = 'Days till due: ' + str(till_due)
        Widget.title(window, user, line, row, column, alert)
        row += 1

        text = 'Next Action: ' + user.task_list[number].next
        Widget.content(window, user, text, row, column)
        row += 1