def start(self): Util.add_thread(target=self.__run__) Util.add_thread(target=self.write_file_queue_callback) if self.rtmp_enable == 'yes': Util.add_thread(target=self.rtmp_queue_callback) if self.http_local_enable == 'yes': Util.add_thread(target=self.local_queue_callback)
def __init__(self): self.module_name = 'interface_ros' App.__init__(self, self.module_name) self.link_ros = False self.link_mcu = False self.received_time = 0 self.logger = get_logger(self.module_name) self.pub = None self.ros_is_running = False self.send_link_status = False self.master = None self.ui_ros_topic_is_sub = False self.callback_dict = {} self.__init_callback() self.msg_out_queue = Queue(0) Util.add_thread(target=self.msg_out_queue_callback)
def control_callback(self, data_dict): self.__logger.info(str(data_dict)) _, msg_data = Util.get_msg_id_data_dict(data_dict) if 'ros_start' in msg_data: if msg_data['ros_start']: if self.is_start: self.__logger.warning(' is starting please wait') else: self.__logger.info('start launch begin') Util.add_thread(target=self.start_launch_thread) else: if self.is_stop: self.__logger.warning(' is stopping please wait') else: self.__logger.info('stop launch begin') Util.add_thread(target=self.stop_launch_thread)
def stop(self): self.timer_show.stop() self.timer_error_show.stop() if not self.locking: Util.add_thread(target=self.set_lock_status)
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 start(self): Util.add_thread(target=self.__run) return
def do_update_md5(self, data_dict): Util.add_thread(target=self.check_md5)
def do_download_packet(self, data_dict): # print(self.module_name) Util.add_thread(target=self.get_packet)
def do_unzip(self, data_dict): Util.add_thread(target=self.unzip_file)