Esempio n. 1
0
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: необходимо выделить объект для редактирования
Esempio n. 2
0
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)
Esempio n. 3
0
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