diff --git a/pytec/pytec/gui/view/conn_menu.py b/pytec/pytec/gui/view/conn_menu.py index 320d744..4a13af5 100644 --- a/pytec/pytec/gui/view/conn_menu.py +++ b/pytec/pytec/gui/view/conn_menu.py @@ -4,9 +4,10 @@ from pytec.gui.model.thermostat import ThermostatConnectionState class ConnMenu(QtWidgets.QMenu): - def __init__(self, thermostat): + def __init__(self, thermostat, connect_btn): super().__init__() self._thermostat = thermostat + self._connect_btn = connect_btn self._thermostat.connection_state_changed.connect( self.thermostat_state_change_handler ) @@ -20,7 +21,7 @@ class ConnMenu(QtWidgets.QMenu): self.host_set_line.setClearButtonEnabled(True) def connect_on_enter_press(): - self.connect_btn.click() + self._connect_btn.click() self.hide() self.host_set_line.returnPressed.connect(connect_on_enter_press) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index ff38ba9..1de0af2 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -112,7 +112,7 @@ class MainWindow(QtWidgets.QMainWindow): self.plot_options_menu = PlotOptionsMenu(self.channel_graphs) 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.thermostat_ctrl_menu = ThermostatCtrlMenu(