Ejemplo n.º 1
0
def setup_userWidget(username, password):
    widget = QWidget()
    widget.layout = QHBoxLayout()
    widget.layout.setMargin(0)

    widget.username = QLineEdit(username)
    widget.username.setReadOnly(True)
    widget.password = QLineEdit(password)
    widget.password.setReadOnly(True)
    widget.password.setEchoMode(QLineEdit.Password)

    widget.reveal = QPushButton("Reveal")
    widget.reveal.pressed.connect(
        lambda arg1=widget.password, arg2=widget.reveal:
        switch_password_print_mode(arg1, arg2))

    widget.delete = QPushButton("Delete")
    widget.delete.pressed.connect(lambda arg1=widget: delete_user(arg1))

    widget.layout.addWidget(widget.username)
    widget.layout.addWidget(widget.password)
    widget.layout.addWidget(widget.reveal)
    widget.layout.addWidget(widget.delete)

    widget.setLayout(widget.layout)
    widget.setContentsMargins(1, 1, 1, 1)
    return widget
    pass