forked from M-Labs/thermostat
Fix pressing enter not working in conn menu
This commit is contained in:
parent
b5b8a374c0
commit
d71c1f4e7e
@ -4,9 +4,10 @@ from pytec.gui.model.thermostat import ThermostatConnectionState
|
|||||||
|
|
||||||
|
|
||||||
class ConnMenu(QtWidgets.QMenu):
|
class ConnMenu(QtWidgets.QMenu):
|
||||||
def __init__(self, thermostat):
|
def __init__(self, thermostat, connect_btn):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._thermostat = thermostat
|
self._thermostat = thermostat
|
||||||
|
self._connect_btn = connect_btn
|
||||||
self._thermostat.connection_state_changed.connect(
|
self._thermostat.connection_state_changed.connect(
|
||||||
self.thermostat_state_change_handler
|
self.thermostat_state_change_handler
|
||||||
)
|
)
|
||||||
@ -20,7 +21,7 @@ class ConnMenu(QtWidgets.QMenu):
|
|||||||
self.host_set_line.setClearButtonEnabled(True)
|
self.host_set_line.setClearButtonEnabled(True)
|
||||||
|
|
||||||
def connect_on_enter_press():
|
def connect_on_enter_press():
|
||||||
self.connect_btn.click()
|
self._connect_btn.click()
|
||||||
self.hide()
|
self.hide()
|
||||||
|
|
||||||
self.host_set_line.returnPressed.connect(connect_on_enter_press)
|
self.host_set_line.returnPressed.connect(connect_on_enter_press)
|
||||||
|
@ -111,7 +111,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self.plot_options_menu = PlotOptionsMenu(self.channel_graphs)
|
self.plot_options_menu = PlotOptionsMenu(self.channel_graphs)
|
||||||
self.plot_settings.setMenu(self.plot_options_menu)
|
self.plot_settings.setMenu(self.plot_options_menu)
|
||||||
|
|
||||||
self.conn_menu = ConnMenu(self.thermostat)
|
self.conn_menu = ConnMenu(self.thermostat, self.connect_btn)
|
||||||
self.connect_btn.setMenu(self.conn_menu)
|
self.connect_btn.setMenu(self.conn_menu)
|
||||||
|
|
||||||
self.thermostat_ctrl_menu = ThermostatCtrlMenu(
|
self.thermostat_ctrl_menu = ThermostatCtrlMenu(
|
||||||
|
Loading…
Reference in New Issue
Block a user