forked from M-Labs/thermostat
Put connection details in connection button menu
This commit is contained in:
parent
a1a94a9c99
commit
ca7c64c115
|
@ -197,8 +197,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
def _set_up_context_menu(self):
|
def _set_up_context_menu(self):
|
||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
|
||||||
self.menu = QtWidgets.QMenu()
|
self.connection_menu = QtWidgets.QMenu()
|
||||||
self.menu.setTitle('Thermostat settings')
|
self.connection_menu.setTitle('Connection Settings')
|
||||||
|
|
||||||
self.ip_set_line = QtWidgets.QLineEdit()
|
self.ip_set_line = QtWidgets.QLineEdit()
|
||||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||||
|
@ -215,10 +215,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
self.ip_set_line.setText(_translate("MainWindow", "192.168.1.26"))
|
self.ip_set_line.setText(_translate("MainWindow", "192.168.1.26"))
|
||||||
self.ip_set_line.setPlaceholderText(_translate("MainWindow", "IP:port for the Thermostat"))
|
self.ip_set_line.setPlaceholderText(_translate("MainWindow", "IP:port for the Thermostat"))
|
||||||
|
|
||||||
host = QtWidgets.QWidgetAction(self.menu)
|
host = QtWidgets.QWidgetAction(self.connection_menu)
|
||||||
host.setDefaultWidget(self.ip_set_line)
|
host.setDefaultWidget(self.ip_set_line)
|
||||||
self.menu.addAction(host)
|
self.connection_menu.addAction(host)
|
||||||
self.menu.host = host
|
self.connection_menu.host = host
|
||||||
|
|
||||||
self.port_set_spin = QtWidgets.QSpinBox()
|
self.port_set_spin = QtWidgets.QSpinBox()
|
||||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||||
|
@ -232,10 +232,15 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
self.port_set_spin.setProperty("value", 23)
|
self.port_set_spin.setProperty("value", 23)
|
||||||
self.port_set_spin.setObjectName("port_set_spin")
|
self.port_set_spin.setObjectName("port_set_spin")
|
||||||
|
|
||||||
port = QtWidgets.QWidgetAction(self.menu)
|
port = QtWidgets.QWidgetAction(self.connection_menu)
|
||||||
port.setDefaultWidget(self.port_set_spin)
|
port.setDefaultWidget(self.port_set_spin)
|
||||||
self.menu.addAction(port)
|
self.connection_menu.addAction(port)
|
||||||
self.menu.port = port
|
self.connection_menu.port = port
|
||||||
|
|
||||||
|
self.connect_btn.setMenu(self.connection_menu)
|
||||||
|
|
||||||
|
self.menu = QtWidgets.QMenu()
|
||||||
|
self.menu.setTitle('Thermostat settings')
|
||||||
|
|
||||||
self.fan_group = QtWidgets.QWidget()
|
self.fan_group = QtWidgets.QWidget()
|
||||||
self.fan_group.setEnabled(False)
|
self.fan_group.setEnabled(False)
|
||||||
|
|
|
@ -179,7 +179,7 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="settings_layout">
|
<layout class="QHBoxLayout" name="settings_layout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="connect_btn">
|
<widget class="QToolButton" name="connect_btn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -207,6 +207,12 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Connect</string>
|
<string>Connect</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="popupMode">
|
||||||
|
<enum>QToolButton::MenuButtonPopup</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonFollowStyle</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -92,7 +92,7 @@ class Ui_MainWindow(object):
|
||||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
self.settings_layout = QtWidgets.QHBoxLayout()
|
self.settings_layout = QtWidgets.QHBoxLayout()
|
||||||
self.settings_layout.setObjectName("settings_layout")
|
self.settings_layout.setObjectName("settings_layout")
|
||||||
self.connect_btn = QtWidgets.QPushButton(parent=self.bottom_settings_group)
|
self.connect_btn = QtWidgets.QToolButton(parent=self.bottom_settings_group)
|
||||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
@ -101,6 +101,8 @@ class Ui_MainWindow(object):
|
||||||
self.connect_btn.setMinimumSize(QtCore.QSize(100, 0))
|
self.connect_btn.setMinimumSize(QtCore.QSize(100, 0))
|
||||||
self.connect_btn.setMaximumSize(QtCore.QSize(100, 16777215))
|
self.connect_btn.setMaximumSize(QtCore.QSize(100, 16777215))
|
||||||
self.connect_btn.setBaseSize(QtCore.QSize(100, 0))
|
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.setObjectName("connect_btn")
|
self.connect_btn.setObjectName("connect_btn")
|
||||||
self.settings_layout.addWidget(self.connect_btn)
|
self.settings_layout.addWidget(self.connect_btn)
|
||||||
self.status_lbl = QtWidgets.QLabel(parent=self.bottom_settings_group)
|
self.status_lbl = QtWidgets.QLabel(parent=self.bottom_settings_group)
|
||||||
|
|
Loading…
Reference in New Issue