Skip to content

Commit

Permalink
Resolved last pylint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis-van-Gils committed Jun 11, 2024
1 parent 042d9cf commit d21a3a2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
24 changes: 14 additions & 10 deletions demo_A_GUI_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,14 @@ def __init__(
# Right box
p = {
"alignment": QtCore.Qt.AlignmentFlag.AlignRight
| QtCore.Qt.AlignmentFlag.AlignVCenter
| QtCore.Qt.AlignmentFlag.AlignVCenter,
"parent": self,
}

self.qpbt_exit = QtWid.QPushButton("Exit")
self.qpbt_exit.clicked.connect(self.close)
self.qpbt_exit.setMinimumHeight(30)

self.qlbl_GitHub = QtWid.QLabel(
f'<a href="{__url__}">GitHub source</a>', **p
)
Expand All @@ -175,7 +178,8 @@ def __init__(
)
self.qlbl_GitHub.setOpenExternalLinks(True)

vbox_right = QtWid.QVBoxLayout(spacing=4)
vbox_right = QtWid.QVBoxLayout()
vbox_right.setSpacing(4)
vbox_right.addWidget(self.qpbt_exit, stretch=0)
vbox_right.addStretch(1)
vbox_right.addWidget(QtWid.QLabel(__author__, **p))
Expand Down Expand Up @@ -286,7 +290,7 @@ def __init__(
self.plot_manager.add_autorange_buttons(linked_plots=self.plot)
self.plot_manager.add_preset_buttons(
linked_plots=self.plot,
linked_curves=self.history_chart_curve,
linked_curves=[self.history_chart_curve],
presets=[
{
"button_label": "0.100",
Expand All @@ -309,7 +313,7 @@ def __init__(
],
)
self.plot_manager.add_clear_button(
linked_curves=self.history_chart_curve
linked_curves=[self.history_chart_curve]
)
self.plot_manager.perform_preset(1)

Expand Down Expand Up @@ -452,7 +456,7 @@ def DAQ_function() -> bool:
ard.state.time, ard.state.reading_1
)

# Add readings to the log
# Create and add readings to the log
log.update()

return True
Expand Down Expand Up @@ -520,13 +524,13 @@ def notify_connection_lost():
"Lost connection to Arduino."
)
print(f"\nCRITICAL ERROR @ {str_msg}")
reply = QtWid.QMessageBox.warning(
window, "CRITICAL ERROR", str_msg, QtWid.QMessageBox.Ok
QtWid.QMessageBox.warning(
window,
"CRITICAL ERROR",
str_msg,
QtWid.QMessageBox.StandardButton.Ok,
)

if reply == QtWid.QMessageBox.Ok:
pass # Leave the GUI open for read-only inspection by the user

# --------------------------------------------------------------------------
# Start the main GUI event loop
# --------------------------------------------------------------------------
Expand Down
14 changes: 9 additions & 5 deletions demo_C_singlethread_for_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,14 @@ def __init__(
# Right box
p = {
"alignment": QtCore.Qt.AlignmentFlag.AlignRight
| QtCore.Qt.AlignmentFlag.AlignVCenter
| QtCore.Qt.AlignmentFlag.AlignVCenter,
"parent": self,
}

self.qpbt_exit = QtWid.QPushButton("Exit")
self.qpbt_exit.clicked.connect(self.close)
self.qpbt_exit.setMinimumHeight(30)

self.qlbl_GitHub = QtWid.QLabel(
f'<a href="{__url__}">GitHub source</a>', **p
)
Expand All @@ -185,7 +188,8 @@ def __init__(
)
self.qlbl_GitHub.setOpenExternalLinks(True)

vbox_right = QtWid.QVBoxLayout(spacing=4)
vbox_right = QtWid.QVBoxLayout()
vbox_right.setSpacing(4)
vbox_right.addWidget(self.qpbt_exit, stretch=0)
vbox_right.addStretch(1)
vbox_right.addWidget(QtWid.QLabel(__author__, **p))
Expand Down Expand Up @@ -279,7 +283,7 @@ def __init__(
self.plot_manager.add_autorange_buttons(linked_plots=self.plot)
self.plot_manager.add_preset_buttons(
linked_plots=self.plot,
linked_curves=self.history_chart_curve,
linked_curves=[self.history_chart_curve],
presets=[
{
"button_label": "0.100",
Expand All @@ -302,7 +306,7 @@ def __init__(
],
)
self.plot_manager.add_clear_button(
linked_curves=self.history_chart_curve
linked_curves=[self.history_chart_curve]
)
self.plot_manager.perform_preset(1)

Expand Down Expand Up @@ -489,7 +493,7 @@ def DAQ_function():
ard.state.time, ard.state.reading_1
)

# Add readings to the log
# Create and add readings to the log
log.update()

# We update the GUI right now because this is a singlethread demo
Expand Down

0 comments on commit d21a3a2

Please sign in to comment.