Fixes =))
This commit is contained in:
15
main.py
15
main.py
@@ -333,17 +333,16 @@ class DPS150GUI:
|
|||||||
if self.device._running:
|
if self.device._running:
|
||||||
self.device.disable()
|
self.device.disable()
|
||||||
self.device.stop()
|
self.device.stop()
|
||||||
|
except Exception as e:
|
||||||
|
self.log(f"Ошибка при отключении: {e}")
|
||||||
self.connected = False
|
self.connected = False
|
||||||
self.connect_btn.config(text="Подключиться")
|
self.connect_btn.config(text="Подключиться")
|
||||||
self.status_label.config(text="Отключено", foreground="red")
|
self.status_label.config(text="Отключено", foreground="red")
|
||||||
self.output_btn.config(state="disabled")
|
self.output_btn.config(state="disabled")
|
||||||
self.log("Отключено")
|
self.log("Отключено")
|
||||||
self.device = None
|
self.device = None
|
||||||
# Останавливаем периодическое обновление
|
|
||||||
if hasattr(self, 'update_job'):
|
if hasattr(self, 'update_job'):
|
||||||
self.root.after_cancel(self.update_job)
|
self.root.after_cancel(self.update_job)
|
||||||
except Exception as e:
|
|
||||||
self.log(f"Ошибка при отключении: {e}")
|
|
||||||
|
|
||||||
def on_data_received(self, data):
|
def on_data_received(self, data):
|
||||||
"""Обработка полученных данных от устройства"""
|
"""Обработка полученных данных от устройства"""
|
||||||
@@ -462,9 +461,9 @@ class DPS150GUI:
|
|||||||
|
|
||||||
output_closed = self.data.get("outputClosed", False)
|
output_closed = self.data.get("outputClosed", False)
|
||||||
if output_closed:
|
if output_closed:
|
||||||
self.output_btn.config(text="Включить выход")
|
|
||||||
else:
|
|
||||||
self.output_btn.config(text="Выключить выход")
|
self.output_btn.config(text="Выключить выход")
|
||||||
|
else:
|
||||||
|
self.output_btn.config(text="Включить выход")
|
||||||
|
|
||||||
def toggle_output(self):
|
def toggle_output(self):
|
||||||
"""Включить/выключить выход"""
|
"""Включить/выключить выход"""
|
||||||
@@ -474,11 +473,11 @@ class DPS150GUI:
|
|||||||
try:
|
try:
|
||||||
output_closed = self.data.get("outputClosed", False)
|
output_closed = self.data.get("outputClosed", False)
|
||||||
if output_closed:
|
if output_closed:
|
||||||
self.device.enable()
|
|
||||||
self.log("Выход включен")
|
|
||||||
else:
|
|
||||||
self.device.disable()
|
self.device.disable()
|
||||||
self.log("Выход выключен")
|
self.log("Выход выключен")
|
||||||
|
else:
|
||||||
|
self.device.enable()
|
||||||
|
self.log("Выход включен")
|
||||||
# Обновление произойдёт при следующем получении данных
|
# Обновление произойдёт при следующем получении данных
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
messagebox.showerror("Ошибка", f"Не удалось изменить состояние выхода: {e}")
|
messagebox.showerror("Ошибка", f"Не удалось изменить состояние выхода: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user