From 1a2a5d8483ae3feee818524caf69483dc6630b8e Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Thu, 27 May 2021 21:39:41 -0400 Subject: [PATCH] disable some elements --- control_seekat_demo.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/control_seekat_demo.py b/control_seekat_demo.py index ec3db20..8f3ad87 100644 --- a/control_seekat_demo.py +++ b/control_seekat_demo.py @@ -5,6 +5,8 @@ import serial import serial.tools.list_ports import re +CHANGE_BUTTONS = ["SET_do", "RAMP_do", "sel_ref", "sel_do"] + def error_popup(parent, msg): box = Gtk.MessageDialog( parent=parent, @@ -25,7 +27,9 @@ class SerComm: s = self.ser.read_until().decode() if not s: raise Exception(f"DAC timeout: '{s}'") - return s.rstrip("\r\n") + s = s.rstrip("\r\n") + self.getobj("dac_resp").set_text(s) + return s def connect(self): s = self.sel_box.get_active_id() @@ -53,10 +57,16 @@ class SerComm: self.getobj("dac_idn").set_label(self.get_or_to()) def on_connect(self, _): + for x in CHANGE_BUTTONS: + self.getobj(x).set_sensitive(False) + try: self.connect() except Exception as e: - self.error_popup(str(e)) + self.error_popup(str(e)) + + for x in CHANGE_BUTTONS: + self.getobj(x).set_sensitive(True) def refresh(self, _): # Does this cause a memory error? This is a GTK interned string