Beispiel #1
0
def start_change_login(main_root, login):
    """Create window for changes login"""
    root = Toplevel()
    root.title('Змінити: Логін')
    root.geometry('270x130')
    root.resizable(0, 0)
    root.focus_set()
    root.grab_set()

    label = Label(root, text='Логін')
    label.place(x=30, y=30)

    # New element
    new_element = StringVar()
    new_element_entry = Entry(root, textvariable=new_element)
    new_element_entry.place(x=100, y=30, width=140)

    # Buttons
    close_btn = Button(root, text='Закрити', command=root.destroy)
    close_btn.place(x=30, y=80, width=100)

    save_btn = Button(root,
                      text='Зберегти',
                      command=lambda: wd_confirmation.start(
                          'Бажаєте змінити?', lambda: save_login(
                              new_element, login, root, main_root)))
    save_btn.place(x=140, y=80, width=100)

    root.bind(
        '<Return>', lambda event: wd_confirmation.start(
            'Бажаєте змінити?', lambda: save_login(new_element, login, root,
                                                   main_root)))
Beispiel #2
0
def start_change_date(login):
    """Create window for changes date"""
    root = Toplevel()
    root.title('Змінити: Дату')
    root.geometry('450x130')
    root.resizable(0, 0)
    root.focus_set()
    root.grab_set()

    # Date of birthday containers
    day = IntVar(root)
    month = StringVar(root)
    year = IntVar(root)

    # Create input for data
    day_label = Label(root, text=' Дата народження:', padx=5, pady=5)
    day_label.place(x=30, y=20)

    day_options = range(1, 32)
    month_options = [
        'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень',
        'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
    ]
    year_options = range(datetime.date.today().year - 150,
                         datetime.date.today().year)

    day_input = OptionMenu(root, day, *day_options)
    day_input.place(x=155, y=20, width=50)
    month_input = OptionMenu(root, month, *month_options)
    month_input.place(x=205, y=20, width=100)
    year_input = OptionMenu(root, year, *year_options)
    year_input.place(x=305, y=20, width=100)

    # Buttons
    close_btn = Button(root, text='Закрити', command=root.destroy)
    close_btn.place(x=30, y=80, width=100)

    save_btn = Button(root,
                      text='Зберегти',
                      command=lambda: wd_confirmation.start(
                          'Бажаєте змінити?', lambda: save_date(
                              day, month, year, login, root)))
    save_btn.place(x=310, y=80, width=100)

    root.bind(
        '<Return>', lambda event: wd_confirmation.start(
            'Бажаєте змінити?', lambda: save_date(day, month, year, login, root
                                                  )))
Beispiel #3
0
def start():
    """Create Login window"""
    # Create window
    root = Tk()
    root.title('Вхід (Головна)')
    root.geometry('270x150')
    root.resizable(0, 0)

    # login container
    login = StringVar()

    # Create Label and Entry for login
    login_label = Label(root, text='Логін: ', padx=5, pady=5)
    login_label.place(x=30, y=20)
    login_entry = Entry(root, textvariable=login)
    login_entry.place(x=100, y=25)

    # password container
    password = StringVar()

    # Create Label and Entry for password
    password_label = Label(root, text='Пароль: ', padx=5, pady=5)
    password_label.place(x=30, y=50)
    password_entry = Entry(root, textvariable=password, show="•")
    password_entry.place(x=100, y=50)

    # Buttons
    login_button = Button(root,
                          text=' Увійти ',
                          command=lambda: log_in(login, password_entry, root))
    login_button.place(x=30, y=110)
    root.bind('<Return>', lambda event: log_in(login, password_entry, root))
    registration_button = Button(root,
                                 text=' Реєстрація ',
                                 command=wd_registration.start)
    registration_button.place(x=85, y=110)
    exit_button = Button(
        root,
        text=' Вихід ',
        command=lambda: wd_confirmation.start('Бажаєте вийти?', root.destroy))
    exit_button.place(x=200, y=110)

    root.mainloop()
Beispiel #4
0
def start(user):
    """Create user window"""
    root = Tk()
    root.title('Власний кабінет: ' + user.login)
    root.geometry('400x370')
    root.resizable(0, 0)

    # Name option
    name_label = Label(root, text='Імя: ' + user.name, padx=5, pady=5)
    name_label.place(x=30, y=30, width=190)

    name_change_button = Button(root, text='Змінити',
                                command=lambda: wd_change.start_change_button('name', user.login))
    name_change_button.place(x=220, y=30, width=150)

    # Surname option
    surname_label = Label(root, text='Прізвище: ' + user.surname, padx=5, pady=5)
    surname_label.place(x=30, y=60, width=190)

    surname_change_button = Button(root, text='Змінити',
                                   command=lambda: wd_change.start_change_button('surname', user.login))
    surname_change_button.place(x=220, y=60, width=150)

    # Date option
    date_label = Label(root, text='Дата народження: {} {} {}'.format(user.day, user.month, user.year), padx=5, pady=5)
    date_label.place(x=30, y=90, width=190)

    date_change_button = Button(root, text='Змінити', command=lambda: wd_change.start_change_date(user.login))
    date_change_button.place(x=220, y=90, width=150)

    # Telephone option
    telephone_label = Label(root, text='Телефон: ' + user.telephone, padx=5, pady=5)
    telephone_label.place(x=30, y=120, width=190)

    telephone_change_button = Button(root, text='Змінити',
                                     command=lambda: wd_change.start_change_button('telephone', user.login))
    telephone_change_button.place(x=220, y=120, width=150)

    # Login option
    login_label = Label(root, text='Логін: ' + user.login, padx=5, pady=5)
    login_label.place(x=30, y=160, width=190)

    login_change_button = Button(root, text='Змінити',
                                 command=lambda: wd_change.start_change_login(root, user.login))
    login_change_button.place(x=220, y=160, width=150)

    # Password option
    password = StringVar(root)
    repeat_password = StringVar(root)

    password_label = Label(root, text='Новий пароль: ', padx=5, pady=5)
    password_label.place(x=30, y=190, width=190)
    password_entry = Entry(root, textvariable=password, show='•')
    password_entry.place(x=220, y=190, width=150)

    repeat_password_label = Label(root, text='Повторити пароль: ', padx=5, pady=5)
    repeat_password_label.place(x=30, y=220, width=190)
    repeat_password_entry = Entry(root, textvariable=repeat_password, show='•')
    repeat_password_entry.place(x=220, y=220, width=150)

    password_change_button = Button(root, text='Змінити',
                                    command=lambda: wd_change.start_change_password(password, repeat_password,
                                                                                    user.login, root)
                                    )
    password_change_button.place(x=220, y=250, width=150)

    # Status option
    status_label = Label(root, text='Статус: ' + user.permission, padx=5, pady=5)
    status_label.place(x=30, y=280, width=340)

    # Buttons
    update_button = Button(root, text=' Оновити ', command=lambda: update_window(user.login, root))
    update_button.place(x=30, y=320, width=165)
    exit_button = Button(root, text=' Вихід ', command=lambda: wd_confirmation.start('Бажаєте вийти?', root.destroy))
    exit_button.place(x=205, y=320, width=165)

    root.mainloop()
Beispiel #5
0
def start_change_password(password, repeat_password, login, root):
    """Chane password"""
    wd_confirmation.start(
        'Змінити пароль?',
        lambda: save_password(password, repeat_password, login, root))
Beispiel #6
0
def start(filter_element='', filter_value=''):
    """Start admin window"""
    root = Tk()
    root.title('Панель адміністрування')
    root.geometry("820x205")
    root.resizable(0, 0)

    # Filters container
    element = StringVar(root)
    variable = StringVar(root)

    # User options
    users = create_users_dictionary(filter_element, filter_value)

    # User container
    select_user = StringVar(root)
    select_user.set(next(iter(users)))

    # Main Label
    label = Label(root, text=' Користувачі:', padx=5, pady=5)
    label.place(x=10, y=20, width=800)

    # Users input
    users_input = OptionMenu(root, select_user, *users)
    users_input.place(x=10, y=50, width=800)

    # Filter option
    filter_option = [
        '', 'login', 'name', 'surname', 'telephone', 'password', 'day',
        'month', 'year'
    ]

    # Filters Label
    filter_text = Label(root, text='Фільтер')
    filter_text.place(x=0, y=90, width=800)
    filter_label = Label(root, text='Поле:')
    filter_label.place(x=10, y=120, height=30)
    variable_label = Label(root, text='Значення:')
    variable_label.place(x=160, y=120, height=30)

    # Filters Input
    filter_input = OptionMenu(root, element, *filter_option)
    filter_input.place(x=50, y=120, width=100)
    variable_input = Entry(root, textvariable=variable)
    variable_input.place(x=230, y=122, height=25)

    # Active filters
    filter_button = Button(
        root,
        text='Фільтрувати',
        command=lambda: update_window(element.get(), variable.get(), root))
    filter_button.place(x=610, y=120, width=200)

    # Button
    open_button = Button(text='Відкрити',
                         command=lambda: wd_user.start(
                             wdf_login.User(users[select_user.get()])))
    open_button.place(x=10, y=170, width=200)
    deleted_button = Button(
        text='Видалити',
        command=lambda: wd_confirmation.start(
            'Видалити користувача?', lambda: deleted_user(
                wdf_login.User(users[select_user.get()]), root)))
    deleted_button.place(x=220, y=170, width=200)
    close_button = Button(
        text='Вийти',
        command=lambda: wd_confirmation.start('Бажаєте вийти?', root.destroy))
    close_button.place(x=610, y=170, width=200)

    root.mainloop()