def _pump_emit(self, bot_id, instruct, is_open): self._ui.ui_log_pump.setText(f'{bot_id} {instruct} {is_open}') if instruct in [ 'WATER_HIGH', 'CHEM_ALKALI', 'CHEM_ACID', 'WHEEL', 'WATER_WAX' ]: QTools.set_led_style(ui_btn=self._leds[instruct], color='GREEN' if is_open else 'RED') elif instruct == 'ALL STOP': for instruct in [ 'WATER_HIGH', 'CHEM_ALKALI', 'CHEM_ACID', 'WHEEL', 'WATER_WAX' ]: QTools.set_led_style(ui_btn=self._leds[instruct + str(bot_id)], color='RED')
def _liquid_raw_data(self, pump_id, liquid_raw_data): self._ui.ui_water_data.setText(f"{liquid_raw_data['WATER']}") self._ui.ui_alkali_data.setText(f"{liquid_raw_data['ALKALI']}") self._ui.ui_acid_data.setText(f"{liquid_raw_data['ACID']}") self._ui.ui_wheel_data.setText(f"{liquid_raw_data['WHEEL']}") self._ui.ui_wax_data.setText(f"{liquid_raw_data['WAX']}") for liquid_type in liquid_raw_data.keys(): liquid_height = 100 if liquid_type == 'WATER' else 60 container_height = 900 if liquid_type == 'WATER' else 250 color = 'RED' if liquid_raw_data[ liquid_type] <= liquid_height else 'GREEN' text = 'WARNING' if liquid_raw_data[ liquid_type] <= liquid_height else ' ' QTools.set_led_style(ui_btn=self._leds[liquid_type], color=color) self._leds[liquid_type].setText(text) percent = liquid_raw_data[liquid_type] / container_height progress = QTools.set_style_sheet(percent=percent) self._leds[liquid_type].setStyleSheet(progress)
def _stop_all(self): self._one_pump.stop_all() for liquid_id in [0, 1, 2, 3, 4]: QTools.set_led_style(ui_btn=self._leds[self._bot_id][liquid_id], color='GREEN') self._leds[self._bot_id][liquid_id].setChecked(0) # 未启动
def _signal_pump_shooting(self, bot_id, liquid_id, switch): QTools.set_led_style(self._leds[bot_id][liquid_id], color='DARK_GREEN' if switch else 'GREEN')
def _signal_tcp_online(self, is_online, ip, port): QTools.set_led_style(ui_btn=self._ui.led_tcp_pump, color='GREEN' if is_online else 'RED') for liquid_id in [0, 1, 2, 3, 4]: QTools.set_led_style(ui_btn=self._leds[self._bot_id][liquid_id], color='GREEN' if is_online else 'RED')
def _tcp_online(self, is_connected, peer_ip, peer_port): QTools.set_led_style(ui_btn=self._ui.led_tcp_guides, color='GREEN' if is_connected else 'RED')
def _raw_data(self, raw_data): QTools.set_led_style(ui_btn=self._ui.led_guides_data1, color='GREEN' if raw_data[0] else 'RED') QTools.set_led_style(ui_btn=self._ui.led_guides_data2, color='GREEN' if raw_data[1] else 'RED')
def _tcp_online(self, is_online, ip, port): QTools.set_led_style(ui_btn=self._ui.led_pump_station, color='GREEN' if is_online else 'RED') self._ui.led_pump_station.setText('ON' if is_online else 'OFF') self._ui.ip_nuc.setText(f'NUC_IP {ip}')
def _tcp_online(self, is_connected, peer_ip, peer_port): QTools.set_led_style(ui_btn=self._ui.led_guides, color='GREEN' if is_connected else 'RED') self._ui.led_guides.setText('ON' if is_connected else 'OFF') self._ui.ip_nuc.setText(f'NUC_IP {peer_ip}') self._ui.log_network.append(f'NUC_IP {peer_ip} {peer_port}')