#!/usr/bin/env python
# -*- encoding: utf-8 -*-


from ui.record import Record
from ui.own.frame_theme import MyFrame
from utils.globalvar import SD
from utils.qt import QFileDialog, Signal


class Win_Record(Record, MyFrame):
    can_record_start_signal = Signal()
    can_record_stop_signal = Signal()

    def __init__(self, parent=None):
        super(Win_Record, self).__init__(parent)
        self.setupUi(self)

        self.save_record.clicked.connect(self._start)
        self.stop_record.clicked.connect(self._stop)

    def _start(self):
        self.can_record_start_signal.emit()

    def _stop(self):
        self.can_record_stop_signal.emit()

    def save_csv(self):
        return QFileDialog.getSaveFileName(self, "保存文件" if SD.SYSTEM_LANGUAGE == 0 else "Save File", SD.FILE_PATH, 'CSV(*.csv)')