예제 #1
0
 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 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()