gui: Display hw_rev when connected

This commit is contained in:
linuswck 2024-09-03 17:00:50 +08:00
parent e632cbbfdd
commit 838592c812
1 changed files with 7 additions and 5 deletions

View File

@ -129,6 +129,9 @@ class Kirdy(QObject):
else:
logging.debug("Attempt to update polling timer when it is stopped")
def get_hw_rev(self):
return self._kirdy.get_hw_rev()
class Graphs:
def __init__(self, ld_i_set_graph, pd_mon_pwr_graph, tec_i_graph, tec_temp_graph, max_samples=1000):
self.graphs = [ld_i_set_graph, pd_mon_pwr_graph, tec_i_graph, tec_temp_graph]
@ -525,12 +528,12 @@ class MainWindow(QtWidgets.QMainWindow):
def setup_menu_bar(self):
@pyqtSlot(bool)
def about_kirdy(_):
# TODO: Replace the hardware revision placeholder
hw_rev = self.kirdy_handler.get_hw_rev()
QtWidgets.QMessageBox.about(
self,
"About Kirdy",
f"""
<h1>Sinara 1550 Kirdy v"major rev"."minor rev"</h1>
<h1>Sinara 1550 Kirdy v{hw_rev["major"]}.{hw_rev["minor"]}</h1>
"""
)
self.menu_action_about_kirdy.triggered.connect(about_kirdy)
@ -769,7 +772,6 @@ class MainWindow(QtWidgets.QMainWindow):
if result:
self.connect_btn.setText("Disconnect")
self.connect_btn.clicked.connect(self.kirdy_handler.end_session)
# TODO: self.hw_rev_data = self.kirdy.hw_rev()
self._status()
else:
if self.kirdy_handler.connecting():
@ -783,10 +785,10 @@ class MainWindow(QtWidgets.QMainWindow):
self.connect_btn.clicked.connect(self.kirdy_handler.end_session)
def _status(self):
# TODO: Get rev no from Kirdy and then add revision into the text
host = self.ip_addr
port = self.port
self.status_lbl.setText(f"Connected to {host}:{port}")
hw_rev = self.kirdy_handler.get_hw_rev()
self.status_lbl.setText(f"Connected to Kirdy v{hw_rev['major']}.{hw_rev['minor']} @ {host}:{port}")
def clear_graphs(self):
self.graphs.clear_data_pts()