#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@文件    :statusbar.py
@时间    :2022/01/22 09:55:34
@作者    :None
@版本    :1.0
@说明    :状态栏页面
'''


from utils.qt import QStatusBar, QLabel, QFrame, QMetaObject, QCoreApplication


class UiStatusBar(object):
    def setupUi(self, emv_status):
        self.statusbar = QStatusBar()
        # pcs连接状态
        self.label_emv_connect = QLabel()
        self.label_emv_connect.setFrameStyle(QFrame.Panel | QFrame.Raised)
        self.label_emv_connect.setLineWidth(3)
        self.label_emv_connect.setMidLineWidth(3)

        # pcs发送状态
        self.label_emv_send = QLabel()
        self.label_emv_send.setFrameStyle(QFrame.Panel | QFrame.Raised)
        self.label_emv_send.setLineWidth(3)
        self.label_emv_send.setMidLineWidth(3)

        # pcs发送状态
        self.label_emv_received = QLabel()
        self.label_emv_received.setFrameStyle(QFrame.Panel | QFrame.Raised)
        self.label_emv_received.setLineWidth(3)
        self.label_emv_received.setMidLineWidth(3)

        # pcs软件版本号
        self.label_emv_version = QLabel()
        self.label_emv_version.setFrameStyle(QFrame.Panel | QFrame.Raised)
        self.label_emv_version.setLineWidth(3)
        self.label_emv_version.setMidLineWidth(3)

        # 往状态栏中添加组件（stretch应该是拉伸组件宽度）
        self.statusbar.addWidget(self.label_emv_connect, stretch=0)
        self.statusbar.addWidget(self.label_emv_send, stretch=0)
        self.statusbar.addWidget(self.label_emv_received, stretch=0)
        self.statusbar.addPermanentWidget(self.label_emv_version, stretch=0)

        self.statusbar.setSizeGripEnabled(False)

        self.retranslateUi(emv_status)
        QMetaObject.connectSlotsByName(emv_status)

    def retranslateUi(self, emv_status):
        _translate = QCoreApplication.translate
        self.label_emv_connect.setText(_translate("emv_status", "未连接"))
        self.label_emv_send.setText(_translate("emv_status", "发送未启动"))
        self.label_emv_received.setText(_translate("emv_status", "接收未启动"))
