1
0
forked from M-Labs/kirdy

gui: move tool, save & load flash btns to menu bar

- Add a new form to update IP address
This commit is contained in:
linuswck 2024-04-19 15:51:58 +08:00
parent 5b35f32a42
commit bfdb1f5066
5 changed files with 1202 additions and 219 deletions

View File

@ -24,9 +24,11 @@ from datetime import datetime, timezone, timedelta
from time import time from time import time
from typing import Any, Optional, List from typing import Any, Optional, List
from ui.ui_conn_settings_form import Ui_Conn_Settings_Form from ui.ui_conn_settings_form import Ui_Conn_Settings_Form
from ui.ui_update_network_settings_form import Ui_Update_Network_Settings_Form
from ui.ui_kirdy_qt import Ui_MainWindow from ui.ui_kirdy_qt import Ui_MainWindow
from dateutil import tz from dateutil import tz
import math import math
import socket
def get_argparser(): def get_argparser():
parser = argparse.ArgumentParser(description="ARTIQ master") parser = argparse.ArgumentParser(description="ARTIQ master")
@ -265,28 +267,49 @@ class MutexParameter(pTypes.ListParameter):
registerParameterType('mutex', MutexParameter) registerParameterType('mutex', MutexParameter)
class NetSettingsForm(QtWidgets.QDialog, Ui_Conn_Settings_Form): class UpdateNetSettingsForm(QtWidgets.QDialog, Ui_Update_Network_Settings_Form):
def __init__(self):
super().__init__()
self.setupUi(self)
def get_net_settings(self):
try:
ip_addr = f"{self.addr_in_0.text()}.{self.addr_in_1.text()}.{self.addr_in_2.text()}.{self.addr_in_3.text()}"
gateway_addr = f"{self.gateway_in_0.text()}.{self.gateway_in_1.text()}.{self.gateway_in_2.text()}.{self.gateway_in_3.text()}"
socket.inet_aton(ip_addr)
socket.inet_aton(gateway_addr)
return {
"ip_addr": ip_addr,
"gateway_addr": gateway_addr,
"prefix_len": int(self.prefix_len_in.text()),
"port": int(self.port_in.text()),
}
except (OSError, ValueError):
return None
class ConnSettingsForm(QtWidgets.QDialog, Ui_Conn_Settings_Form):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.setupUi(self) self.setupUi(self)
def get_net_settings(self): def get_net_settings(self):
try: try:
ip_addr = [self.addr_in_0.text(), self.addr_in_1.text(), self.addr_in_2.text(), self.addr_in_3.text()] ip_addr = f"{self.addr_in_0.text()}.{self.addr_in_1.text()}.{self.addr_in_2.text()}.{self.addr_in_3.text()}"
for addr in ip_addr: socket.inet_aton(ip_addr)
_ = int(addr)
return { return {
"ip_addr": ip_addr, "ip_addr": ip_addr,
"port": int(self.port_in.text()) "port": int(self.port_in.text())
} }
except ValueError: except (OSError, ValueError):
return None return None
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
"""The maximum number of sample points to store.""" """The maximum number of sample points to store."""
DEFAULT_MAX_SAMPLES = 1000 DEFAULT_MAX_SAMPLES = 1000
DEFAULT_IP_ADDR = ['192', '168', '1', '128'] DEFAULT_IP_ADDR = '192.168.1.128'
DEFAULT_PORT = 1337 DEFAULT_PORT = 1337
LASER_DIODE_STATUS = [ LASER_DIODE_STATUS = [
@ -385,13 +408,15 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.ip_addr = self.DEFAULT_IP_ADDR self.ip_addr = self.DEFAULT_IP_ADDR
self.port = self.DEFAULT_PORT self.port = self.DEFAULT_PORT
self.net_settings_form = NetSettingsForm() self.conn_settings_form = ConnSettingsForm()
self.net_settings_form.accepted.connect(self.start_connecting) self.conn_settings_form.accepted.connect(self.start_connecting)
self.update_net_settings_form = UpdateNetSettingsForm()
self.update_net_settings_form.accepted.connect(self.update_net_settings)
self.max_samples = self.DEFAULT_MAX_SAMPLES self.max_samples = self.DEFAULT_MAX_SAMPLES
self.setup_menu_bar()
self._set_up_kirdy_menu()
self._set_up_ctrl_btns() self._set_up_ctrl_btns()
self._set_up_plot_menu() self._set_up_plot_menu()
@ -408,7 +433,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.ld_i_set_graph.setTitle("LD Current Set") self.ld_i_set_graph.setTitle("LD Current Set")
self.pd_mon_pwr_graph.setTitle("PD Mon Power") self.pd_mon_pwr_graph.setTitle("PD Mon Power")
self.connect_btn.clicked.connect(self.show_net_settings_form) self.connect_btn.clicked.connect(self.show_conn_settings_form)
self.report_box.stateChanged.connect(self.on_report_box_stateChanged) self.report_box.stateChanged.connect(self.on_report_box_stateChanged)
self.kirdy_data_watcher = KirdyDataWatcher(self, self.kirdy, self.report_refresh_spin.value()) self.kirdy_data_watcher = KirdyDataWatcher(self, self.kirdy, self.report_refresh_spin.value())
@ -425,23 +450,78 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.graphs = Graphs(self.ld_i_set_graph, self.pd_mon_pwr_graph, self.tec_i_graph, self.tec_temp_graph, max_samples=self.max_samples) self.graphs = Graphs(self.ld_i_set_graph, self.pd_mon_pwr_graph, self.tec_i_graph, self.tec_temp_graph, max_samples=self.max_samples)
self.kirdy_data_watcher.report_update_sig.connect(self.graphs.plot_append) self.kirdy_data_watcher.report_update_sig.connect(self.graphs.plot_append)
self.save_flash_btn.clicked.connect(
lambda: self.save_ld_thermostat_settings_to_flash()
)
self.load_flash_btn.clicked.connect(
lambda: self.load_ld_thermostat_settings_from_flash()
)
self.loading_spinner.hide() self.loading_spinner.hide()
def show_net_settings_form(self): def setup_menu_bar(self):
self.net_settings_form.addr_in_0.setText(self.ip_addr[0]) @pyqtSlot(bool)
self.net_settings_form.addr_in_1.setText(self.ip_addr[1]) def about_kirdy(_):
self.net_settings_form.addr_in_2.setText(self.ip_addr[2]) # TODO: Replace the hardware revision placeholder
self.net_settings_form.addr_in_3.setText(self.ip_addr[3]) QtWidgets.QMessageBox.about(
self.net_settings_form.port_in.setText(str(self.port)) self,
self.net_settings_form.show() "About Kirdy",
f"""
<h1>Sinara 1550 Kirdy v"major rev"."minor rev"</h1>
"""
)
self.menu_action_about_kirdy.triggered.connect(about_kirdy)
@pyqtSlot(bool)
def about_gui(_):
# TODO: Replace the hardware revision placeholder
QtWidgets.QMessageBox.about(
self,
"About Kirdy Control Panel",
f"""
<h1>Version: "Version"</h1>
"""
)
self.menu_action_about_gui.triggered.connect(about_gui)
@asyncSlot(bool)
async def dfu_mode(_):
await self.kirdy.device.dfu()
await self._on_connection_changed(False)
self.menu_action_dfu_mode.triggered.connect(dfu_mode)
@asyncSlot(bool)
async def reset_kirdy(_):
await self._on_connection_changed(False, hard_reset=True)
self.menu_action_hard_reset.triggered.connect(reset_kirdy)
@asyncSlot(bool)
async def save_settings(_):
await self.kirdy.device.save_current_settings_to_flash()
saved = QtWidgets.QMessageBox(self)
saved.setWindowTitle("Config saved")
saved.setText(f"Laser diode and thermostat configs have been saved into flash.")
saved.setIcon(QtWidgets.QMessageBox.Icon.Information)
saved.show()
self.menu_action_save.triggered.connect(save_settings)
@asyncSlot(bool)
async def load_settings(_):
await self.kirdy.device.load_current_settings_from_flash()
loaded = QtWidgets.QMessageBox(self)
loaded.setWindowTitle("Config loaded")
loaded.setText(f"Laser Diode and Thermostat configs have been loaded from flash.")
loaded.setIcon(QtWidgets.QMessageBox.Icon.Information)
loaded.show()
self.menu_action_load.triggered.connect(load_settings)
@asyncSlot(bool)
async def show_update_net_settings_form(_):
self.update_net_settings_form.retranslateUi(self.update_net_settings_form)
self.update_net_settings_form.show()
self.menu_action_update_net_settings.triggered.connect(show_update_net_settings_form)
def show_conn_settings_form(self):
ip_addr = self.ip_addr.split(".")
self.conn_settings_form.addr_in_0.setText(ip_addr[0])
self.conn_settings_form.addr_in_1.setText(ip_addr[1])
self.conn_settings_form.addr_in_2.setText(ip_addr[2])
self.conn_settings_form.addr_in_3.setText(ip_addr[3])
self.conn_settings_form.port_in.setText(str(self.port))
self.conn_settings_form.show()
def _set_up_ctrl_btns(self): def _set_up_ctrl_btns(self):
@asyncSlot(bool) @asyncSlot(bool)
@ -474,104 +554,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
await self.kirdy.thermostat.clear_alarm() await self.kirdy.thermostat.clear_alarm()
self.tec_clear_alarm_btn.clicked.connect(tec_clear_alarm) self.tec_clear_alarm_btn.clicked.connect(tec_clear_alarm)
# TODO: Create a Diag box with QtDesigner instead of setting up here
def _set_up_kirdy_menu(self):
self.kirdy_menu = QtWidgets.QMenu()
self.kirdy_menu.setTitle('Kirdy Settings')
@asyncSlot(int)
async def on_report_box_stateChanged(self, enabled):
await self.kirdy_data_watcher.set_report_mode(enabled)
@asyncSlot(bool)
async def reset_kirdy(_):
await self.kirdy.device.hard_reset()
await self._on_connection_changed(False)
await asyncio.sleep(0.1) # Wait for the reset to start
# TODO: Attempt to reconnect after resetting
self.actionReset.triggered.connect(reset_kirdy)
self.kirdy_menu.addAction(self.actionReset)
@asyncSlot(bool)
async def dfu_mode(_):
await self._on_connection_changed(False)
await self.kirdy.device.dfu()
self.actionEnter_DFU_Mode.triggered.connect(dfu_mode)
self.kirdy_menu.addAction(self.actionEnter_DFU_Mode)
# TODO: Add a form for user to set ip settings in multiple text boxes
@asyncSlot(bool)
async def network_settings(_):
ask_network = QtWidgets.QInputDialog(self)
ask_network.setWindowTitle("Network Settings")
ask_network.setLabelText("Set the kirdy's IPv4 address, port, prefix length and gateway")
ask_network.setTextValue("192.168.1.128 1337 24 192.168.1.1")
@pyqtSlot(str)
def set_ipv4(ipv4_settings):
sure = QtWidgets.QMessageBox(self)
sure.setWindowTitle("Set network?")
sure.setText(f"Setting this as network and disconnecting:<br>{ipv4_settings}")
@asyncSlot(object)
async def really_set(button):
addr, port, prefix_len, gateway = ipv4_settings.split()
addr = list(map(int, addr.split(".")))
gateway = list(map(int, gateway.split(".")))
await self.kirdy.device.set_ip_settings(addr, int(port), int(prefix_len), gateway)
# TODO: Add a dialogue box and ask if the user wanna reboot Kirdy immediately
await self.kirdy.device.hard_reset()
await self._on_connection_changed(False)
sure.buttonClicked.connect(really_set)
sure.show()
ask_network.textValueSelected.connect(set_ipv4)
ask_network.show()
self.actionNetwork_Settings.triggered.connect(network_settings)
self.kirdy_menu.addAction(self.actionNetwork_Settings)
@asyncSlot(bool)
async def load(_):
await self.kirdy.device.load_current_settings_to_flash()
loaded = QtWidgets.QMessageBox(self)
loaded.setWindowTitle("Config loaded")
loaded.setText(f"All channel configs have been loaded from flash.")
loaded.setIcon(QtWidgets.QMessageBox.Icon.Information)
loaded.show()
self.actionLoad_all_configs.triggered.connect(load)
self.kirdy_menu.addAction(self.actionLoad_all_configs)
@asyncSlot(bool)
async def save(_):
await self.kirdy.device.save_current_settings_to_flash()
saved = QtWidgets.QMessageBox(self)
saved.setWindowTitle("Config saved")
saved.setText(f"All channel configs have been saved to flash.")
saved.setIcon(QtWidgets.QMessageBox.Icon.Information)
saved.show()
self.actionSave_all_configs.triggered.connect(save)
self.kirdy_menu.addAction(self.actionSave_all_configs)
def about_kirdy():
# TODO: Replace the hardware revision placeholder
QtWidgets.QMessageBox.about(
self,
"About Kirdy",
f"""
<h1>Sinara 1550 Kirdy v"major rev"."minor rev"</h1>
"""
)
self.actionAbout_Kirdy.triggered.connect(about_kirdy)
self.kirdy_menu.addAction(self.actionAbout_Kirdy)
self.kirdy_settings.setMenu(self.kirdy_menu)
def _set_up_plot_menu(self): def _set_up_plot_menu(self):
self.plot_menu = QtWidgets.QMenu() self.plot_menu = QtWidgets.QMenu()
self.plot_menu.setTitle("Plot Settings") self.plot_menu.setTitle("Plot Settings")
@ -627,6 +609,17 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.tec_clear_alarm_btn.setEnabled(result) self.tec_clear_alarm_btn.setEnabled(result)
ctrl_panel_setEnable(result) ctrl_panel_setEnable(result)
def menu_bar_setEnable(result):
self.menu_action_about_kirdy.setEnabled(result)
self.menu_action_connect.setEnabled(result)
self.menu_action_dfu_mode.setEnabled(result)
self.menu_action_disconnect.setEnabled(result)
self.menu_action_hard_reset.setEnabled(result)
self.menu_action_save.setEnabled(result)
self.menu_action_load.setEnabled(result)
self.menu_action_update_net_settings.setEnabled(result)
menu_bar_setEnable(result)
def graph_group_setEnable(result): def graph_group_setEnable(result):
self.ld_i_set_graph.setEnabled(result) self.ld_i_set_graph.setEnabled(result)
self.pd_mon_pwr_graph.setEnabled(result) self.pd_mon_pwr_graph.setEnabled(result)
@ -634,15 +627,12 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.tec_temp_graph.setEnabled(result) self.tec_temp_graph.setEnabled(result)
graph_group_setEnable(result) graph_group_setEnable(result)
self.kirdy_settings.setEnabled(result)
self.report_refresh_spin.setEnabled(result) self.report_refresh_spin.setEnabled(result)
self.report_group.setEnabled(result) self.report_group.setEnabled(result)
self.report_refresh_spin.setEnabled(result) self.report_refresh_spin.setEnabled(result)
self.report_box.setEnabled(result) self.report_box.setEnabled(result)
self.report_apply_btn.setEnabled(result) self.report_apply_btn.setEnabled(result)
self.save_flash_btn.setEnabled(result)
self.load_flash_btn.setEnabled(result)
# TODO: Use QStateMachine to manage connections # TODO: Use QStateMachine to manage connections
self.connect_btn.clicked.disconnect() self.connect_btn.clicked.disconnect()
@ -651,15 +641,13 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.connect_btn.clicked.connect(self.bail) self.connect_btn.clicked.connect(self.bail)
else: else:
self.connect_btn.setText("Connect") self.connect_btn.setText("Connect")
self.connect_btn.clicked.connect(self.show_net_settings_form) self.connect_btn.clicked.connect(self.show_conn_settings_form)
if result: if result:
# TODO: self.hw_rev_data = await self.kirdy.hw_rev() # TODO: self.hw_rev_data = await self.kirdy.hw_rev()
self._status() self._status()
self.kirdy_data_watcher.start_watching() self.kirdy_data_watcher.start_watching()
else: else:
pass
self.status_lbl.setText("Disconnected")
self.clear_graphs() self.clear_graphs()
self.report_box.setChecked(False) self.report_box.setChecked(False)
await self.kirdy_data_watcher.stop_watching() await self.kirdy_data_watcher.stop_watching()
@ -670,30 +658,13 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def _status(self): def _status(self):
# TODO: Get rev no from Kirdy and then add revision into the text # TODO: Get rev no from Kirdy and then add revision into the text
host = f"{self.ip_addr[0]}.{self.ip_addr[1]}.{self.ip_addr[2]}.{self.ip_addr[3]}" host = self.ip_addr
port = self.port port = self.port
self.status_lbl.setText(f"Connected to Kirdy @ {host}:{port}") self.status_lbl.setText(f"Connected to Kirdy @ {host}:{port}")
def clear_graphs(self): def clear_graphs(self):
self.graphs.clear_data_pts() self.graphs.clear_data_pts()
def update_network_settings(self):
net_settings = self.net_settings_form.get_net_settings()
if net_settings is None:
return False;
self.ip_addr = net_settings["ip_addr"]
self.port = net_settings["port"]
return True
@asyncSlot()
async def save_ld_thermostat_settings_to_flash(self):
await self.kirdy.device.save_current_settings_to_flash()
@asyncSlot()
async def load_ld_thermostat_settings_from_flash(self):
await self.kirdy.device.load_current_settings_from_flash()
@asyncSlot(dict) @asyncSlot(dict)
async def graphs_update(self, report): async def graphs_update(self, report):
self.graphs.plot_append(report) self.graphs.plot_append(report)
@ -785,11 +756,28 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
await self.kirdy_data_watcher.set_report_mode(enabled) await self.kirdy_data_watcher.set_report_mode(enabled)
@asyncSlot() @asyncSlot()
async def start_connecting(self): async def update_net_settings(self):
if not self.update_network_settings(): net_settings = self.update_net_settings_form.get_net_settings()
if net_settings is None:
self.status_lbl.setText("Invalid IP Settings Input") self.status_lbl.setText("Invalid IP Settings Input")
return return
host = f"{self.ip_addr[0]}.{self.ip_addr[1]}.{self.ip_addr[2]}.{self.ip_addr[3]}" addr = net_settings["ip_addr"]
port = net_settings["port"]
prefix_len = net_settings["prefix_len"]
gateway = net_settings["gateway_addr"]
await self.kirdy.device.set_ip_settings(addr, port, prefix_len, gateway)
self.status_lbl.setText("IP Settings is Updated")
@asyncSlot()
async def start_connecting(self):
net_settings = self.conn_settings_form.get_net_settings()
if net_settings is None:
self.status_lbl.setText("Invalid IP Settings Input")
return
self.ip_addr = net_settings["ip_addr"]
self.port = net_settings["port"]
host = self.ip_addr
port = self.port port = self.port
try: try:
if not (self.kirdy.connecting() or self.kirdy.connected()): if not (self.kirdy.connecting() or self.kirdy.connected()):
@ -798,7 +786,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
await self._on_connection_changed(True) await self._on_connection_changed(True)
else: else:
await self.bail() await self.bail()
except (OSError, TimeoutError) as e: except (OSError, TimeoutError, ConnectionResetError) as e:
logging.error(f"Failed communicating to {host}:{port}: {e}") logging.error(f"Failed communicating to {host}:{port}: {e}")
await self.bail() await self.bail()
self.status_lbl.setText(f"Cannot connect to Kirdy@ {host}:{port}") self.status_lbl.setText(f"Cannot connect to Kirdy@ {host}:{port}")

View File

@ -372,19 +372,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QToolButton" name="kirdy_settings">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string notr="true">⚙</string>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="plot_settings"> <widget class="QToolButton" name="plot_settings">
<property name="toolTip"> <property name="toolTip">
@ -428,39 +415,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<item>
<widget class="QPushButton" name="save_flash_btn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Save Settings to Flash</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="load_flash_btn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Load Settings from Flash</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="QWidget" name="report_group" native="true"> <widget class="QWidget" name="report_group" native="true">
<property name="enabled"> <property name="enabled">
@ -640,6 +594,50 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<height>23</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QMenu" name="menuKirdy">
<property name="enabled">
<bool>true</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="title">
<string>Kirdy</string>
</property>
<addaction name="menu_action_about_kirdy"/>
<addaction name="menu_action_update_net_settings"/>
<addaction name="menu_action_save"/>
<addaction name="menu_action_load"/>
<addaction name="menu_action_dfu_mode"/>
<addaction name="menu_action_hard_reset"/>
</widget>
<widget class="QMenu" name="menuAbout">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="title">
<string>About</string>
</property>
<addaction name="menu_action_about_gui"/>
</widget>
<addaction name="menuKirdy"/>
<addaction name="menuAbout"/>
</widget>
<action name="actionReset"> <action name="actionReset">
<property name="text"> <property name="text">
<string>Reset</string> <string>Reset</string>
@ -706,6 +704,82 @@
<enum>QAction::NoRole</enum> <enum>QAction::NoRole</enum>
</property> </property>
</action> </action>
<action name="actionConnection_Settings">
<property name="text">
<string>Connect</string>
</property>
</action>
<action name="menu_action_update_net_settings">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Update Network Settings</string>
</property>
</action>
<action name="menu_action_dfu_mode">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Enter DFU Mode</string>
</property>
</action>
<action name="menu_action_save">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Save Settings to Flash</string>
</property>
</action>
<action name="menu_action_hard_reset">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Hard Reset</string>
</property>
</action>
<action name="menu_action_connect">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Connect</string>
</property>
</action>
<action name="menu_action_disconnect">
<property name="text">
<string>Disconnect</string>
</property>
</action>
<action name="menu_action_about_gui">
<property name="text">
<string>About GUI</string>
</property>
</action>
<action name="action">
<property name="text">
<string>test</string>
</property>
</action>
<action name="menu_action_about_kirdy">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>About Kirdy</string>
</property>
</action>
<action name="menu_action_load">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Load Settings from Flash</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View File

@ -181,12 +181,6 @@ class Ui_MainWindow(object):
self.status_lbl.setBaseSize(QtCore.QSize(120, 50)) self.status_lbl.setBaseSize(QtCore.QSize(120, 50))
self.status_lbl.setObjectName("status_lbl") self.status_lbl.setObjectName("status_lbl")
self.settings_layout.addWidget(self.status_lbl) self.settings_layout.addWidget(self.status_lbl)
self.kirdy_settings = QtWidgets.QToolButton(parent=self.bottom_settings_group)
self.kirdy_settings.setEnabled(False)
self.kirdy_settings.setText("")
self.kirdy_settings.setPopupMode(QtWidgets.QToolButton.ToolButtonPopupMode.InstantPopup)
self.kirdy_settings.setObjectName("kirdy_settings")
self.settings_layout.addWidget(self.kirdy_settings)
self.plot_settings = QtWidgets.QToolButton(parent=self.bottom_settings_group) self.plot_settings = QtWidgets.QToolButton(parent=self.bottom_settings_group)
self.plot_settings.setPopupMode(QtWidgets.QToolButton.ToolButtonPopupMode.InstantPopup) self.plot_settings.setPopupMode(QtWidgets.QToolButton.ToolButtonPopupMode.InstantPopup)
self.plot_settings.setObjectName("plot_settings") self.plot_settings.setObjectName("plot_settings")
@ -203,19 +197,6 @@ class Ui_MainWindow(object):
self.settings_layout.addWidget(self.loading_spinner) self.settings_layout.addWidget(self.loading_spinner)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
self.settings_layout.addItem(spacerItem) self.settings_layout.addItem(spacerItem)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setContentsMargins(10, -1, 10, -1)
self.horizontalLayout_3.setSpacing(10)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.save_flash_btn = QtWidgets.QPushButton(parent=self.bottom_settings_group)
self.save_flash_btn.setEnabled(False)
self.save_flash_btn.setObjectName("save_flash_btn")
self.horizontalLayout_3.addWidget(self.save_flash_btn)
self.load_flash_btn = QtWidgets.QPushButton(parent=self.bottom_settings_group)
self.load_flash_btn.setEnabled(False)
self.load_flash_btn.setObjectName("load_flash_btn")
self.horizontalLayout_3.addWidget(self.load_flash_btn)
self.settings_layout.addLayout(self.horizontalLayout_3)
self.report_group = QtWidgets.QWidget(parent=self.bottom_settings_group) self.report_group = QtWidgets.QWidget(parent=self.bottom_settings_group)
self.report_group.setEnabled(False) self.report_group.setEnabled(False)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
@ -287,6 +268,19 @@ class Ui_MainWindow(object):
self.main_layout.addWidget(self.bottom_settings_group) self.main_layout.addWidget(self.bottom_settings_group)
self.gridLayout_2.addLayout(self.main_layout, 0, 0, 1, 1) self.gridLayout_2.addLayout(self.main_layout, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.main_widget) MainWindow.setCentralWidget(self.main_widget)
self.menuBar = QtWidgets.QMenuBar(parent=MainWindow)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 1280, 23))
self.menuBar.setStyleSheet("")
self.menuBar.setObjectName("menuBar")
self.menuKirdy = QtWidgets.QMenu(parent=self.menuBar)
self.menuKirdy.setEnabled(True)
self.menuKirdy.setAutoFillBackground(False)
self.menuKirdy.setStyleSheet("")
self.menuKirdy.setObjectName("menuKirdy")
self.menuAbout = QtWidgets.QMenu(parent=self.menuBar)
self.menuAbout.setStyleSheet("")
self.menuAbout.setObjectName("menuAbout")
MainWindow.setMenuBar(self.menuBar)
self.actionReset = QtGui.QAction(parent=MainWindow) self.actionReset = QtGui.QAction(parent=MainWindow)
self.actionReset.setMenuRole(QtGui.QAction.MenuRole.NoRole) self.actionReset.setMenuRole(QtGui.QAction.MenuRole.NoRole)
self.actionReset.setObjectName("actionReset") self.actionReset.setObjectName("actionReset")
@ -305,6 +299,44 @@ class Ui_MainWindow(object):
self.actionSave_all_configs = QtGui.QAction(parent=MainWindow) self.actionSave_all_configs = QtGui.QAction(parent=MainWindow)
self.actionSave_all_configs.setMenuRole(QtGui.QAction.MenuRole.NoRole) self.actionSave_all_configs.setMenuRole(QtGui.QAction.MenuRole.NoRole)
self.actionSave_all_configs.setObjectName("actionSave_all_configs") self.actionSave_all_configs.setObjectName("actionSave_all_configs")
self.actionConnection_Settings = QtGui.QAction(parent=MainWindow)
self.actionConnection_Settings.setObjectName("actionConnection_Settings")
self.menu_action_update_net_settings = QtGui.QAction(parent=MainWindow)
self.menu_action_update_net_settings.setEnabled(False)
self.menu_action_update_net_settings.setObjectName("menu_action_update_net_settings")
self.menu_action_dfu_mode = QtGui.QAction(parent=MainWindow)
self.menu_action_dfu_mode.setEnabled(False)
self.menu_action_dfu_mode.setObjectName("menu_action_dfu_mode")
self.menu_action_save = QtGui.QAction(parent=MainWindow)
self.menu_action_save.setEnabled(False)
self.menu_action_save.setObjectName("menu_action_save")
self.menu_action_hard_reset = QtGui.QAction(parent=MainWindow)
self.menu_action_hard_reset.setEnabled(False)
self.menu_action_hard_reset.setObjectName("menu_action_hard_reset")
self.menu_action_connect = QtGui.QAction(parent=MainWindow)
self.menu_action_connect.setEnabled(False)
self.menu_action_connect.setObjectName("menu_action_connect")
self.menu_action_disconnect = QtGui.QAction(parent=MainWindow)
self.menu_action_disconnect.setObjectName("menu_action_disconnect")
self.menu_action_about_gui = QtGui.QAction(parent=MainWindow)
self.menu_action_about_gui.setObjectName("menu_action_about_gui")
self.action = QtGui.QAction(parent=MainWindow)
self.action.setObjectName("action")
self.menu_action_about_kirdy = QtGui.QAction(parent=MainWindow)
self.menu_action_about_kirdy.setEnabled(False)
self.menu_action_about_kirdy.setObjectName("menu_action_about_kirdy")
self.menu_action_load = QtGui.QAction(parent=MainWindow)
self.menu_action_load.setEnabled(False)
self.menu_action_load.setObjectName("menu_action_load")
self.menuKirdy.addAction(self.menu_action_about_kirdy)
self.menuKirdy.addAction(self.menu_action_update_net_settings)
self.menuKirdy.addAction(self.menu_action_save)
self.menuKirdy.addAction(self.menu_action_load)
self.menuKirdy.addAction(self.menu_action_dfu_mode)
self.menuKirdy.addAction(self.menu_action_hard_reset)
self.menuAbout.addAction(self.menu_action_about_gui)
self.menuBar.addAction(self.menuKirdy.menuAction())
self.menuBar.addAction(self.menuAbout.menuAction())
self.retranslateUi(MainWindow) self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
@ -325,12 +357,12 @@ class Ui_MainWindow(object):
self.plot_settings.setToolTip(_translate("MainWindow", "Plot Settings")) self.plot_settings.setToolTip(_translate("MainWindow", "Plot Settings"))
self.plot_settings.setText(_translate("MainWindow", "📉")) self.plot_settings.setText(_translate("MainWindow", "📉"))
self.background_task_lbl.setText(_translate("MainWindow", "Ready.")) self.background_task_lbl.setText(_translate("MainWindow", "Ready."))
self.save_flash_btn.setText(_translate("MainWindow", "Save Settings to Flash"))
self.load_flash_btn.setText(_translate("MainWindow", "Load Settings from Flash"))
self.report_lbl.setText(_translate("MainWindow", "Poll every: ")) self.report_lbl.setText(_translate("MainWindow", "Poll every: "))
self.report_refresh_spin.setSuffix(_translate("MainWindow", " s")) self.report_refresh_spin.setSuffix(_translate("MainWindow", " s"))
self.report_box.setText(_translate("MainWindow", "Report")) self.report_box.setText(_translate("MainWindow", "Report"))
self.report_apply_btn.setText(_translate("MainWindow", "Apply")) self.report_apply_btn.setText(_translate("MainWindow", "Apply"))
self.menuKirdy.setTitle(_translate("MainWindow", "Kirdy"))
self.menuAbout.setTitle(_translate("MainWindow", "About"))
self.actionReset.setText(_translate("MainWindow", "Reset")) self.actionReset.setText(_translate("MainWindow", "Reset"))
self.actionReset.setToolTip(_translate("MainWindow", "Reset the Kirdy")) self.actionReset.setToolTip(_translate("MainWindow", "Reset the Kirdy"))
self.actionEnter_DFU_Mode.setText(_translate("MainWindow", "Enter DFU Mode")) self.actionEnter_DFU_Mode.setText(_translate("MainWindow", "Enter DFU Mode"))
@ -343,6 +375,17 @@ class Ui_MainWindow(object):
self.actionLoad_all_configs.setToolTip(_translate("MainWindow", "Restore configuration for all channels from flash")) self.actionLoad_all_configs.setToolTip(_translate("MainWindow", "Restore configuration for all channels from flash"))
self.actionSave_all_configs.setText(_translate("MainWindow", "Save all channel configs to flash")) self.actionSave_all_configs.setText(_translate("MainWindow", "Save all channel configs to flash"))
self.actionSave_all_configs.setToolTip(_translate("MainWindow", "Save configuration for all channels to flash")) self.actionSave_all_configs.setToolTip(_translate("MainWindow", "Save configuration for all channels to flash"))
self.actionConnection_Settings.setText(_translate("MainWindow", "Connect"))
self.menu_action_update_net_settings.setText(_translate("MainWindow", "Update Network Settings"))
self.menu_action_dfu_mode.setText(_translate("MainWindow", "Enter DFU Mode"))
self.menu_action_save.setText(_translate("MainWindow", "Save Settings to Flash"))
self.menu_action_hard_reset.setText(_translate("MainWindow", "Hard Reset"))
self.menu_action_connect.setText(_translate("MainWindow", "Connect"))
self.menu_action_disconnect.setText(_translate("MainWindow", "Disconnect"))
self.menu_action_about_gui.setText(_translate("MainWindow", "About GUI"))
self.action.setText(_translate("MainWindow", "test"))
self.menu_action_about_kirdy.setText(_translate("MainWindow", "About Kirdy"))
self.menu_action_load.setText(_translate("MainWindow", "Load Settings from Flash"))
from pglive.sources.live_plot_widget import LivePlotWidget from pglive.sources.live_plot_widget import LivePlotWidget
from pyqtgraph.parametertree import ParameterTree from pyqtgraph.parametertree import ParameterTree
from waitingspinnerwidget import QtWaitingSpinner from waitingspinnerwidget import QtWaitingSpinner

View File

@ -0,0 +1,264 @@
# Form implementation generated from reading ui file 'update_network_settings_form.ui'
#
# Created by: PyQt6 UI code generator 6.6.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Update_Network_Settings_Form(object):
def setupUi(self, Update_Network_Settings_Form):
Update_Network_Settings_Form.setObjectName("Update_Network_Settings_Form")
Update_Network_Settings_Form.resize(415, 180)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(Update_Network_Settings_Form.sizePolicy().hasHeightForWidth())
Update_Network_Settings_Form.setSizePolicy(sizePolicy)
Update_Network_Settings_Form.setMinimumSize(QtCore.QSize(415, 180))
Update_Network_Settings_Form.setMaximumSize(QtCore.QSize(415, 180))
self.horizontalLayoutWidget = QtWidgets.QWidget(parent=Update_Network_Settings_Form)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(20, 10, 371, 41))
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
self.ip_addr_layout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
self.ip_addr_layout.setContentsMargins(0, 0, 0, 0)
self.ip_addr_layout.setObjectName("ip_addr_layout")
self.ip_addr_label = QtWidgets.QLabel(parent=self.horizontalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.ip_addr_label.sizePolicy().hasHeightForWidth())
self.ip_addr_label.setSizePolicy(sizePolicy)
self.ip_addr_label.setMaximumSize(QtCore.QSize(120, 16777215))
font = QtGui.QFont()
font.setPointSize(12)
self.ip_addr_label.setFont(font)
self.ip_addr_label.setLayoutDirection(QtCore.Qt.LayoutDirection.LeftToRight)
self.ip_addr_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
self.ip_addr_label.setObjectName("ip_addr_label")
self.ip_addr_layout.addWidget(self.ip_addr_label)
self.addr_in_0 = QtWidgets.QLineEdit(parent=self.horizontalLayoutWidget)
self.addr_in_0.setMaximumSize(QtCore.QSize(50, 16777215))
self.addr_in_0.setMaxLength(3)
self.addr_in_0.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.addr_in_0.setObjectName("addr_in_0")
self.ip_addr_layout.addWidget(self.addr_in_0)
self.dot_0_lbl = QtWidgets.QLabel(parent=self.horizontalLayoutWidget)
self.dot_0_lbl.setMaximumSize(QtCore.QSize(10, 16777215))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(False)
font.setKerning(True)
self.dot_0_lbl.setFont(font)
self.dot_0_lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.dot_0_lbl.setObjectName("dot_0_lbl")
self.ip_addr_layout.addWidget(self.dot_0_lbl)
self.addr_in_1 = QtWidgets.QLineEdit(parent=self.horizontalLayoutWidget)
self.addr_in_1.setMaximumSize(QtCore.QSize(50, 16777215))
self.addr_in_1.setMaxLength(3)
self.addr_in_1.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.addr_in_1.setObjectName("addr_in_1")
self.ip_addr_layout.addWidget(self.addr_in_1)
self.dot_1_lbl = QtWidgets.QLabel(parent=self.horizontalLayoutWidget)
self.dot_1_lbl.setMaximumSize(QtCore.QSize(10, 16777215))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(False)
font.setKerning(True)
self.dot_1_lbl.setFont(font)
self.dot_1_lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.dot_1_lbl.setObjectName("dot_1_lbl")
self.ip_addr_layout.addWidget(self.dot_1_lbl)
self.addr_in_2 = QtWidgets.QLineEdit(parent=self.horizontalLayoutWidget)
self.addr_in_2.setMaximumSize(QtCore.QSize(50, 16777215))
self.addr_in_2.setMaxLength(3)
self.addr_in_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.addr_in_2.setObjectName("addr_in_2")
self.ip_addr_layout.addWidget(self.addr_in_2)
self.dot_2_lbl = QtWidgets.QLabel(parent=self.horizontalLayoutWidget)
self.dot_2_lbl.setMaximumSize(QtCore.QSize(10, 16777215))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(False)
font.setKerning(True)
self.dot_2_lbl.setFont(font)
self.dot_2_lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.dot_2_lbl.setObjectName("dot_2_lbl")
self.ip_addr_layout.addWidget(self.dot_2_lbl)
self.addr_in_3 = QtWidgets.QLineEdit(parent=self.horizontalLayoutWidget)
self.addr_in_3.setMaximumSize(QtCore.QSize(50, 16777215))
self.addr_in_3.setMaxLength(3)
self.addr_in_3.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.addr_in_3.setObjectName("addr_in_3")
self.ip_addr_layout.addWidget(self.addr_in_3)
self.horizontalLayoutWidget_4 = QtWidgets.QWidget(parent=Update_Network_Settings_Form)
self.horizontalLayoutWidget_4.setGeometry(QtCore.QRect(20, 130, 371, 47))
self.horizontalLayoutWidget_4.setObjectName("horizontalLayoutWidget_4")
self.buttons_layout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_4)
self.buttons_layout.setContentsMargins(0, 0, 0, 0)
self.buttons_layout.setObjectName("buttons_layout")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
self.buttons_layout.addItem(spacerItem)
self.update_btn = QtWidgets.QPushButton(parent=self.horizontalLayoutWidget_4)
self.update_btn.setObjectName("update_btn")
self.buttons_layout.addWidget(self.update_btn)
self.cancel_btn = QtWidgets.QPushButton(parent=self.horizontalLayoutWidget_4)
self.cancel_btn.setObjectName("cancel_btn")
self.buttons_layout.addWidget(self.cancel_btn)
self.horizontalLayoutWidget_3 = QtWidgets.QWidget(parent=Update_Network_Settings_Form)
self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect(20, 90, 371, 41))
self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3")
self.port_layout_2 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_3)
self.port_layout_2.setContentsMargins(0, 0, 0, 0)
self.port_layout_2.setSpacing(6)
self.port_layout_2.setObjectName("port_layout_2")
self.prefix_len_lbl = QtWidgets.QLabel(parent=self.horizontalLayoutWidget_3)
self.prefix_len_lbl.setMaximumSize(QtCore.QSize(98, 16777215))
font = QtGui.QFont()
font.setPointSize(12)
self.prefix_len_lbl.setFont(font)
self.prefix_len_lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
self.prefix_len_lbl.setObjectName("prefix_len_lbl")
self.port_layout_2.addWidget(self.prefix_len_lbl)
self.prefix_len_in = QtWidgets.QLineEdit(parent=self.horizontalLayoutWidget_3)
self.prefix_len_in.setMaximumSize(QtCore.QSize(50, 16777215))
self.prefix_len_in.setMaxLength(2)
self.prefix_len_in.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.prefix_len_in.setObjectName("prefix_len_in")
self.port_layout_2.addWidget(self.prefix_len_in)
self.port_no_lbl = QtWidgets.QLabel(parent=self.horizontalLayoutWidget_3)
self.port_no_lbl.setMinimumSize(QtCore.QSize(82, 0))
self.port_no_lbl.setMaximumSize(QtCore.QSize(50, 16777215))
font = QtGui.QFont()
font.setPointSize(12)
self.port_no_lbl.setFont(font)
self.port_no_lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
self.port_no_lbl.setObjectName("port_no_lbl")
self.port_layout_2.addWidget(self.port_no_lbl)
self.port_in = QtWidgets.QLineEdit(parent=self.horizontalLayoutWidget_3)
self.port_in.setMaximumSize(QtCore.QSize(50, 16777215))
self.port_in.setMaxLength(5)
self.port_in.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.port_in.setObjectName("port_in")
self.port_layout_2.addWidget(self.port_in)
spacerItem1 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
self.port_layout_2.addItem(spacerItem1)
self.horizontalLayoutWidget_5 = QtWidgets.QWidget(parent=Update_Network_Settings_Form)
self.horizontalLayoutWidget_5.setGeometry(QtCore.QRect(20, 50, 371, 41))
self.horizontalLayoutWidget_5.setObjectName("horizontalLayoutWidget_5")
self.gateway_layout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_5)
self.gateway_layout.setContentsMargins(0, 0, 0, 0)
self.gateway_layout.setObjectName("gateway_layout")
self.gateway_lbl = QtWidgets.QLabel(parent=self.horizontalLayoutWidget_5)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.gateway_lbl.sizePolicy().hasHeightForWidth())
self.gateway_lbl.setSizePolicy(sizePolicy)
self.gateway_lbl.setMaximumSize(QtCore.QSize(120, 16777215))
font = QtGui.QFont()
font.setPointSize(12)
self.gateway_lbl.setFont(font)
self.gateway_lbl.setLayoutDirection(QtCore.Qt.LayoutDirection.LeftToRight)
self.gateway_lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
self.gateway_lbl.setObjectName("gateway_lbl")
self.gateway_layout.addWidget(self.gateway_lbl)
self.gateway_in_0 = QtWidgets.QLineEdit(parent=self.horizontalLayoutWidget_5)
self.gateway_in_0.setMaximumSize(QtCore.QSize(50, 16777215))
self.gateway_in_0.setMaxLength(3)
self.gateway_in_0.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.gateway_in_0.setObjectName("gateway_in_0")
self.gateway_layout.addWidget(self.gateway_in_0)
self.dot_0_lbl_2 = QtWidgets.QLabel(parent=self.horizontalLayoutWidget_5)
self.dot_0_lbl_2.setMaximumSize(QtCore.QSize(10, 16777215))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(False)
font.setKerning(True)
self.dot_0_lbl_2.setFont(font)
self.dot_0_lbl_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.dot_0_lbl_2.setObjectName("dot_0_lbl_2")
self.gateway_layout.addWidget(self.dot_0_lbl_2)
self.gateway_in_1 = QtWidgets.QLineEdit(parent=self.horizontalLayoutWidget_5)
self.gateway_in_1.setMaximumSize(QtCore.QSize(50, 16777215))
self.gateway_in_1.setMaxLength(3)
self.gateway_in_1.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.gateway_in_1.setObjectName("gateway_in_1")
self.gateway_layout.addWidget(self.gateway_in_1)
self.dot_1_lbl_2 = QtWidgets.QLabel(parent=self.horizontalLayoutWidget_5)
self.dot_1_lbl_2.setMaximumSize(QtCore.QSize(10, 16777215))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(False)
font.setKerning(True)
self.dot_1_lbl_2.setFont(font)
self.dot_1_lbl_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.dot_1_lbl_2.setObjectName("dot_1_lbl_2")
self.gateway_layout.addWidget(self.dot_1_lbl_2)
self.gateway_in_2 = QtWidgets.QLineEdit(parent=self.horizontalLayoutWidget_5)
self.gateway_in_2.setMaximumSize(QtCore.QSize(50, 16777215))
self.gateway_in_2.setMaxLength(3)
self.gateway_in_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.gateway_in_2.setObjectName("gateway_in_2")
self.gateway_layout.addWidget(self.gateway_in_2)
self.dot_2_lbl_2 = QtWidgets.QLabel(parent=self.horizontalLayoutWidget_5)
self.dot_2_lbl_2.setMaximumSize(QtCore.QSize(10, 16777215))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(False)
font.setKerning(True)
self.dot_2_lbl_2.setFont(font)
self.dot_2_lbl_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.dot_2_lbl_2.setObjectName("dot_2_lbl_2")
self.gateway_layout.addWidget(self.dot_2_lbl_2)
self.gateway_in_3 = QtWidgets.QLineEdit(parent=self.horizontalLayoutWidget_5)
self.gateway_in_3.setMaximumSize(QtCore.QSize(50, 16777215))
self.gateway_in_3.setMaxLength(3)
self.gateway_in_3.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.gateway_in_3.setObjectName("gateway_in_3")
self.gateway_layout.addWidget(self.gateway_in_3)
self.retranslateUi(Update_Network_Settings_Form)
self.cancel_btn.clicked.connect(Update_Network_Settings_Form.reject) # type: ignore
self.update_btn.clicked.connect(Update_Network_Settings_Form.accept) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Update_Network_Settings_Form)
Update_Network_Settings_Form.setTabOrder(self.addr_in_0, self.addr_in_1)
Update_Network_Settings_Form.setTabOrder(self.addr_in_1, self.addr_in_2)
Update_Network_Settings_Form.setTabOrder(self.addr_in_2, self.addr_in_3)
Update_Network_Settings_Form.setTabOrder(self.addr_in_3, self.gateway_in_0)
Update_Network_Settings_Form.setTabOrder(self.gateway_in_0, self.gateway_in_1)
Update_Network_Settings_Form.setTabOrder(self.gateway_in_1, self.gateway_in_2)
Update_Network_Settings_Form.setTabOrder(self.gateway_in_2, self.gateway_in_3)
Update_Network_Settings_Form.setTabOrder(self.gateway_in_3, self.prefix_len_in)
Update_Network_Settings_Form.setTabOrder(self.prefix_len_in, self.port_in)
Update_Network_Settings_Form.setTabOrder(self.port_in, self.update_btn)
Update_Network_Settings_Form.setTabOrder(self.update_btn, self.cancel_btn)
def retranslateUi(self, Update_Network_Settings_Form):
_translate = QtCore.QCoreApplication.translate
Update_Network_Settings_Form.setWindowTitle(_translate("Update_Network_Settings_Form", "Update Network Settings"))
self.ip_addr_label.setText(_translate("Update_Network_Settings_Form", "IP Address:"))
self.addr_in_0.setText(_translate("Update_Network_Settings_Form", "192"))
self.dot_0_lbl.setText(_translate("Update_Network_Settings_Form", "."))
self.addr_in_1.setText(_translate("Update_Network_Settings_Form", "168"))
self.dot_1_lbl.setText(_translate("Update_Network_Settings_Form", "."))
self.addr_in_2.setText(_translate("Update_Network_Settings_Form", "1"))
self.dot_2_lbl.setText(_translate("Update_Network_Settings_Form", "."))
self.addr_in_3.setText(_translate("Update_Network_Settings_Form", "128"))
self.update_btn.setText(_translate("Update_Network_Settings_Form", "Update"))
self.cancel_btn.setText(_translate("Update_Network_Settings_Form", "Cancel"))
self.prefix_len_lbl.setText(_translate("Update_Network_Settings_Form", "Prefix Length:"))
self.prefix_len_in.setText(_translate("Update_Network_Settings_Form", "24"))
self.port_no_lbl.setText(_translate("Update_Network_Settings_Form", "Port:"))
self.port_in.setText(_translate("Update_Network_Settings_Form", "1337"))
self.gateway_lbl.setText(_translate("Update_Network_Settings_Form", "Gateway:"))
self.gateway_in_0.setText(_translate("Update_Network_Settings_Form", "192"))
self.dot_0_lbl_2.setText(_translate("Update_Network_Settings_Form", "."))
self.gateway_in_1.setText(_translate("Update_Network_Settings_Form", "168"))
self.dot_1_lbl_2.setText(_translate("Update_Network_Settings_Form", "."))
self.gateway_in_2.setText(_translate("Update_Network_Settings_Form", "1"))
self.dot_2_lbl_2.setText(_translate("Update_Network_Settings_Form", "."))
self.gateway_in_3.setText(_translate("Update_Network_Settings_Form", "1"))

View File

@ -0,0 +1,614 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Update_Network_Settings_Form</class>
<widget class="QDialog" name="Update_Network_Settings_Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>415</width>
<height>180</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>415</width>
<height>180</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>415</width>
<height>180</height>
</size>
</property>
<property name="windowTitle">
<string>Update Network Settings</string>
</property>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>371</width>
<height>41</height>
</rect>
</property>
<layout class="QHBoxLayout" name="ip_addr_layout">
<item>
<widget class="QLabel" name="ip_addr_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>IP Address:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="addr_in_0">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>192</string>
</property>
<property name="maxLength">
<number>3</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dot_0_lbl">
<property name="maximumSize">
<size>
<width>10</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<bold>false</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="addr_in_1">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>168</string>
</property>
<property name="maxLength">
<number>3</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dot_1_lbl">
<property name="maximumSize">
<size>
<width>10</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<bold>false</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="addr_in_2">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>1</string>
</property>
<property name="maxLength">
<number>3</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dot_2_lbl">
<property name="maximumSize">
<size>
<width>10</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<bold>false</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="addr_in_3">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>128</string>
</property>
<property name="maxLength">
<number>3</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget_4">
<property name="geometry">
<rect>
<x>20</x>
<y>130</y>
<width>371</width>
<height>47</height>
</rect>
</property>
<layout class="QHBoxLayout" name="buttons_layout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="update_btn">
<property name="text">
<string>Update</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancel_btn">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget_3">
<property name="geometry">
<rect>
<x>20</x>
<y>90</y>
<width>371</width>
<height>41</height>
</rect>
</property>
<layout class="QHBoxLayout" name="port_layout_2" stretch="0,0,0,0,0">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="prefix_len_lbl">
<property name="maximumSize">
<size>
<width>98</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Prefix Length:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="prefix_len_in">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>24</string>
</property>
<property name="maxLength">
<number>2</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="port_no_lbl">
<property name="minimumSize">
<size>
<width>82</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Port:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="port_in">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>1337</string>
</property>
<property name="maxLength">
<number>5</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget_5">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>371</width>
<height>41</height>
</rect>
</property>
<layout class="QHBoxLayout" name="gateway_layout">
<item>
<widget class="QLabel" name="gateway_lbl">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Gateway:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="gateway_in_0">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>192</string>
</property>
<property name="maxLength">
<number>3</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dot_0_lbl_2">
<property name="maximumSize">
<size>
<width>10</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<bold>false</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="gateway_in_1">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>168</string>
</property>
<property name="maxLength">
<number>3</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dot_1_lbl_2">
<property name="maximumSize">
<size>
<width>10</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<bold>false</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="gateway_in_2">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>1</string>
</property>
<property name="maxLength">
<number>3</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dot_2_lbl_2">
<property name="maximumSize">
<size>
<width>10</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<bold>false</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="gateway_in_3">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>1</string>
</property>
<property name="maxLength">
<number>3</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<tabstops>
<tabstop>addr_in_0</tabstop>
<tabstop>addr_in_1</tabstop>
<tabstop>addr_in_2</tabstop>
<tabstop>addr_in_3</tabstop>
<tabstop>gateway_in_0</tabstop>
<tabstop>gateway_in_1</tabstop>
<tabstop>gateway_in_2</tabstop>
<tabstop>gateway_in_3</tabstop>
<tabstop>prefix_len_in</tabstop>
<tabstop>port_in</tabstop>
<tabstop>update_btn</tabstop>
<tabstop>cancel_btn</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>cancel_btn</sender>
<signal>clicked()</signal>
<receiver>Update_Network_Settings_Form</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>340</x>
<y>140</y>
</hint>
<hint type="destinationlabel">
<x>364</x>
<y>96</y>
</hint>
</hints>
</connection>
<connection>
<sender>update_btn</sender>
<signal>clicked()</signal>
<receiver>Update_Network_Settings_Form</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>258</x>
<y>147</y>
</hint>
<hint type="destinationlabel">
<x>237</x>
<y>99</y>
</hint>
</hints>
</connection>
</connections>
</ui>