forked from M-Labs/kirdy
gui: separate connection_menu into Qdiag obj
This commit is contained in:
parent
31a97bdeb4
commit
de80aedafc
|
@ -22,7 +22,8 @@ from collections import deque
|
|||
from datetime import datetime, timezone, timedelta
|
||||
from time import time
|
||||
from typing import Any, Optional, List
|
||||
from ui_kirdy_qt import Ui_MainWindow
|
||||
from ui.ui_conn_settings_form import Ui_Conn_Settings_Form
|
||||
from ui.ui_kirdy_qt import Ui_MainWindow
|
||||
from dateutil import tz
|
||||
import math
|
||||
|
||||
|
@ -258,9 +259,29 @@ class MutexParameter(pTypes.ListParameter):
|
|||
|
||||
registerParameterType('mutex', MutexParameter)
|
||||
|
||||
class NetSettingsForm(QtWidgets.QDialog, Ui_Conn_Settings_Form):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
|
||||
def get_net_settings(self):
|
||||
try:
|
||||
ip_addr = [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:
|
||||
_ = int(addr)
|
||||
|
||||
return {
|
||||
"ip_addr": ip_addr,
|
||||
"port": int(self.port_in.text())
|
||||
}
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
"""The maximum number of sample points to store."""
|
||||
DEFAULT_MAX_SAMPLES = 1000
|
||||
DEFAULT_IP_ADDR = ['192', '168', '1', '128']
|
||||
DEFAULT_PORT = 1337
|
||||
|
||||
LASER_DIODE_STATUS = [
|
||||
{'name': 'Power', 'type': 'color', 'value': 'w', 'readonly': True},
|
||||
|
@ -350,9 +371,15 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
self.kirdy = Kirdy()
|
||||
self.setupUi(self)
|
||||
|
||||
self.ip_addr = self.DEFAULT_IP_ADDR
|
||||
self.port = self.DEFAULT_PORT
|
||||
|
||||
self.net_settings_form = NetSettingsForm()
|
||||
self.net_settings_form.accepted.connect(self.start_connecting)
|
||||
|
||||
self.max_samples = self.DEFAULT_MAX_SAMPLES
|
||||
|
||||
self._set_up_connection_menu()
|
||||
|
||||
self._set_up_kirdy_menu()
|
||||
self._set_up_ctrl_btns()
|
||||
self._set_up_plot_menu()
|
||||
|
@ -370,6 +397,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
self.ld_i_set_graph.setTitle("LD Current Set")
|
||||
self.pd_mon_pwr_graph.setTitle("PD Mon Power")
|
||||
|
||||
self.connect_btn.clicked.connect(self.show_net_settings_form)
|
||||
self.report_box.stateChanged.connect(self.on_report_box_stateChanged)
|
||||
|
||||
self.kirdy_data_watcher = KirdyDataWatcher(self, self.kirdy, self.report_refresh_spin.value())
|
||||
|
@ -396,6 +424,14 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
|
||||
self.loading_spinner.hide()
|
||||
|
||||
def show_net_settings_form(self):
|
||||
self.net_settings_form.addr_in_0.setText(self.ip_addr[0])
|
||||
self.net_settings_form.addr_in_1.setText(self.ip_addr[1])
|
||||
self.net_settings_form.addr_in_2.setText(self.ip_addr[2])
|
||||
self.net_settings_form.addr_in_3.setText(self.ip_addr[3])
|
||||
self.net_settings_form.port_in.setText(str(self.port))
|
||||
self.net_settings_form.show()
|
||||
|
||||
def _set_up_ctrl_btns(self):
|
||||
@asyncSlot(bool)
|
||||
async def ld_pwr_on(_):
|
||||
|
@ -427,6 +463,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
await self.kirdy.thermostat.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')
|
||||
|
@ -565,57 +602,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
tree.setParameters(self.params[3], showTop=False)
|
||||
self.params[3].sigTreeStateChanged.connect(self.send_command)
|
||||
|
||||
def _set_up_connection_menu(self):
|
||||
self.connection_menu = QtWidgets.QMenu()
|
||||
self.connection_menu.setTitle('Connection Settings')
|
||||
|
||||
self.host_set_line = QtWidgets.QLineEdit()
|
||||
self.host_set_line.setMinimumSize(QtCore.QSize(160, 0))
|
||||
self.host_set_line.setMaximumSize(QtCore.QSize(160, 16777215))
|
||||
self.host_set_line.setMaxLength(15)
|
||||
self.host_set_line.setClearButtonEnabled(True)
|
||||
|
||||
def connect_on_enter_press():
|
||||
self.connect_btn.click()
|
||||
self.connection_menu.hide()
|
||||
self.host_set_line.returnPressed.connect(connect_on_enter_press)
|
||||
|
||||
self.host_set_line.setText("192.168.1.128")
|
||||
self.host_set_line.setPlaceholderText("IP for the Kirdy")
|
||||
|
||||
host = QtWidgets.QWidgetAction(self.connection_menu)
|
||||
host.setDefaultWidget(self.host_set_line)
|
||||
self.connection_menu.addAction(host)
|
||||
self.connection_menu.host = host
|
||||
|
||||
self.port_set_spin = QtWidgets.QSpinBox()
|
||||
self.port_set_spin.setMinimumSize(QtCore.QSize(70, 0))
|
||||
self.port_set_spin.setMaximumSize(QtCore.QSize(70, 16777215))
|
||||
self.port_set_spin.setMaximum(65535)
|
||||
self.port_set_spin.setValue(1337)
|
||||
|
||||
def connect_only_if_enter_pressed():
|
||||
if not self.port_set_spin.hasFocus(): # Don't connect if the spinbox only lost focus
|
||||
return;
|
||||
connect_on_enter_press()
|
||||
self.port_set_spin.editingFinished.connect(connect_only_if_enter_pressed)
|
||||
|
||||
port = QtWidgets.QWidgetAction(self.connection_menu)
|
||||
port.setDefaultWidget(self.port_set_spin)
|
||||
self.connection_menu.addAction(port)
|
||||
self.connection_menu.port = port
|
||||
|
||||
self.exit_button = QtWidgets.QPushButton()
|
||||
self.exit_button.setText("Exit GUI")
|
||||
self.exit_button.pressed.connect(QtWidgets.QApplication.instance().quit)
|
||||
|
||||
exit_action = QtWidgets.QWidgetAction(self.exit_button)
|
||||
exit_action.setDefaultWidget(self.exit_button)
|
||||
self.connection_menu.addAction(exit_action)
|
||||
self.connection_menu.exit_action = exit_action
|
||||
|
||||
self.connect_btn.setMenu(self.connection_menu)
|
||||
|
||||
async def _on_connection_changed(self, result):
|
||||
def ctrl_panel_setEnable(result):
|
||||
self.ld_status.setEnabled(result)
|
||||
|
@ -647,9 +633,15 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
self.save_flash_btn.setEnabled(result)
|
||||
self.load_flash_btn.setEnabled(result)
|
||||
|
||||
self.host_set_line.setEnabled(not result)
|
||||
self.port_set_spin.setEnabled(not result)
|
||||
self.connect_btn.setText("Disconnect" if result else "Connect")
|
||||
# TODO: Use QStateMachine to manage connections
|
||||
self.connect_btn.clicked.disconnect()
|
||||
if result:
|
||||
self.connect_btn.setText("Disconnect")
|
||||
self.connect_btn.clicked.connect(self.bail)
|
||||
else:
|
||||
self.connect_btn.setText("Connect")
|
||||
self.connect_btn.clicked.connect(self.show_net_settings_form)
|
||||
|
||||
if result:
|
||||
# TODO: self.hw_rev_data = await self.kirdy.hw_rev()
|
||||
self._status()
|
||||
|
@ -665,11 +657,22 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
|
||||
def _status(self):
|
||||
# TODO: Get rev no from Kirdy and then add revision into the text
|
||||
self.status_lbl.setText(f"Connected to Kirdy ")
|
||||
host = f"{self.ip_addr[0]}.{self.ip_addr[1]}.{self.ip_addr[2]}.{self.ip_addr[3]}"
|
||||
port = self.port
|
||||
self.status_lbl.setText(f"Connected to Kirdy @ {host}:{port}")
|
||||
|
||||
def clear_graphs(self):
|
||||
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()
|
||||
|
@ -769,26 +772,23 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
await self.kirdy_data_watcher.set_report_mode(enabled)
|
||||
|
||||
@asyncSlot()
|
||||
async def on_connect_btn_clicked(self):
|
||||
host, port = self.host_set_line.text(), self.port_set_spin.value()
|
||||
async def start_connecting(self):
|
||||
if not self.update_network_settings():
|
||||
self.status_lbl.setText("Invalid IP Settings Input")
|
||||
return
|
||||
host = f"{self.ip_addr[0]}.{self.ip_addr[1]}.{self.ip_addr[2]}.{self.ip_addr[3]}"
|
||||
port = self.port
|
||||
try:
|
||||
if not (self.kirdy.connecting() or self.kirdy.connected()):
|
||||
self.status_lbl.setText("Connecting...")
|
||||
self.connect_btn.setText("Stop")
|
||||
self.host_set_line.setEnabled(False)
|
||||
self.port_set_spin.setEnabled(False)
|
||||
|
||||
try:
|
||||
await self.kirdy.start_session(host=host, port=port, timeout=0.1)
|
||||
except StoppedConnecting:
|
||||
return
|
||||
await self.kirdy.start_session(host=host, port=port, timeout=0.1)
|
||||
await self._on_connection_changed(True)
|
||||
else:
|
||||
await self.bail()
|
||||
|
||||
except (OSError, TimeoutError) as e:
|
||||
logging.error(f"Failed communicating to {host}:{port}: {e}")
|
||||
await self.bail()
|
||||
self.status_lbl.setText(f"Cannot connect to Kirdy@ {host}:{port}")
|
||||
|
||||
@asyncSlot()
|
||||
async def bail(self):
|
||||
|
|
|
@ -0,0 +1,376 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Conn_Settings_Form</class>
|
||||
<widget class="QDialog" name="Conn_Settings_Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>415</width>
|
||||
<height>145</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>415</width>
|
||||
<height>145</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>415</width>
|
||||
<height>145</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Connection 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_label">
|
||||
<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_label">
|
||||
<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_label">
|
||||
<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_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>371</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="port_layout" stretch="3,0,6">
|
||||
<item>
|
||||
<widget class="QLabel" name="port_no_label">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>97</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="port_layout_spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>90</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="connect_btn">
|
||||
<property name="text">
|
||||
<string>Connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancel_btn">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</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>port_in</tabstop>
|
||||
<tabstop>connect_btn</tabstop>
|
||||
<tabstop>cancel_btn</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>cancel_btn</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>Conn_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>connect_btn</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>Conn_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>
|
|
@ -335,40 +335,10 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="settings_layout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="connect_btn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QPushButton" name="connect_btn">
|
||||
<property name="text">
|
||||
<string>Connect</string>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::MenuButtonPopup</enum>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonFollowStyle</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -381,13 +351,13 @@
|
|||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>240</width>
|
||||
<width>360</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<width>360</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
|
@ -0,0 +1,161 @@
|
|||
# Form implementation generated from reading ui file 'conn_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_Conn_Settings_Form(object):
|
||||
def setupUi(self, Conn_Settings_Form):
|
||||
Conn_Settings_Form.setObjectName("Conn_Settings_Form")
|
||||
Conn_Settings_Form.resize(415, 145)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(Conn_Settings_Form.sizePolicy().hasHeightForWidth())
|
||||
Conn_Settings_Form.setSizePolicy(sizePolicy)
|
||||
Conn_Settings_Form.setMinimumSize(QtCore.QSize(415, 145))
|
||||
Conn_Settings_Form.setMaximumSize(QtCore.QSize(415, 145))
|
||||
self.horizontalLayoutWidget = QtWidgets.QWidget(parent=Conn_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_label = QtWidgets.QLabel(parent=self.horizontalLayoutWidget)
|
||||
self.dot_0_label.setMaximumSize(QtCore.QSize(10, 16777215))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(12)
|
||||
font.setBold(False)
|
||||
font.setKerning(True)
|
||||
self.dot_0_label.setFont(font)
|
||||
self.dot_0_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
|
||||
self.dot_0_label.setObjectName("dot_0_label")
|
||||
self.ip_addr_layout.addWidget(self.dot_0_label)
|
||||
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_label = QtWidgets.QLabel(parent=self.horizontalLayoutWidget)
|
||||
self.dot_1_label.setMaximumSize(QtCore.QSize(10, 16777215))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(12)
|
||||
font.setBold(False)
|
||||
font.setKerning(True)
|
||||
self.dot_1_label.setFont(font)
|
||||
self.dot_1_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
|
||||
self.dot_1_label.setObjectName("dot_1_label")
|
||||
self.ip_addr_layout.addWidget(self.dot_1_label)
|
||||
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_label = QtWidgets.QLabel(parent=self.horizontalLayoutWidget)
|
||||
self.dot_2_label.setMaximumSize(QtCore.QSize(10, 16777215))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(12)
|
||||
font.setBold(False)
|
||||
font.setKerning(True)
|
||||
self.dot_2_label.setFont(font)
|
||||
self.dot_2_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
|
||||
self.dot_2_label.setObjectName("dot_2_label")
|
||||
self.ip_addr_layout.addWidget(self.dot_2_label)
|
||||
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_2 = QtWidgets.QWidget(parent=Conn_Settings_Form)
|
||||
self.horizontalLayoutWidget_2.setGeometry(QtCore.QRect(20, 50, 371, 41))
|
||||
self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2")
|
||||
self.port_layout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_2)
|
||||
self.port_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.port_layout.setObjectName("port_layout")
|
||||
self.port_no_label = QtWidgets.QLabel(parent=self.horizontalLayoutWidget_2)
|
||||
self.port_no_label.setMaximumSize(QtCore.QSize(97, 16777215))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(12)
|
||||
self.port_no_label.setFont(font)
|
||||
self.port_no_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
self.port_no_label.setObjectName("port_no_label")
|
||||
self.port_layout.addWidget(self.port_no_label)
|
||||
self.port_in = QtWidgets.QLineEdit(parent=self.horizontalLayoutWidget_2)
|
||||
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.addWidget(self.port_in)
|
||||
spacerItem = QtWidgets.QSpacerItem(50, 20, QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Minimum)
|
||||
self.port_layout.addItem(spacerItem)
|
||||
self.port_layout.setStretch(0, 3)
|
||||
self.port_layout.setStretch(2, 6)
|
||||
self.horizontalLayoutWidget_4 = QtWidgets.QWidget(parent=Conn_Settings_Form)
|
||||
self.horizontalLayoutWidget_4.setGeometry(QtCore.QRect(20, 90, 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")
|
||||
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
||||
self.buttons_layout.addItem(spacerItem1)
|
||||
self.connect_btn = QtWidgets.QPushButton(parent=self.horizontalLayoutWidget_4)
|
||||
self.connect_btn.setObjectName("connect_btn")
|
||||
self.buttons_layout.addWidget(self.connect_btn)
|
||||
self.cancel_btn = QtWidgets.QPushButton(parent=self.horizontalLayoutWidget_4)
|
||||
self.cancel_btn.setObjectName("cancel_btn")
|
||||
self.buttons_layout.addWidget(self.cancel_btn)
|
||||
|
||||
self.retranslateUi(Conn_Settings_Form)
|
||||
self.cancel_btn.clicked.connect(Conn_Settings_Form.reject) # type: ignore
|
||||
self.connect_btn.clicked.connect(Conn_Settings_Form.accept) # type: ignore
|
||||
QtCore.QMetaObject.connectSlotsByName(Conn_Settings_Form)
|
||||
Conn_Settings_Form.setTabOrder(self.addr_in_0, self.addr_in_1)
|
||||
Conn_Settings_Form.setTabOrder(self.addr_in_1, self.addr_in_2)
|
||||
Conn_Settings_Form.setTabOrder(self.addr_in_2, self.addr_in_3)
|
||||
Conn_Settings_Form.setTabOrder(self.addr_in_3, self.port_in)
|
||||
Conn_Settings_Form.setTabOrder(self.port_in, self.connect_btn)
|
||||
Conn_Settings_Form.setTabOrder(self.connect_btn, self.cancel_btn)
|
||||
|
||||
def retranslateUi(self, Conn_Settings_Form):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Conn_Settings_Form.setWindowTitle(_translate("Conn_Settings_Form", "Connection Settings"))
|
||||
self.ip_addr_label.setText(_translate("Conn_Settings_Form", "IP Address:"))
|
||||
self.addr_in_0.setText(_translate("Conn_Settings_Form", "192"))
|
||||
self.dot_0_label.setText(_translate("Conn_Settings_Form", "."))
|
||||
self.addr_in_1.setText(_translate("Conn_Settings_Form", "168"))
|
||||
self.dot_1_label.setText(_translate("Conn_Settings_Form", "."))
|
||||
self.addr_in_2.setText(_translate("Conn_Settings_Form", "1"))
|
||||
self.dot_2_label.setText(_translate("Conn_Settings_Form", "."))
|
||||
self.addr_in_3.setText(_translate("Conn_Settings_Form", "128"))
|
||||
self.port_no_label.setText(_translate("Conn_Settings_Form", "Port:"))
|
||||
self.port_in.setText(_translate("Conn_Settings_Form", "1337"))
|
||||
self.connect_btn.setText(_translate("Conn_Settings_Form", "Connect"))
|
||||
self.cancel_btn.setText(_translate("Conn_Settings_Form", "Cancel"))
|
|
@ -167,17 +167,7 @@ class Ui_MainWindow(object):
|
|||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.settings_layout = QtWidgets.QHBoxLayout()
|
||||
self.settings_layout.setObjectName("settings_layout")
|
||||
self.connect_btn = QtWidgets.QToolButton(parent=self.bottom_settings_group)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.connect_btn.sizePolicy().hasHeightForWidth())
|
||||
self.connect_btn.setSizePolicy(sizePolicy)
|
||||
self.connect_btn.setMinimumSize(QtCore.QSize(100, 0))
|
||||
self.connect_btn.setMaximumSize(QtCore.QSize(100, 16777215))
|
||||
self.connect_btn.setBaseSize(QtCore.QSize(100, 0))
|
||||
self.connect_btn.setPopupMode(QtWidgets.QToolButton.ToolButtonPopupMode.MenuButtonPopup)
|
||||
self.connect_btn.setToolButtonStyle(QtCore.Qt.ToolButtonStyle.ToolButtonFollowStyle)
|
||||
self.connect_btn = QtWidgets.QPushButton(parent=self.bottom_settings_group)
|
||||
self.connect_btn.setObjectName("connect_btn")
|
||||
self.settings_layout.addWidget(self.connect_btn)
|
||||
self.status_lbl = QtWidgets.QLabel(parent=self.bottom_settings_group)
|
||||
|
@ -186,8 +176,8 @@ class Ui_MainWindow(object):
|
|||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.status_lbl.sizePolicy().hasHeightForWidth())
|
||||
self.status_lbl.setSizePolicy(sizePolicy)
|
||||
self.status_lbl.setMinimumSize(QtCore.QSize(240, 0))
|
||||
self.status_lbl.setMaximumSize(QtCore.QSize(120, 16777215))
|
||||
self.status_lbl.setMinimumSize(QtCore.QSize(360, 0))
|
||||
self.status_lbl.setMaximumSize(QtCore.QSize(360, 16777215))
|
||||
self.status_lbl.setBaseSize(QtCore.QSize(120, 50))
|
||||
self.status_lbl.setObjectName("status_lbl")
|
||||
self.settings_layout.addWidget(self.status_lbl)
|
||||
|
@ -356,13 +346,3 @@ class Ui_MainWindow(object):
|
|||
from pglive.sources.live_plot_widget import LivePlotWidget
|
||||
from pyqtgraph.parametertree import ParameterTree
|
||||
from waitingspinnerwidget import QtWaitingSpinner
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
MainWindow = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
ui.setupUi(MainWindow)
|
||||
MainWindow.show()
|
||||
sys.exit(app.exec())
|
Loading…
Reference in New Issue