def message_prompt_func(): from backend.dialogs import DialogConfirmation message_box = DialogConfirmation('Do You Want To Replace') response = message_box.exec_() if response == message_box.Yes: var.th_add_img.signal.emit(True) elif response == message_box.No: curr_wid.cb_rm_food.clear() MW.mess('Image Already Available')
def checkout_func(): from backend.dialogs import DialogConfirmation message_box = DialogConfirmation('Are You Sure ?') if message_box.exec_() == message_box.Yes: curr_wid.bt_checkout.setEnabled(False) MW.mess('Finishing...') var.th_checkout.start() else: MW.mess('Cancelled')
def remove_chef_func(): from backend.dialogs import DialogConfirmation message_box = DialogConfirmation('Do You Want to Remove ?') if message_box.exec_() == message_box.Yes: curr_wid.bt_get_rm_chef.setEnabled(False) curr_wid.bt_rm_confirm.setEnabled(False) MW.mess('Removing...') var.th_remove_chef.start() else: MW.mess('Cancelled')
def done_func(): if not var.selected_food_list: MW.mess('No Food Selected') else: from backend.dialogs import DialogConfirmation message_box = DialogConfirmation('Proceed ?') if message_box.exec_() == message_box.Yes: curr_wid.bt_done.setEnabled(False) var.th_done_thread.start() else: MW.mess('Cancelled')
def remove_food_func(): from backend.dialogs import DialogConfirmation message_box = DialogConfirmation('Do You Want To Remove') response = message_box.exec_() if response == message_box.Yes: curr_wid.bt_rm_food.setEnabled(False) curr_wid.bt_add_img.setEnabled(False) curr_wid.bt_rm_img.setEnabled(False) curr_wid.bt_get.setEnabled(False) MW.mess('Removing...') var.th_remove_food.start() elif response == message_box.No: MW.mess('Cancelled')
def add_food_func(): MW.mess('Adding Food') in_name = curr_wid.le_f_name.text().strip() in_region = curr_wid.le_f_region.text().strip() in_type = curr_wid.le_f_type.text().strip() in_veg = curr_wid.le_f_veg.text().strip() in_price = curr_wid.le_price.text().strip() from backend import RegExValidation re_val = RegExValidation() from errors import InvalidNameError, InvalidRegionError, InvalidTypeError, InvalidBoolError, \ InvalidPriceError try: if not re_val.validFoodName(in_name): raise InvalidNameError if not re_val.validRegion(in_region): raise InvalidRegionError if not re_val.validType(in_type): raise InvalidTypeError if not re_val.validBool(in_veg): raise InvalidBoolError if not re_val.validPrice(in_price): raise InvalidPriceError if in_veg == 'True': in_veg = True else: in_veg = False message_script = ("{:<10}{:<20}\n" * 5).format('Name : ', in_name, 'Region : ', in_region, 'Type : ', in_type, 'Veg : ', str(in_veg), 'Price : ', in_price) from backend.dialogs import DialogConfirmation message_box = DialogConfirmation(message_script) if message_box.exec_() == DialogConfirmation.Yes: var.th_add_food.set_arg([in_name, in_region, in_type, in_veg, int(in_price)]) curr_wid.bt_add_food.setEnabled(False) var.th_add_food.start() else: MW.mess('Cancelled') except (InvalidNameError, InvalidRegionError, InvalidTypeError, InvalidBoolError, InvalidPriceError) as ob: MW.mess(str(ob))
def remove_food(self): if self.rm_quantity: from backend.dialogs import DialogConfirmation message_box = DialogConfirmation('Remove ' + str(self.rm_quantity) + ' Items ?') if message_box.exec_() == message_box.Yes: remove_btn = self.sender() self.parent_class.th_remove.set_arg(self.f_id, self.rm_quantity, remove_btn) remove_btn.setEnabled(False) self.parent_class.MW.mess('Removing...') self.parent_class.th_remove.start() else: self.parent_class.MW.mess('Cancelled') else: self.parent_class.MW.mess('Quantity is Zero')
def to_submit(): MW.mess('Creating Customer...') in_name = curr_wid.le_name.text().strip() in_table_no = curr_wid.le_tableno.text().strip() in_phone = curr_wid.le_phone.text().strip() in_mail = curr_wid.le_mail.text().strip() dialog_script = ('{:<10}{:<25}\n' * 4).format('Name : ', in_name, 'Table No.: ', in_table_no, 'Phone No. ', in_phone, 'Mail : ', in_mail) from backend import RegExValidation re_val = RegExValidation() from errors import InvalidNameError, InvalidPhoneError, TableNoError, InvalidEmailError try: if not re_val.validName(in_name): raise InvalidNameError if not re_val.validTable(in_table_no): raise TableNoError if not re_val.validPhone(in_phone): raise InvalidPhoneError if not re_val.validEmail(in_mail): raise InvalidEmailError var.th_create_customer.set_arg( [in_name, in_table_no, in_phone, in_mail]) from backend.dialogs import DialogConfirmation message_box = DialogConfirmation(dialog_script) message_box.resize(500, 200) if message_box.exec_() == DialogConfirmation.Yes: curr_wid.bt_get_started.setEnabled(False) curr_wid.bt_back.setEnabled(False) var.th_create_customer.start() else: MW.mess('Cancelled') except (InvalidNameError, InvalidPhoneError, TableNoError, InvalidEmailError) as ob: MW.mess(str(ob))
def add_chef_func(): MW.mess('Adding...') in_name = curr_wid.le_name.text().strip() in_phone = curr_wid.le_phone.text().strip() in_userid = curr_wid.le_userid.text().strip() in_password = curr_wid.le_password.text().strip() in_re_password = curr_wid.le_re_password.text().strip() from errors import InvalidNameError, InvalidPhoneError, InvalidUserIdError, \ InvalidPasswordError, PasswordNotMatchError from backend import RegExValidation re_val = RegExValidation() try: if not re_val.validName(in_name): raise InvalidNameError if not re_val.validPhone(in_phone): raise InvalidPhoneError if not re_val.validUserId(in_userid): raise InvalidUserIdError if not re_val.validPassword(in_password): raise InvalidPasswordError if in_password != in_re_password: raise PasswordNotMatchError message_script = ('{:<10}{:<20}\n' * 4).format( 'Name : ', in_name, 'Phone : ', in_phone, 'User Id : ', in_userid, 'Password : '******'Cancelled') except (InvalidNameError, InvalidPhoneError, InvalidUserIdError, InvalidPasswordError, PasswordNotMatchError) as ob: MW.mess(str(ob))