Skip to content

Commit 35d98dc

Browse files
authored
Remove broken use_timeout checkbox in serial options (#1793)
1 parent bf2eaa5 commit 35d98dc

File tree

5 files changed

+12
-53
lines changed

5 files changed

+12
-53
lines changed

doc/api/config.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ The number of stop bits for serial connections. 1 by default.
213213
```
214214
215215
```{describe} timeout
216-
The read timeout for serial connections in seconds, may be ``None`` to
217-
disable read timeouts altogether. 2.0 (2 seconds) by default.
216+
The read timeout for serial connections in seconds. 2.0 (2 seconds) by default.
218217
```
219218
220219
```{describe} xonxoff

news.d/bugfix/1793.ui.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove broken use_timeout checkbox in serial options.

plover/gui_qt/config_serial_widget.ui

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@
237237
</sizepolicy>
238238
</property>
239239
<property name="text">
240-
<string>Duration</string>
240+
<string>Duration (s)</string>
241241
</property>
242242
<property name="buddy">
243243
<cstring>timeout</cstring>
@@ -266,19 +266,6 @@
266266
</property>
267267
</widget>
268268
</item>
269-
<item row="1" column="0" colspan="2">
270-
<widget class="QCheckBox" name="use_timeout">
271-
<property name="sizePolicy">
272-
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
273-
<horstretch>0</horstretch>
274-
<verstretch>0</verstretch>
275-
</sizepolicy>
276-
</property>
277-
<property name="text">
278-
<string>Use timeout</string>
279-
</property>
280-
</widget>
281-
</item>
282269
</layout>
283270
</widget>
284271
</item>
@@ -419,22 +406,6 @@
419406
</hint>
420407
</hints>
421408
</connection>
422-
<connection>
423-
<sender>use_timeout</sender>
424-
<signal>clicked(bool)</signal>
425-
<receiver>SerialWidget</receiver>
426-
<slot>update_use_timeout(bool)</slot>
427-
<hints>
428-
<hint type="sourcelabel">
429-
<x>76</x>
430-
<y>271</y>
431-
</hint>
432-
<hint type="destinationlabel">
433-
<x>140</x>
434-
<y>180</y>
435-
</hint>
436-
</hints>
437-
</connection>
438409
<connection>
439410
<sender>xonxoff</sender>
440411
<signal>clicked(bool)</signal>
@@ -491,7 +462,6 @@
491462
<slot>update_bytesize(QString)</slot>
492463
<slot>update_stopbits(QString)</slot>
493464
<slot>update_parity(QString)</slot>
494-
<slot>update_use_timeout(bool)</slot>
495465
<slot>update_rtscts(bool)</slot>
496466
<slot>update_timeout(double)</slot>
497467
<slot>update_xonxoff(bool)</slot>

plover/gui_qt/machine_options.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def _format_port(self, index):
8989
if not details:
9090
return
9191
cursor.insertFrame(self._details_frame_format)
92-
details_list = cursor.createList(self._details_list_format)
9392
for n, part in enumerate(details):
9493
if n:
9594
cursor.insertBlock()
@@ -140,15 +139,7 @@ def setValue(self, value):
140139
self.parity.setCurrentText(value["parity"])
141140
self.stopbits.addItems(map(str, Serial.STOPBITS))
142141
self.stopbits.setCurrentText(str(value["stopbits"]))
143-
timeout = value["timeout"]
144-
if timeout is None:
145-
self.use_timeout.setChecked(False)
146-
self.timeout.setValue(0.0)
147-
self.timeout.setEnabled(False)
148-
else:
149-
self.use_timeout.setChecked(True)
150-
self.timeout.setValue(timeout)
151-
self.timeout.setEnabled(True)
142+
self.timeout.setValue(value["timeout"])
152143
for setting in ("xonxoff", "rtscts"):
153144
widget = getattr(self, setting)
154145
if setting in value:
@@ -188,15 +179,6 @@ def update_stopbits(self, value):
188179
def update_timeout(self, value):
189180
self._update("timeout", value)
190181

191-
@Slot(bool)
192-
def update_use_timeout(self, value):
193-
if value:
194-
timeout = self.timeout.value()
195-
else:
196-
timeout = None
197-
self.timeout.setEnabled(value)
198-
self._update("timeout", timeout)
199-
200182
@Slot(bool)
201183
def update_xonxoff(self, value):
202184
self._update("xonxoff", value)

plover/machine/base.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,15 @@ def _iter_packets(self, packet_size):
282282
- an incomplete packet will only be discarded if one of
283283
those reads return no data (but not on short read)
284284
"""
285+
if not self.serial_port:
286+
log.warning("Serial port not initialized")
287+
return
288+
289+
configured_timeout = self.serial_params.get(
290+
"timeout", self.SERIAL_PARAMS["timeout"]
291+
)
285292
self.serial_port.timeout = max(
286-
self.serial_params.get("timeout", 1.0) / packet_size,
293+
configured_timeout / packet_size,
287294
0.01,
288295
)
289296
packet = b""

0 commit comments

Comments
 (0)