def set_status(status): # print('IN set_status1') purchase2set_status = get_object() # print(purchase2set_status) # status = 1 purchase = Purchase() purchase.set_status(purchase2set_status, status)
def set_status0(): print('IN set_status0') purchase2set_status = get_object() print(purchase2set_status) status = 0 purchase = Purchase() purchase.set_status(purchase2set_status, status)
def delete_position(): # print('IN delete_position') purchase2deleted = get_object_name() # print(purchase2deleted) purchase = Purchase() purchase.delete_position(purchase2deleted) get_all_positions() # LifeHack!!! AutoUpdate)))
def delete_position(): print('IN delete_position') purchase2deleted = get_object() print(purchase2deleted) # new_quantity = window.lineEdit_set_quantity.text() purchase = Purchase() # print(new_quantity) purchase.delete_position(purchase2deleted)
def set_status(status): # print('IN set_status1') purchase2set_status = get_object_name() # print(purchase2set_status) # status = 1 purchase = Purchase() purchase.set_status(purchase2set_status, status) get_all_positions()
def set_quantity(): print('IN set_quantity') if check_object() and check_quantity(): purchase2edit = get_object() print(purchase2edit) new_quantity = window.lineEdit_set_quantity.text() purchase = Purchase() print(new_quantity) purchase.set_quantity(purchase2edit, new_quantity) else: pass
def set_quantity(): # print('IN set_quantity') if check_object() and check_quantity(): purchase2edit = get_object() # print(purchase2edit) new_quantity = window.lineEdit_set_quantity.text() purchase = Purchase() # print(new_quantity) purchase.set_quantity(purchase2edit, new_quantity) else: pass # TODO: необходимо задать количество
def set_purchase_date(): print('IN set_purchase_date') validated_data = valid_data() if check_object() and validated_data: purchase2edit = get_object() print(purchase2edit) new_date = window.lineEdit_set_purchase_date.text() purchase = Purchase() print(new_date) purchase.set_purchase_date(purchase2edit, new_date) else: pass
def get_object(): selected_object_number = window.listWidget_purchase_list.currentRow() if selected_object_number >= 0: # print(selected_object_number) # print(window.listWidget_purchase_list.currentItem().text()) purchase = Purchase() selected_object_name = purchase.get_all_positions()[selected_object_number]['name'] # print(str(selected_object_name)) # print('*' * 10) return selected_object_name else: pass # TODO: необходимо выделить объект для редактирования
def get_all_positions(): purchase = Purchase() window.listWidget_purchase_list.clear() for purchase in purchase.get_all_positions(): item = QListWidgetItem(f'{str(purchase["name"])} : {str(purchase["quantity"])} ' f'{str(purchase["unit_of_measurement"])} (Purchased date: ' f'{str(purchase["purchase_date"])}) : ' f'Status: {str(purchase["status"])}') if str(purchase["status"]) == '1': item.setBackground(QColor('#7fc97f')) window.listWidget_purchase_list.addItem(item) else: window.listWidget_purchase_list.addItem(item)
def get_object(): selected_object_number = window.listWidget_purchase_list.currentRow() if selected_object_number >= 0: print(selected_object_number) print(window.listWidget_purchase_list.currentItem().text()) purchase = Purchase() selected_object_name = purchase.get_all_positions( )[selected_object_number]['name'] print(str(selected_object_name)) print('*' * 10) # selected_purchase = selected_object_name return selected_object_name else: pass
def add_new_position(): check = line_edit_checking() purchase = Purchase() if check: my_dict = { "name": window.lineEdit_name.text(), "quantity": window.lineEdit_quantity.text(), "unit_of_measurement": window.lineEdit_unit_of_measurement.text(), "purchase_date": window.lineEdit_purchase_date.text(), "status": 0 } purchase.add_new_position(my_dict) else: pass
def delete_position(): # print('IN delete_position') purchase2deleted = get_object() # print(purchase2deleted) purchase = Purchase() purchase.delete_position(purchase2deleted)