def remove_wid(self): self.parent_class.selected_food_list.remove(self) from backend import CommonFunctions cl = CommonFunctions() cl.clear_layout(self) self.update_amount() self.parent_class.MW.mess('Food Removed')
def get_menu_func(): var.searched_food_list.clear() curr_wid.bt_get.setEnabled(False) from backend import CommonFunctions cl = CommonFunctions() cl.clear_layout(curr_wid.scroll_choose) MW.mess('Fetching Menu...') var.th_get_menu.start()
def finish_done_func(): MW.mess('Order Placed') from backend import CommonFunctions cl = CommonFunctions() cl.clear_layout(curr_wid.scroll_choose) cl.clear_layout(curr_wid.scroll_select) var.selected_food_list.clear() var.searched_food_list.clear() curr_wid.lb_amount.setText('0') curr_wid.rbt_north_ind.setChecked(True) curr_wid.rbt_starter.setChecked(True) curr_wid.rbt_veg.setChecked(False) curr_wid.bt_done.setEnabled(True)
def get_total_sale_func(): curr_wid.bt_t_sale.setEnabled(False) curr_wid.bt_get_orders.setEnabled(False) from backend import CommonFunctions CommonFunctions().clear_layout(curr_wid.scroll_history) MW.mess('Fetching...') var.th_get_orders.calling_func = 1 var.th_get_orders.run()
def finish_open_image(): from backend import CommonFunctions cl = CommonFunctions() cl.clear_layout(vertical_box) MW.mess('Image Retrieved') from os.path import expanduser, join from os import mkdir try: mkdir(join(expanduser('~'), 'Documents', 'Cyber_Temp')) except FileExistsError: pass try: mkdir(join(expanduser('~'), 'Documents', 'Cyber_Temp', 'Photos')) except FileExistsError: pass file_path = join(expanduser('~'), 'Documents', 'Cyber_Temp', 'Photos', str(var.th_fetch_image.ob_id) + '.jpg') with open(file_path, 'wb') as save_file: save_file.write(var.th_fetch_image.output) # Adding Image from PyQt5.QtGui import QPixmap pix = QPixmap(file_path) from PyQt5.QtWidgets import QLabel dialog_img.setWindowTitle(var.th_fetch_image.food_name) lb_img = QLabel() vertical_box.addWidget(lb_img) lb_img.setPixmap(pix) width_img = pix.width() height_img = pix.height() lb_img.setPixmap(pix.scaled(width_img, height_img)) dialog_img.resize(width_img, height_img) dialog_img.show()
def printing_bill(): from backend import CommonFunctions data_to_print = CommonFunctions().convert_to_bill( var.th_fetch_bill.bill_doc, var.th_fetch_bill.fetch_dict) from PyQt5.QtPrintSupport import QPrintDialog dialog = QPrintDialog() from PyQt5.QtGui import QTextDocument doc = QTextDocument() doc.setHtml(data_to_print) if dialog.exec_() == QPrintDialog.Accepted: doc.print_(dialog.printer()) MW.mess('Printing Done') else: MW.mess('Printing Rejected')
def finish_fetch_bill_func(self): self.parent_class.MW.mess('Bill Fetched') from backend import CommonFunctions self.parent_class.di_bill.set_n_run(CommonFunctions().convert_to_bill( self.parent_class.th_bill_fetch.bill_doc, self.parent_class.th_bill_fetch.fetch_dict))
def finish_refresh_bill_func(): from backend import CommonFunctions curr_wid.tb_bill.setText(CommonFunctions().convert_to_bill( var.th_refresh_bill.bill_doc, var.th_refresh_bill.fetch_dict)) MW.mess('Refreshed') curr_wid.bt_checkout.setEnabled(True)
def refresh_status_func(): curr_wid.bt_refresh_on_order.setEnabled(False) from backend import CommonFunctions CommonFunctions().clear_layout(curr_wid.scroll_on_order) MW.mess('Refreshing...') var.th_refresh_status.start()
def finish_get_total_sale_func(): MW.mess('Fetched') from backend import CommonFunctions var.di_bill.set_n_run(CommonFunctions().convert_to_total_sale( var.th_get_orders.output))