Exemplo n.º 1
0
    def __init__(self, conf_path):
        QtGui.QWidget.__init__(self)
        Ui_Procedure.__init__(self)
        self.setupUi(self)
        self.db_api = db_api.DBApi(
            utils.get_conf_value(conf_path, 'db', 'db_path'))

        self.image_advertisement_path = utils.get_static_images_path(
            conf_path, 'image_advisediment_name')
        self.image_advertisement_path_other = utils.get_static_images_path(
            conf_path, 'image_advisediment_name2')
        self.image_guide_path = utils.get_static_images_path(
            conf_path, 'image_guide_name')
        self.image_recogniting_path = utils.get_static_images_path(
            conf_path, 'image_recogniting_name')
        self.image_unidentified_path = utils.get_static_images_path(
            conf_path, 'image_unidentified_name')

        self.guide_timeout = int(
            utils.get_conf_value(conf_path, 'guide', 'timeout'))
        self.unidentified_timeout = int(
            utils.get_conf_value(conf_path, 'unidentified', 'timeout'))

        self.rec_sys_path = utils.get_static_images_path(
            conf_path, 'rec_sys_name')
        self.pra_sys_path = utils.get_static_images_path(
            conf_path, 'pra_sys_name')
        self.save_image_base_path = utils.get_conf_value(
            conf_path, 'cache_fruits_images', 'save_image_base_path')
        self.pra_button.setStyleSheet("QPushButton{border-image: url(%s)}" %
                                      self.pra_sys_path)
        self.rec_button.setStyleSheet("QPushButton{border-image: url(%s)}" %
                                      self.rec_sys_path)

        self.advertisement_movie = QMovie(self.image_advertisement_path)
        self.guide_movie = QMovie(self.image_guide_path)
        self.recogniting_movie = QMovie(self.image_recogniting_path)
        self.unidentified_movie = QMovie(self.image_unidentified_path)

        self.advertisement_button.clicked.connect(self.show_guide_ui)
        self.setWindowFlags(Qt.Qt.FramelessWindowHint)

        self.running_dialog = ''
        self.timeout_timer = QTimer()
        self.timeout_timer.timeout.connect(self.timeout_handler)

        self.image_choice_system_path = utils.get_static_images_path(
            conf_path, 'image_logo_name')
        self.pra_button.clicked.connect(self.show_praitce_dialog)
        self.rec_button.clicked.connect(self.show_advertisment_ui)
        self.return_choice_button.clicked.connect(self.upload_cloud)
        self.choice_system()
        self.change_shop_button.clicked.connect(self.show_praitce_dialog)
        self.file_path = ''
        self.practice_mode = False
        self.qthread = UploadImage(self.save_image_base_path)
        self.qthread.signal_upload_resp.connect(self.set_if_success_label)
        self.setStyleSheet("QPushButton{outline: none}")
Exemplo n.º 2
0
 def __init__(self, conf_path, procedure_dialog, mesgbox):
     QtGui.QWidget.__init__(self)
     Ui_Pay.__init__(self)
     self.setupUi(self)
     self.setWindowFlags(Qt.Qt.FramelessWindowHint)
     self.procedure_dialog = procedure_dialog
     # self.qrcode_str_qthread = GetInputQrcodeStr()
     # self.qrcode_str_qthread.signal_qrcodestr_resp.connect(self.get_qrcode_str_fun)
     self.db_api = db_api.DBApi(
         utils.get_conf_value(conf_path, 'db', 'db_path'))
     self.status = 0
     self.pay_way = 0
     self.order_info = {}
     self.mesgbox = mesgbox
     self.label_title.setStyleSheet(
         "QLabel{border-image: url(%s)}" %
         utils.get_static_images_path(conf_path, 'image_title_name'))
     self.button_home.setStyleSheet(
         "QPushButton{background-image: url(%s)}" %
         utils.get_static_images_path(conf_path, 'image_home_name'))
     self.image_success_path = utils.get_static_images_path(
         conf_path, 'image_success_name')
     self.pay_notice_bg.setStyleSheet(
         "QLabel{border-image: url(%s)}" %
         utils.get_static_images_path(conf_path, 'pay_tip_name'))
     self.pay_notice_bg.show()
     self.image_fail_path = utils.get_static_images_path(
         conf_path, 'image_fail_name')
     self.image_wechat_background_path = utils.get_static_images_path(
         conf_path, 'image_wechat_background_name')
     # self.image_alipay_background_path = utils.get_static_images_path(conf_path, 'image_alipay_background_name')
     self.label_success.hide()
     self.conf_path = conf_path
     self.pay_timeout = int(
         utils.get_conf_value(conf_path, 'pay', 'timeout'))
     self.delayed_to_guide_timeout = int(
         utils.get_conf_value(conf_path, 'pay', 'delayed_to_guide_timeout'))
     self.time_count = 0
     self.timer_print = QTimer()
     self.timer_print.timeout.connect(self.print_goods)
     self.timer_task = WAITING_PAYMENT
     self.label_time.setAlignment(QtCore.Qt.AlignRight)
     self.printer = printer.ReceiptPrinter()
     self.qrcode_str = ''
     logger.info("Printer initialization finished.")
     # 获取二维码字符串
     self.timer_qrcode = QTimer()
     self.timer_qrcode.timeout.connect(self.get_qrcode)
     self.lineEdit.textChanged.connect(self.onChanged)
     self.label_time.hide()
Exemplo n.º 3
0
 def __init__(self, conf_path):
     super(WeightThread, self).__init__()
     self.history = []
     self.history_size = 4
     self.last_steady = 0
     self.interval = 0.12
     self.var_threshold = 5
     self.avr_threshold = 50
     self.db_api = db_api.DBApi(
         utils.get_conf_value(conf_path, 'db', 'db_path'))
     self.SCK_PORT = 15
     self.DT_PORT = 16
     self.libweight = CDLL("./clib/libweight.so")
     if self.libweight.init_weight(self.DT_PORT, self.SCK_PORT) != 0:
         logger.info("init weight error.")
     else:
         logger.info("init weight ok.")
Exemplo n.º 4
0
 def __init__(self):
     # self.led = led.Led(38, 40, 36)
     # 初始化界面
     self.conf_path = sys.argv[2]
     self.db_api = db_api.DBApi(
         utils.get_conf_value(self.conf_path, 'db', 'db_path'))
     self.db_api.create_tables(
         utils.get_conf_value(self.conf_path, 'default', 'device_id'))
     self.save_image_base_path = utils.get_conf_value(
         self.conf_path, 'cache_fruits_images', 'save_image_base_path')
     self.logger_init()
     self.screen = BalanceScreen(self.conf_path)
     self.http_client = http_client.HttpClient()
     self.capture_thread = camara.CaptureThread(self.save_image_base_path)
     self.weight_thread = weight.WeightThread(self.conf_path)
     self.weight_thread.steady_weight_signal.connect(
         self.steady_weight_callback)
     self.http_client.signal_identify_goods_resp.connect(
         self.get_identify_resp)
Exemplo n.º 5
0
    def __init__(self):
        self.conf_path = sys.argv[2]
        self.led = led.Led(38, 40, 36)
        self.led.blue(True)
        self.db_api = db_api.DBApi(
            utils.get_conf_value(self.conf_path, 'db', 'db_path'))
        self.db_api.update_device_status('idle')
        self.logger_init()
        self.capture_thread = camara.CaptureThread()
        self.weight_thread = weight.WeightThread(self.conf_path)
        self.weight_thread.steady_weight_signal.connect(
            self.steady_weight_callback)
        logger.info("Weight initialization finished.")

        cv2.namedWindow("AdjustCamera", 0)
        cv2.setWindowProperty("AdjustCamera", cv2.WND_PROP_FULLSCREEN,
                              cv2.cv.CV_WINDOW_FULLSCREEN)

        logger.info("Video out is enabled, window created.")
        self.led.blue(False)
Exemplo n.º 6
0
    def __init__(self, conf_path):
        self.core_app = QtGui.QApplication(sys.argv)
        self.db_api = db_api.DBApi(
            utils.get_conf_value(conf_path, 'db', 'db_path'))
        self.procedure_dialog = Procedure(conf_path)
        self.mesg_box_dialog = MesgBox(conf_path)
        self.pay_way_dialog = Pay_way(conf_path, self.procedure_dialog,
                                      self.mesg_box_dialog)
        self.shopping_cart_dialog = ShoppingCart(conf_path,
                                                 self.procedure_dialog,
                                                 self.pay_way_dialog)
        self.recognition_result_win = RecognitionResultWindow(
            conf_path, self.shopping_cart_dialog, self.procedure_dialog,
            self.mesg_box_dialog)

        self.recognition_result_win.button_home.clicked.connect(
            self.return_home)
        self.shopping_cart_dialog.button_home.clicked.connect(self.return_home)
        self.pay_way_dialog.button_home.clicked.connect(self.return_home)
        self.mesg_box_dialog.hide_button.clicked.connect(
            self.show_shopping_cart_hide_mesg)
        self.timeout_timer = QTimer()
        self.timeout_timer.timeout.connect(self.timeout_handler)
Exemplo n.º 7
0
    def __init__(self, conf_path, next_dialog, procedure_dialog, mesgbox):
        QtGui.QMainWindow.__init__(self)
        Ui_RecognitionResult.__init__(self)
        self.setupUi(self)
        self.setWindowFlags(Qt.Qt.FramelessWindowHint)
        self.next_dialog = next_dialog
        self.db_api = db_api.DBApi(
            utils.get_conf_value(conf_path, 'db', 'db_path'))
        self.procedure_dialog = procedure_dialog
        self.cache_fruit_images_path = utils.get_conf_value(
            conf_path, 'cache_fruits_images', 'cache_fruit_images_path')
        self.wait_confirm_timeout = int(
            utils.get_conf_value(conf_path, 'recognition_result', 'timeout'))
        self.confirmed_info_timeout = int(
            utils.get_conf_value(conf_path, 'recognition_result',
                                 'confirmed_info_timeout'))
        self.mesgbox = mesgbox
        self.label_title.setStyleSheet(
            "QLabel{border-image: url(%s)}" %
            utils.get_static_images_path(conf_path, 'image_title_name'))
        self.button_home.setStyleSheet(
            "QPushButton{background-image: url(%s)}" %
            utils.get_static_images_path(conf_path, 'image_home_name'))
        self.confirm_fruit_path = utils.get_static_images_path(
            conf_path, 'confirm_name')
        # self.image_unit_price_bg_path = utils.get_static_images_path(
        #     conf_path, 'image_unit_price_bg')

        self.image_1.clicked.connect(self.image_onclick1)
        self.image_2.clicked.connect(self.image_onclick2)
        self.image_3.clicked.connect(self.image_onclick3)
        self.image_4.clicked.connect(self.image_onclick4)
        self.image_5.clicked.connect(self.image_onclick5)
        self.image_6.clicked.connect(self.image_onclick6)

        self.index = 0
        self.fruits = []
        self.image_list = []
        self.image_list.append(self.image_1)
        self.image_list.append(self.image_2)
        self.image_list.append(self.image_3)
        self.image_list.append(self.image_4)
        self.image_list.append(self.image_5)
        self.image_list.append(self.image_6)

        self.image_name_list = []
        self.image_name_list.append(self.image_1_name)
        self.image_name_list.append(self.image_2_name)
        self.image_name_list.append(self.image_3_name)
        self.image_name_list.append(self.image_4_name)
        self.image_name_list.append(self.image_5_name)
        self.image_name_list.append(self.image_6_name)

        self.unit_price_list = []
        self.unit_price_list.append(self.unit_price_1)
        self.unit_price_list.append(self.unit_price_2)
        self.unit_price_list.append(self.unit_price_3)
        self.unit_price_list.append(self.unit_price_4)
        self.unit_price_list.append(self.unit_price_5)
        self.unit_price_list.append(self.unit_price_6)

        self.set_label_text_alignment()

        self.page_next.clicked.connect(self.page_next_onclick)
        self.page_last.clicked.connect(self.page_last_onclick)

        self.timeout_timer = QTimer()
        self.timeout_timer.timeout.connect(self.timeout_handler)
        self.timer = QTimer()
        self.timer.timeout.connect(self.hide_recognition)
        self.setStyleSheet("QPushButton{outline: none}")
Exemplo n.º 8
0
    def __init__(self, conf_path, procedure_dialog, pay_way_dialog):
        QtGui.QWidget.__init__(self)
        Ui_ShoppingCart.__init__(self)
        self.setupUi(self)
        self.setWindowFlags(Qt.Qt.FramelessWindowHint)
        self.db_api = db_api.DBApi(
            utils.get_conf_value(conf_path, 'db', 'db_path'))
        self.procedure_dialog = procedure_dialog
        self.pay_way_dialog = pay_way_dialog

        self.label_title.setStyleSheet(
            "QLabel{border-image: url(%s)}" %
            utils.get_static_images_path(conf_path, 'image_title_name'))
        self.button_home.setStyleSheet(
            "QPushButton{background-image: url(%s)}" %
            utils.get_static_images_path(conf_path, 'image_home_name'))
        self.puchase_logo.setStyleSheet(
            "QLabel{border-image: url(%s)}" % utils.get_static_images_path(
                conf_path, 'image_shopping_cart_logo_name'))
        # self.to_recognition_button.setStyleSheet(
        #     "QPushButton{border-image: url(%s)}" %
        #     utils.get_static_images_path(conf_path, 'image_to_recognition_name'))
        # self.wechat_pay_button.setStyleSheet(
        #     "QPushButton{border-image: url(%s)}" %
        #     utils.get_static_images_path(conf_path, 'image_wechatpay_name'))
        # self.alipay_button.setStyleSheet(
        #     "QPushButton{border-image: url(%s)}" %
        #     utils.get_static_images_path(conf_path, 'image_Alipay_name'))
        self.to_recognition_image_path = utils.get_static_images_path(
            conf_path, 'image_to_recognition_name')
        self.set_button_icon(self.to_recognition_button,
                             self.to_recognition_image_path)
        self.wechat_image_path = utils.get_static_images_path(
            conf_path, 'image_wechatpay_name')
        self.set_button_icon(self.wechat_pay_button, self.wechat_image_path)
        # self.alipay_image_path = utils.get_static_images_path(conf_path, 'image_Alipay_name')
        # self.set_button_icon(self.alipay_button, self.alipay_image_path)

        self.wechat_pay_button.setCheckable(False)
        # self.alipay_button.setCheckable(False)
        self.to_recognition_button.setCheckable(False)
        self.to_recognition_button.setStyleSheet("QPushButton{border:none}")
        # self.alipay_button.setDefault(False)
        self.wechat_pay_button.setDefault(False)
        # self.wechat_pay_button.setStyleSheet("QPushbutton{outline: none}")
        # self.to_recognition_button.setStyleSheet("QPushbutton{outline: none}")
        # self.to_recognition_button.setStyleSheet("QPushbutton{outline: none}")
        self.blue_background_img = utils.get_static_images_path(
            conf_path, 'image_blue_back')
        self.image_unselected = utils.get_static_images_path(
            conf_path, 'image_unselected_name')
        self.image_selected = utils.get_static_images_path(
            conf_path, 'image_selected_name')
        self.cache_fruit_images_path = utils.get_conf_value(
            conf_path, 'cache_fruits_images', 'cache_fruit_images_path')

        self.index = 0
        self.Total_price = 0.0
        self.fruits = []
        self.selected_button_list = []
        self.selected_button_list.append(self.selected_button1)
        self.selected_button_list.append(self.selected_button2)
        self.selected_button_list.append(self.selected_button3)
        self.selected_button_list.append(self.selected_button4)
        self.selected_button_list.append(self.selected_button5)
        for butt in self.selected_button_list:
            butt.setStyleSheet("QPushButton{border-image: url(%s)}" %
                               self.image_selected)
            butt.setCheckable(True)

        self.fruit_info_names_list = []
        self.fruit_info_names_list.append(self.fruit_name_1)
        self.fruit_info_names_list.append(self.fruit_name_2)
        self.fruit_info_names_list.append(self.fruit_name_3)
        self.fruit_info_names_list.append(self.fruit_name_4)
        self.fruit_info_names_list.append(self.fruit_name_5)

        self.fruit_info_unit_price_list = []
        self.fruit_info_unit_price_list.append(self.fruit_unit_price_1)
        self.fruit_info_unit_price_list.append(self.fruit_unit_price_2)
        self.fruit_info_unit_price_list.append(self.fruit_unit_price_3)
        self.fruit_info_unit_price_list.append(self.fruit_unit_price_4)
        self.fruit_info_unit_price_list.append(self.fruit_unit_price_5)

        self.fruit_info_weight_list = []
        self.fruit_info_weight_list.append(self.fruit_weight_1)
        self.fruit_info_weight_list.append(self.fruit_weight_2)
        self.fruit_info_weight_list.append(self.fruit_weight_3)
        self.fruit_info_weight_list.append(self.fruit_weight_4)
        self.fruit_info_weight_list.append(self.fruit_weight_5)

        self.coin_list = []
        self.coin_list.append(self.coin_1)
        self.coin_list.append(self.coin_2)
        self.coin_list.append(self.coin_3)
        self.coin_list.append(self.coin_4)
        self.coin_list.append(self.coin_5)

        self.fruit_info_total_price_list = []
        self.fruit_info_total_price_list.append(self.fruit_total_price_1)
        self.fruit_info_total_price_list.append(self.fruit_total_price_2)
        self.fruit_info_total_price_list.append(self.fruit_total_price_3)
        self.fruit_info_total_price_list.append(self.fruit_total_price_4)
        self.fruit_info_total_price_list.append(self.fruit_total_price_5)

        self.fruit_image_list = []
        self.fruit_image_list.append(self.fruit_image1)
        self.fruit_image_list.append(self.fruit_image2)
        self.fruit_image_list.append(self.fruit_image3)
        self.fruit_image_list.append(self.fruit_image4)
        self.fruit_image_list.append(self.fruit_image5)
        self.selected_button1.clicked.connect(self.selected_onclick1)
        self.selected_button2.clicked.connect(self.selected_onclick2)
        self.selected_button3.clicked.connect(self.selected_onclick3)
        self.selected_button4.clicked.connect(self.selected_onclick4)
        self.selected_button5.clicked.connect(self.selected_onclick5)

        self.background_select_list = []
        self.background_select_list.append(self.label_background_1)
        self.background_select_list.append(self.label_background_2)
        self.background_select_list.append(self.label_background_3)
        self.background_select_list.append(self.label_background_4)
        self.background_select_list.append(self.label_background_5)
        self.label_background_1.clicked.connect(self.selected_onclick1)
        self.label_background_2.clicked.connect(self.selected_onclick2)
        self.label_background_3.clicked.connect(self.selected_onclick3)
        self.label_background_4.clicked.connect(self.selected_onclick4)
        self.label_background_5.clicked.connect(self.selected_onclick5)

        self.page_next.clicked.connect(self.page_next_onclick)
        self.page_last.clicked.connect(self.page_last_onclick)
        self.to_recognition_button.clicked.connect(self.to_guide_ui)
        self.wechat_pay_button.clicked.connect(self.wechat_pay)
        # self.alipay_button.clicked.connect(self.ali_pay)
        # self.dialog_delay = ''
        self.timeout_timer = QTimer()
        self.timeout_timer.timeout.connect(self.timeout_handler)
        self.timer = QTimer()
        self.timer.timeout.connect(self.timer_handler)
        self.set_background_select_img()
        self.setStyleSheet("QPushButton{outline: none}")