(parent, title, input_fields_label, input_fielf: bool = True)
| 1005 | |
| 1006 | |
| 1007 | def update_user(parent, title, input_fields_label, input_fielf: bool = True): |
| 1008 | page, main_layout = create_page_with_header(parent, title) |
| 1009 | content_frame = create_styled_frame(page) |
| 1010 | content_frame.setSizePolicy( |
| 1011 | QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding |
| 1012 | ) |
| 1013 | content_layout = QtWidgets.QVBoxLayout(content_frame) |
| 1014 | content_layout.alignment |
| 1015 | |
| 1016 | form_frame = create_styled_frame( |
| 1017 | content_frame, |
| 1018 | min_size=(400, 200), |
| 1019 | style="background-color: #ffffff; border-radius: 15px; padding: 10px;", |
| 1020 | ) |
| 1021 | form_layout = QtWidgets.QVBoxLayout(form_frame) |
| 1022 | form_layout.setSpacing(3) |
| 1023 | # Define input fields |
| 1024 | user = create_input_field(form_frame, "User Name: ", min_label_size=(180, 0)) |
| 1025 | user_balance = create_input_field(form_frame, "Balance: ", min_label_size=(180, 0)) |
| 1026 | |
| 1027 | # Add input fields to the form layout |
| 1028 | form_layout.addWidget(user[0]) |
| 1029 | form_layout.addWidget(user_balance[0]) |
| 1030 | if input_fielf: |
| 1031 | user_update_balance = create_input_field_V( |
| 1032 | form_frame, input_fields_label, min_label_size=(180, 0) |
| 1033 | ) |
| 1034 | form_layout.addWidget(user_update_balance[0]) |
| 1035 | |
| 1036 | # Store the input fields in variables |
| 1037 | user_account_name = user[1] |
| 1038 | user_account_name.setReadOnly(True) |
| 1039 | user_account_name.setStyleSheet( |
| 1040 | "background-color: #8a8a8a; border: 1px solid #ccc; border-radius: 4px; padding: 8px;" |
| 1041 | ) |
| 1042 | user_balance_field = user_balance[1] |
| 1043 | user_balance_field.setReadOnly(True) |
| 1044 | user_balance_field.setStyleSheet( |
| 1045 | "background-color: #8a8a8a; border: 1px solid #ccc; border-radius: 4px; padding: 8px;" |
| 1046 | ) |
| 1047 | if input_fielf: |
| 1048 | user_update_balance_field = user_update_balance[1] |
| 1049 | user_update_balance_field.setStyleSheet( |
| 1050 | "background-color: #f0f0f0; border: 1px solid #ccc; border-radius: 4px; padding: 8px;" |
| 1051 | ) |
| 1052 | |
| 1053 | # Set the font size for the input fields |
| 1054 | user_account_name.setFont(FONT_SIZE) |
| 1055 | user_balance_field.setFont(FONT_SIZE) |
| 1056 | if input_fielf: |
| 1057 | user_update_balance_field.setFont(FONT_SIZE) |
| 1058 | |
| 1059 | # Add a submit button |
| 1060 | submit_button = create_styled_button(form_frame, "Submit", min_size=(100, 50)) |
| 1061 | form_layout.addWidget(submit_button) |
| 1062 | content_layout.addWidget( |
| 1063 | form_frame, 0, QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter |
| 1064 | ) |
no test coverage detected