def __init__(self, base_frame): self.module_name = 'mode_start' # style_sheet = 'QFrame{border-image: url(:/mode_start/mode_start/start.png)}' \ # 'QFrame{background: transparent}' AppQt.Q_App.__init__(self, self.module_name, base_frame, QRect(0, 0, 800, 480)) self.logger = get_logger(self.module_name) self.res_path = Util.get_res_path(self.module_name) self.show_str = '正在启动请稍后' self.status_cnt = 0 self.start_index = 0 self.timeout_cnt = 0 self.list_start_status = list_start_info self.picture_label = AppQt.get_label_picture( self, QRect(0, 0, 800, 480), ':/mode_start/mode_start/start.png') rect = AppQt.QRect(0, 340, 800, 24) self.m_static_start_result = AppQt.get_label_text( self, rect, False, '正在启动,请稍后···', 24, 'MicrosoftYaHei', '#333333') self.m_static_start_result.setStyleSheet('background: transparent;') self.timer_show = QtCore.QTimer(parent=self) # 创建定时器 self.timer_show.timeout.connect(lambda: self.on_timer_show()) self.__init_callback()
def __init__(self, base_frame): self.module_name = 'mode_mt' self.logger = get_logger(self.module_name) AppQt.Q_App.__init__(self, self.module_name, base_frame) # frame init self.res_path = Util.get_res_path('mode_mt') self.list_msg_info = [['close', 'open', 'brush_req'], ['close', 'open', 'water_req'], ['forward', 'back', 'direction_req']] self.list_mt_button_status = [ Mt_button_off, Mt_button_off, Mt_button_forward ] self.list_remote_mt_button_status = [ Mt_button_off, Mt_button_off, Mt_button_forward ] self.link_ros = False self.link_mcu = False tmp_list = list_label_mt_string for index in range(Mt_button_num): rect = tmp_list[index][list_label_point] name = tmp_list[index][list_label_info] AppQt.get_label_text(self, rect, True, name, 28, 'MicrosoftYaHei-Bold', '#000000') self.list_mt_button_bitmap = [] self.list_mt_button = [] tmp_list = list_button_mt_string for index in range(Mt_button_num): list_tmp = [] bitmap = "QPushButton{border-image: url(:/mode_mt/mode_mt/" + str( tmp_list[index][Mt_button_off]) + ")}" list_tmp.append(bitmap) bitmap = "QPushButton{border-image: url(:/mode_mt/mode_mt/" + str( tmp_list[index][Mt_button_on]) + ")}" list_tmp.append(bitmap) self.list_mt_button_bitmap.append(list_tmp) rect = tmp_list[index][Mt_button_point] style_sheet = list_tmp[self.list_mt_button_status[index]] mt_button = AppQt.get_pushbutton(self, rect, style_sheet) mt_button.setObjectName(str(tmp_list[index][Mt_button_id])) mt_button.clicked.connect( lambda: self.on_click_mt_button(self.sender().objectName())) self.list_mt_button.append(mt_button) self.timer_show = QtCore.QTimer(parent=self) # 创建定时器 self.timer_show.timeout.connect(self.on_timer_show) self.timer_delay = QtCore.QTimer(parent=self) # 创建定时器 self.timer_delay.timeout.connect(self.on_timer_delay) self.__init_callback()
def __init__(self, base_frame): self.module_name = 'Update' AppQt.Q_App.__init__(self, self.module_name, base_frame) self.logger = get_logger(self.module_name) self.res_path = Util.get_res_path(self.module_name) self.check_index = 0 self.check_last_status = Check_status_idle self.Update_list_all = Update_list_all self.check_process_target = 0 self.current_process = 0 self.degree = 0 self.update_index = 0 self.show_update_flag = False self.update_status = False self.process_percent = 0 # gif 动图 AppQt.get_label_picture(self, QRect(335, 20, 130, 140), ':/update/Update/扑拉飞呀导入版本.gif') AppQt.get_label_picture(self, QRect(210, 174, 380, 41), ':/update/Update/自检进度条-灰.png') self.cover_panel = AppQt.get_sub_frame(self, QRect(213, 178, 0, 34)) AppQt.get_label_picture(self.cover_panel, QRect(0, 0, 380, 34), ':/update/Update/自检进度条-蓝.png') self.m_static_check_title = AppQt.get_label_text(self, QRect(215, 237, 150, 24), False, 'test', 24, 'MicrosoftYaHei', '#333333') self.m_static_check_title.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.m_static_check_subtitle = AppQt.get_label_text(self, QRect(430, 237, 150, 24), False, 'test', 24, 'MicrosoftYaHei', '#333333') self.m_static_check_subtitle.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.m_static_check_result = AppQt.get_label_text(self, QRect(430, 270, 150, 24), False, 'test', 24, 'MicrosoftYaHei', '#333333') self.m_static_check_result.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.__check_list_init__() self.timer_show = QtCore.QTimer(parent=self) # 创建定时器 self.timer_show.timeout.connect(lambda: self.on_timer_show()) self.timer_process = QtCore.QTimer(parent=self) # 创建定时器 self.timer_process.timeout.connect(lambda: self.on_timer_process()) self.__init_callback()
def do_update_map(self): self.timer_update_map.stop() list_map_len = len(self.list_map) pos = self.get_map_qrect(list_map_len) if self.position_cnt >= len(self.list_map): return map_detail = self.list_map[self.position_cnt] rect_back, rect_title = self.get_qrect(pos, list_map_len, self.position_cnt) frame = AppQt.get_sub_frame(self.map_frame, rect_back, 'background-color: #FFFFFF;') frame.show() self.list_map_frame.append(frame) png_path = map_detail.get('png') Util.resize_png_for_map_display(png_path) style_sheet = 'QPushButton{border-image: url(' + png_path + ')}' rect = AppQt.QRect(3, 3, pos['map_weight'] - 2 * 3, pos['map_weight'] - 2 * 3) map_button = AppQt.get_pushbutton(frame, rect, style_sheet) # type: QPushButton map_button.setObjectName(str(self.position_cnt + Map_button_id_delta)) map_button.show() map_button.clicked.connect( lambda: self.on_click_map_button(int(self.sender().objectName()))) self.list_map_button.append(map_button) name = map_detail.get('name') map_label = AppQt.get_label_text(self.map_frame, rect_title, False, name, 26) map_label.show() self.list_map_label.append(map_label) self.timer_update_map.start(50) pass
def __init__(self, base_frame): self.module_name = 'show_box' self.logger = get_logger(self.module_name) AppQt.Q_App.__init__( self, self.module_name, base_frame, QRect(0, 0, 800, 480), 'QFrame{border-image: url(:/show_box/show_box/半透明.png)}' 'QFrame{background: transparent}') self.res_path = Util.get_res_path(self.module_name) self.index = 0 self.m_bitmap_white = AppQt.get_sub_frame( self, QRect(100, 53, 600, 374), 'QFrame{border-image: url(:/show_box/show_box/弹窗.png)}') style_sheet = 'QPushButton{border-image: url(:/show_box/show_box/否.png)}' + \ 'QPushButton:pressed{border-image: url(:/show_box/show_box/否-点击.png)}' self.button_no = AppQt.get_pushbutton(self.m_bitmap_white, QRect(41, 223, 240, 70), style_sheet) self.button_no.clicked.connect(lambda: self.on_click_button_no()) style_sheet = 'QPushButton{border-image: url(:/show_box/show_box/是.png)}' + \ 'QPushButton:pressed{border-image: url(:/show_box/show_box/是-点击.png)}' self.button_yes = AppQt.get_pushbutton(self.m_bitmap_white, QRect(320, 223, 240, 70), style_sheet) self.button_yes.clicked.connect(lambda: self.on_click_button_yes()) self.m_static_show = AppQt.get_label_text(self.m_bitmap_white, QRect(0, 70, 600, 94), True, '', 34, 'MicrosoftYaHei-Bold', '#333333') self.timer_show = QtCore.QTimer(parent=self) # 创建定时器 self.timer_show.timeout.connect(lambda: self.on_timer_show()) self.__init_callback()
def __init__(self, base_frame): self.module_name = 'mode_map_select' self.logger = get_logger(self.module_name) AppQt.Q_App.__init__(self, self.module_name, base_frame) self.show_callback = self.start self.hide_callback = self.stop self.res_path = Util.get_res_path(self.module_name) # self.get_map_num() style_sheet = 'QPushButton{border-image: url(:/mode_map_select/mode_map_select/左-亮.png)}' + \ 'QPushButton:pressed{border-image: url(:/mode_map_select/mode_map_select/左-灰.png)}' self.m_button_left = AppQt.get_pushbutton(self, QRect(20, 140, 58, 58), style_sheet) # self.get_map_num() style_sheet = 'QPushButton{border-image: url(:/mode_map_select/mode_map_select/右-亮.png)}' + \ 'QPushButton:pressed{border-image: url(:/mode_map_select/mode_map_select/右-灰.png)}' self.m_button_right = AppQt.get_pushbutton(self, QRect(720, 140, 58, 58), style_sheet) self.map_frame = AppQt.get_sub_frame(self, QRect(100, 0, 600, 340)) self.map_frame.show() self.list_map_button = [] self.list_map_frame = [] self.list_map_label = [] self.list_map = [] self.timer_show = QtCore.QTimer() # 创建定时器 self.timer_show.timeout.connect( lambda: self.on_timer_show()) # 绑定一个定时器事件 self.timer_update_map = QtCore.QTimer() # 创建定时器 self.timer_update_map.timeout.connect( lambda: self.on_timer_update_map()) # 绑定一个定时器事件 self.position_cnt = 0 self.__init_callback()
def __init__(self, base_frame): self.module_name = 'mode_working' self.logger = get_logger(self.module_name) AppQt.Q_App.__init__(self, self.module_name, base_frame) self.res_path = Util.get_res_path(self.module_name) self.current_process = [0, 0, 0] self.check_process_target = [0, 0, 0] self.degree = [0, 0, 0] self.count = 0 self.map_select_path = None self.map_select_name = None self.working_status = working_status_on self.move_speed = 0 self.position_x = 0 self.position_y = 0 self.position_z = 0 self.progress_percent = 0 self.label_back = AppQt.get_sub_frame(self, AppQt.QRect(28, 26, 228, 228), 'background-color: #FFFFFF;') self.m_bitmap_map_working = AppQt.get_label_picture( self.label_back, AppQt.QRect(5, 5, 218, 218)) self.map_label_name = AppQt.get_label_text( self, AppQt.QRect(8, 276, 270, 26), False, '', 26) tmp_list = list_working_label_info for index in range(4): rect = tmp_list[index][list_working_point] name = tmp_list[index][list_working_name] AppQt.get_label_text(self, rect, True, name, 26, 'MicrosoftYaHei-Bold', '#333333') self.list_working_label_point_show = [] for index in range(Working_point_num): rect = AppQt.QRect(380 + 130 * index, 192, 90, 24) working_label = AppQt.get_label_text(self, rect, False, '', 24, 'MicrosoftYaHei', '#333333') self.list_working_label_point_show.append(working_label) self.working_set_point() tmp_list = list_working_process_info self.list_working_cover_panel = [] self.list_working_cover_text = [] for index in range(Working_gauge_num): rect = tmp_list[index][list_working_gray_point] path = ':/mode_working/mode_working/工作中-灰.png' AppQt.get_label_picture(self, rect, path) cover_panel = AppQt.get_sub_frame(self, rect) path = ':/mode_working/mode_working/工作中-蓝.png' AppQt.get_label_picture(cover_panel, AppQt.QRect(0, 0, 380, 38), path) rect = tmp_list[index][list_working_text_point] text_panel = AppQt.get_sub_frame( self, rect, 'QFrame{background: transparent}') cover_text = AppQt.get_label_text( text_panel, AppQt.QRect(0, 0, rect.width(), rect.height()), True, '', 26, 'MicrosoftYaHei-Bold', '#0E0E32') cover_text.setStyleSheet('QLabel{background: transparent}') self.list_working_cover_panel.append(cover_panel) self.list_working_cover_text.append(cover_text) self.list_working_button_bitmap = [] bitmap = 'QPushButton{border-image: url(:/mode_working/mode_working/暂停.png)}' + \ 'QPushButton:pressed{border-image: url(:/mode_working/mode_working/暂停-按下.png)}' self.list_working_button_bitmap.append(bitmap) bitmap = 'QPushButton{border-image: url(:/mode_working/mode_working/继续.png)}' + \ 'QPushButton:pressed{border-image: url(:/mode_working/mode_working/继续-按下.png)}' self.list_working_button_bitmap.append(bitmap) rect = AppQt.QRect(286, 236, 214, 74) style_sheet = self.list_working_button_bitmap[self.working_status] self.m_button_pause_continue = AppQt.get_pushbutton( self, rect, style_sheet) self.m_button_pause_continue.clicked.connect( lambda: self.on_click_pause_continue()) rect = AppQt.QRect(524, 236, 214, 74) self.cancel_style_sheet_enable = 'QPushButton{border-image: url(:/mode_working/mode_working/取消.png)}' + \ 'QPushButton:pressed{border-image: url(:/mode_working/mode_working/取消-按下.png)}' self.cancel_style_sheet_disable = 'QPushButton{border-image: url(:/mode_working/mode_working/取消灰.png)}' self.m_button_cancel = AppQt.get_pushbutton( self, rect, self.cancel_style_sheet_enable) self.m_button_cancel.clicked.connect(lambda: self.on_click_cancel()) self.timer_show = QtCore.QTimer(parent=self) # 创建定时器 self.timer_show.timeout.connect(lambda: self.on_timer_show()) self.timer_process = QtCore.QTimer(parent=self) # 创建定时器 self.timer_process.timeout.connect(lambda: self.on_timer_process()) self.timer_delay = QtCore.QTimer(parent=self) # 创建定时器 self.timer_delay.timeout.connect(lambda: self.on_timer_process()) self.timer_start_delay = QtCore.QTimer(parent=self) self.timer_start_delay.timeout.connect( lambda: self.on_timer_start_delay()) self.__init_callback()
def __init__(self, base_frame): self.module_name = 'mode_author' self.logger = get_logger(self.module_name) AppQt.Q_App.__init__(self, self.module_name, base_frame) self.show_callback = self.start self.hide_callback = self.stop self.res_path = Util.get_res_path(self.module_name) self.input_cnt = 0 self.one_second_cnt = 0 password = get_value_by_key('password', 'CONFIG') # type: str self.logger.info('get password: '******'889972' if password is not None: if len(password) == 6: if password.isdigit(): self.password = str(password) self.logger.info('set password: '******'' self.error_show_cnt = 0 self.mac_id = Util.get_mac_address() self.download_url = get_value_by_key('qrcode_download_url', 'HOST_URL') self.logger.info('get qr_code url is : ' + str(self.download_url)) if self.download_url is None: self.download_url = 'http://47.100.182.145:8080/qrcode/clearQrcode?macId=' self.download_url += self.mac_id self.unlock_url = get_value_by_key('unlock_url', 'HOST_URL') self.logger.info('unlock url is : ' + str(self.unlock_url)) if self.unlock_url is None: self.unlock_url = 'http://47.100.182.145:8080/lock/queryUnlockById?macId=' self.unlock_url += self.mac_id self.lock_url = get_value_by_key('lock_url', 'HOST_URL') self.logger.info('lock url is : ' + str(self.lock_url)) if self.lock_url is None: self.lock_url = 'http://47.100.182.145:8080/lock/lock?macId=' self.lock_url += self.mac_id self.logger.info('get qr_code url is : ' + str(self.download_url)) self.logger.info('unlock url is : ' + str(self.unlock_url)) self.logger.info('lock url is : ' + str(self.lock_url)) self.download_file_name = self.res_path + 'Qr_d.png' self.qr_code_path = self.res_path + 'Qr.png' self.process_percent = 0 self.m_bitmap_qr = AppQt.get_label_picture( self, AppQt.QRect(18, 120, 161, 161), self.qr_code_path) tmp_list = list_button_author_info self.list_key_button = [] for index in range(12): rect = tmp_list[index][Author_button_point] style_sheet = 'QPushButton{border-image: url(:/mode_author/mode_author/' + \ str(tmp_list[index][Author_button_unselect]) + ')}' + \ 'QPushButton:pressed{border-image: url(:/mode_author/mode_author/' + \ str(tmp_list[index][Author_button_select]) + ')}' button = AppQt.get_pushbutton(self, rect, style_sheet) button.setObjectName(str(tmp_list[index][Author_button_id])) button.clicked.connect( lambda: self.on_click_key(self.sender().objectName())) self.list_key_button.append(button) tmp_list = list_radio_author_string self.radio_list = [] self.radio_bitmap_list = [] bitmap = QtGui.QPixmap(':/mode_author/mode_author/' + tmp_list[Author_radio_off]) self.radio_bitmap_list.append(bitmap) bitmap = QtGui.QPixmap(':/mode_author/mode_author/' + tmp_list[Author_radio_on]) self.radio_bitmap_list.append(bitmap) # 设置属性,位置 for index in range(6): rect = AppQt.QRect(307 + (26 + 37) * index, 57, 26, 26) path = ':/mode_author/mode_author/' + tmp_list[Author_radio_off] radio_button = AppQt.get_label_picture(self, rect, path) self.radio_list.append(radio_button) self.m_static_password_tip = AppQt.get_label_text( self, AppQt.QRect(191, 14, 418, 28), True, '请扫描二维码或 输入管理员密码', 28, 'MicrosoftYaHei-Bold', '#333333') self.timer_show = QtCore.QTimer(parent=self) # 创建定时器 self.timer_show.timeout.connect(self.on_timer_show) self.timer_error_show = QtCore.QTimer(parent=self) # 创建定时器 self.timer_error_show.timeout.connect(self.on_timer_error_show) self.timer_delay = QtCore.QTimer(parent=self) # 创建定时器 self.timer_delay.timeout.connect(self.on_timer_delay) self.update_qr_code = False Util.add_thread(target=self.update_qr_code_function) self.lock_status = False self.unlock_status = False Util.add_thread(target=self.qr_code_lock_function) self.locking = False Util.add_thread(target=self.set_lock_status)
def __init__(self, parent): self.module_name = 'base_frame' # init frame AppQt.Q_App.__init__(self, self.module_name, parent=parent, geometry=AppQt.QRect(0, 0, 800, 480), style_sheet='QFrame{background-color: #D6D5D6}') # init variable self.res_path = Util.get_res_path('frame') self.logger = get_logger(self.module_name) self.one_second_cnt = 0 self.get_odom_cnt = 0 # home self.battery_count = 88 self.water_count = 88 self.odom_count = 0 self.line_speed = 0 self.received_time = 0 self.link_4G = True self.link_ros = False self.link_mcu = False self.is_get_odom = False self.list_mt_button_status = [ Mt_button_off, Mt_button_off, Mt_button_forward ] # title panel init self.title_panel = AppQt.get_sub_frame( self, AppQt.QRect(0, 0, 800, 40), 'QFrame{background-color: #E1E1E1}') # tail panel init self.tail_panel = AppQt.get_sub_frame( self, AppQt.QRect(0, 380, 800, 100), 'QFrame{background-color: #F0F0F0}') # init title 4G self.m_bitmap_4G = AppQt.get_label_picture(self.title_panel, AppQt.QRect(13, 12, 28, 17), ':/frame/frame/信号4.png') # init title battery self.m_battery_url = ':/frame/frame/电池1.png' self.m_bitmap_battery = AppQt.get_label_picture( self.title_panel, AppQt.QRect(745, 11, 43, 18), self.m_battery_url) # init tail water percent self.m_bitmap_water = AppQt.get_label_picture( self.tail_panel, AppQt.QRect(47, 26, 40, 54), ':/frame/frame/水量.png') # init tail odom self.m_bitmap_odom = AppQt.get_label_picture( self.tail_panel, AppQt.QRect(597, 26, 44, 54), ':/frame/frame/lichen.png') # 剩下的label 批量处理,省地方 self.m_title_label_list = [] tmp_list = list_title_string for index in range(len(tmp_list)): # Label初始化 rect = tmp_list[index][Title_index_point] name = tmp_list[index][Title_index_name] font_px = tmp_list[index][Title_index_font_size] title_label = AppQt.get_label_text(self.title_panel, rect, False, name, font_px, 'MicrosoftYaHei', '#000000') # title_label.setAutoFillBackground(True) self.m_title_label_list.append(title_label) # 剩下的label 批量处理,省地方 self.m_tail_label_list = [] tmp_list = list_tail_string for index in range(len(tmp_list)): rect = tmp_list[index][Title_index_point] name = tmp_list[index][Title_index_name] font_px = tmp_list[index][Title_index_font_size] tail_label = AppQt.get_label_text(self.tail_panel, rect, False, name, font_px, 'MicrosoftYaHei', '#000000') self.m_tail_label_list.append(tail_label) # init at or mt button 垃圾逻辑,改掉 self.At_style_sheet_enable = 'QPushButton{border-image: url(:/frame/frame/切换到 自动驾驶.png)}' self.Mt_style_sheet_enable = 'QPushButton{border-image: url(:/frame/frame/切换到 手动驾驶.png)}' self.Mt_style_sheet_disable = 'QPushButton{border-image: url(:/frame/frame/切换到 手动驾驶灰.png)}' self.m_bpButtonAt_mini = AppQt.get_pushbutton( self.tail_panel, AppQt.QRect(235, 0, 331, 100), self.At_style_sheet_enable) self.m_bpButtonAt_mini.clicked.connect(lambda: self.on_click_mini_at()) self.m_bpButtonAt_mini.hide() self.m_bpButtonMt_mini = AppQt.get_pushbutton( self.tail_panel, AppQt.QRect(235, 0, 331, 100), self.Mt_style_sheet_enable) self.m_bpButtonMt_mini.clicked.connect(lambda: self.on_click_mini_mt()) self.m_bpButtonMt_mini.hide() # create timer for title and tail update self.timer_show = QtCore.QTimer(parent=self) # 创建定时器 self.timer_show.timeout.connect(self.on_timer_show) QtCore.QMetaObject.connectSlotsByName(parent) # self.show_mt_signal.connect(self.show_mt_at) # self.set_button_enable_signal.connect(self.set_button_enable) self.__init_callback() self.show() self.Manage = ManagerFrame(self) self.Manage.show()
def __init__(self, base_frame): self.module_name = 'mode_check' self.logger = get_logger(self.module_name) AppQt.Q_App.__init__(self, self.module_name, base_frame) self.res_path = Util.get_res_path(self.module_name) self.check_index = 0 self.check_last_status = Check_status_idle self.check_list_all = check_list_all self.check_process_target = 0 self.current_process = 0 self.degree = 0 self.link_4G = True self.link_ros = True self.link_mcu = True self.battery_count = 88 self.water_count = 88 self.release_stop = True self.fault_status = True self.origin_status = True AppQt.get_label_picture(self, AppQt.QRect(344, 30, 130, 140), ':/mode_check/mode_check/扑拉飞呀导入版本.gif') AppQt.get_label_picture(self, AppQt.QRect(210, 174, 380, 41), ':/mode_check/mode_check/自检进度条-灰.png') self.cover_panel = AppQt.get_sub_frame(self, AppQt.QRect(213, 178, 0, 34)) AppQt.get_label_picture(self.cover_panel, AppQt.QRect(0, 0, 380, 34), ':/mode_check/mode_check/自检进度条-蓝.png') rect = AppQt.QRect(215, 237, 150, 24) self.m_static_check_title = AppQt.get_label_text( self, rect, False, '', 24, 'MicrosoftYaHei', '#333333') self.m_static_check_title.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) rect = AppQt.QRect(430, 237, 150, 24) self.m_static_check_subtitle = AppQt.get_label_text( self, rect, False, '', 24, 'MicrosoftYaHei', '#333333') self.m_static_check_subtitle.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) rect = AppQt.QRect(430, 270, 150, 24) self.m_static_check_result = AppQt.get_label_text( self, rect, False, '', 24, 'MicrosoftYaHei', '#333333') self.m_static_check_result.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.__check_list_init__() self.timer_show = QtCore.QTimer() # 创建定时器 self.timer_show.timeout.connect(lambda: self.on_timer_show()) self.timer_process = QtCore.QTimer() # 创建定时器 self.timer_process.timeout.connect(lambda: self.on_timer_process())