77 lines
2.7 KiB
Python
77 lines
2.7 KiB
Python
|
# coding: gb2312
|
|||
|
|
|||
|
from LSZXPagesLibrary.consensus import *
|
|||
|
from LSZXPagesLibrary.pop_message_dialog import PopDialogMessage
|
|||
|
from LSZXPagesLibrary.prepare_page_layout_define import PreparePageLayoutDefine
|
|||
|
from PureBackend.global_execrise_backend import GEB
|
|||
|
|
|||
|
|
|||
|
class PreparePage(PreparePageLayoutDefine):
|
|||
|
|
|||
|
def __init__(self):
|
|||
|
super(PreparePage, self).__init__()
|
|||
|
self.eb = GEB().get_geb()
|
|||
|
# ע<>᷵<EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD><EFBFBD>İ<EFBFBD>ť
|
|||
|
self.back_home_button.clicked.connect(self.back_home)
|
|||
|
# ע<>Ὺʼ<E1BFAA><CABC>ť
|
|||
|
self.start_button.clicked.connect(self.start)
|
|||
|
# <20><><EFBFBD><EFBFBD>
|
|||
|
self.message_pop_windows = PopDialogMessage(self)
|
|||
|
self.message_pop_windows.connect(self.message_pop_commit)
|
|||
|
|
|||
|
def refresh(self):
|
|||
|
exercise_name = EXERCISE_TYPE_TABLE[self.data[EXERCISE_TYPE]]
|
|||
|
# <20>жϿ<D0B6><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEBFBC>
|
|||
|
person_mes = self.data[PERSON_MES]
|
|||
|
exercise_type = self.data[EXERCISE_TYPE]
|
|||
|
band_id = person_mes[BAND_ID]
|
|||
|
person_id = person_mes[ID]
|
|||
|
if exercise_type == SIT_UP:
|
|||
|
self.eb.active_sit_up(person_id=person_id, band_id=band_id)
|
|||
|
elif exercise_type == PUSH_UP:
|
|||
|
self.eb.active_push_up(person_id=person_id, band_id=band_id)
|
|||
|
elif exercise_type == PULL_UP:
|
|||
|
self.eb.active_pull_up(person_id=person_id, band_id=band_id)
|
|||
|
elif exercise_type == HANGING:
|
|||
|
self.eb.active_overhang(person_id=person_id, band_id=band_id)
|
|||
|
elif exercise_type == RUNAROUND:
|
|||
|
self.eb.active_run_around(person_id=person_id, band_id=band_id)
|
|||
|
frame_generator = self.data[FRAME_GENERATOR]
|
|||
|
_id = person_mes[ID]
|
|||
|
_class = person_mes[CLASS]
|
|||
|
name = person_mes[NAME]
|
|||
|
self.set_title(_id, name, _class, exercise_name)
|
|||
|
self.video_displayer.set_frame_generator(frame_generator)
|
|||
|
self.video_displayer.start()
|
|||
|
|
|||
|
def set_title(self, _id, name, _class, exercise_name):
|
|||
|
self.id_box.setText(_id)
|
|||
|
self.name_box.setText(name)
|
|||
|
self.class_box.setText(_class)
|
|||
|
self.title_label.setText(exercise_name)
|
|||
|
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳʱ<D2B3><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
def back_home(self):
|
|||
|
self.message_pop_windows.show("<EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>?")
|
|||
|
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>ť<EFBFBD>¼<EFBFBD>
|
|||
|
def message_pop_commit(self):
|
|||
|
# <20>ر<EFBFBD><D8B1><EFBFBD>Ƶ<EFBFBD><C6B5>
|
|||
|
self.video_displayer.pause()
|
|||
|
# <20><>ת
|
|||
|
self.jump2(HOME_PAGE)
|
|||
|
|
|||
|
def start(self):
|
|||
|
# <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|||
|
self.eb.start_exercise()
|
|||
|
# <20><>ת
|
|||
|
pkg = {
|
|||
|
EXERCISE_TYPE: self.data[EXERCISE_TYPE],
|
|||
|
PERSON_MES: self.data[PERSON_MES],
|
|||
|
FRAME_GENERATOR: self.eb.get_exercise_video,
|
|||
|
PERSON_LIST: self.data.get(PERSON_LIST)
|
|||
|
}
|
|||
|
self.jump2(EXERCISE_PAGE, pkg)
|
|||
|
# <20>ر<EFBFBD><D8B1><EFBFBD>Ƶ<EFBFBD><C6B5>
|
|||
|
self.video_displayer.pause()
|