Merge branch 'qt-gui-update' of https://github.com/CopterExpress/clever-show into qt-gui-update

This commit is contained in:
Artem30801
2020-02-25 16:32:47 +03:00
5 changed files with 12 additions and 10 deletions

View File

@@ -51,6 +51,8 @@ class Client(object):
self.client_id = socket.gethostname()
elif config_id == '/ip':
self.client_id = messaging.get_ip_address()
else:
self.client_id = config_id
logger.info("Config loaded")

View File

@@ -252,14 +252,15 @@ def _response_id(*args, **kwargs):
old_id = client.active_client.client_id
if new_id != old_id:
client.active_client.config.set('PRIVATE', 'id', new_id, write=True)
client.active_client.client_id = new_id
if new_id != '/hostname':
if client.active_client.system_restart_after_rename:
if client.active_client.config.system_restart_after_rename:
hostname = client.active_client.client_id
configure_hostname(hostname)
configure_hosts(hostname)
configure_bashrc(hostname)
configure_motd(hostname)
execute_command("reboot")
execute_command("systemctl stop clever-show & reboot")
# execute_command("hostname {}".format(hostname))
# restart_service("dhcpcd")
# restart_service("avahi-daemon")

View File

@@ -486,9 +486,7 @@ class CopterDataModel(QtCore.QAbstractTableModel):
self.data_contents[row][col] = formatted_value
if col == 0:
self.data_contents[row].client.send_message("id", {"new_id": formatted_value})
self.data_contents[row].client.remove() # TODO change
self._remove_row(row)
self.data_contents[row].client.send_message("id", kwargs={"new_id": formatted_value})
elif role == ModelDataRole: # For inner setting\editing of raw data
self.data_contents[row][col] = value

View File

@@ -305,8 +305,8 @@ class Client(messaging.ConnectionManager):
self.connected = True
if self.copter_id is None:
self.get_response("id", self._got_id)
#if self.copter_id is None:
self.get_response("id", self._got_id)
if self.on_connect:
self.on_connect(self)

View File

@@ -306,8 +306,9 @@ class MainWindow(QtWidgets.QMainWindow):
music_dt = self.ui.music_delay_spin.value()
asyncio.ensure_future(self.play_music_at_time(music_dt + time_now), loop=loop)
logging.info('Wait {} seconds to play music'.format(music_dt))
# self.selfcheck_selected()
for copter in filter(lambda copter: copter.all_checks, self.model.user_selected()):
# This filter constraints takeoff in real world, when copter state was normal and then some checks were failed for a while
# for copter in filter(lambda copter: copter.states.all_checks, self.model.user_selected()):
for copter in self.model.user_selected():
server.send_starttime(copter.client, dt + time_now)
@pyqtSlot()
@@ -326,7 +327,7 @@ class MainWindow(QtWidgets.QMainWindow):
for copter in self.model.user_selected():
if table.takeoff_checks(copter):
if self.ui.z_checkbox.isChecked():
copter.client.send_message("takeoff_z", {"z": str(self.ui.z_spin.value())}) # todo int, merge commands
copter.client.send_message("takeoff_z", kwargs={"z": str(self.ui.z_spin.value())}) # todo int, merge commands
else:
copter.client.send_message("takeoff")