mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
feat: added help button
This commit is contained in:
@ -555,6 +555,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_help">
|
||||
<property name="text">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_settings">
|
||||
|
@ -10,7 +10,17 @@ from PyQt5.QtCore import QThread, pyqtSlot, QPoint
|
||||
from PyQt5.QtCore import pyqtSignal, Qt
|
||||
from PyQt5.QtGui import QDoubleValidator
|
||||
from PyQt5.QtGui import QKeySequence
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QTableWidget, QFileDialog, QLineEdit
|
||||
from PyQt5.QtWidgets import (
|
||||
QApplication,
|
||||
QWidget,
|
||||
QTableWidget,
|
||||
QFileDialog,
|
||||
QLineEdit,
|
||||
QDialog,
|
||||
QVBoxLayout,
|
||||
QLabel,
|
||||
QPushButton,
|
||||
)
|
||||
from PyQt5.QtWidgets import QShortcut
|
||||
from pyqtgraph.Qt import QtWidgets, uic, QtCore
|
||||
|
||||
@ -415,6 +425,8 @@ class MotorApp(QWidget):
|
||||
lambda: self.load_table_from_csv(self.tableWidget_coordinates, precision=self.precision)
|
||||
)
|
||||
|
||||
self.pushButton_help.clicked.connect(self.show_help_dialog)
|
||||
|
||||
def init_ui(self) -> None:
|
||||
"""Setup all ui elements"""
|
||||
|
||||
@ -837,6 +849,34 @@ class MotorApp(QWidget):
|
||||
value = spinBox1.value()
|
||||
spinBox2.setValue(value)
|
||||
|
||||
def show_help_dialog(self):
|
||||
dialog = QDialog(self)
|
||||
dialog.setWindowTitle("Keyboard Shortcuts")
|
||||
|
||||
layout = QVBoxLayout()
|
||||
|
||||
key_bindings = [
|
||||
("Delete/Backspace", "Delete selected row"),
|
||||
("Ctrl+A", "Increase step size for X motor"),
|
||||
("Ctrl+Z", "Decrease step size for X motor"),
|
||||
("Alt+A", "Increase step size for Y motor"),
|
||||
("Alt+Z", "Decrease step size for Y motor"),
|
||||
("Ctrl+G", "Go absolute"),
|
||||
("Ctrl+D", "Set absolute coordinates"),
|
||||
("Ctrl+S", "Save Current coordinates"),
|
||||
("Ctrl+X", "Stop"),
|
||||
]
|
||||
|
||||
for keys, action in key_bindings:
|
||||
layout.addWidget(QLabel(f"{keys} - {action}"))
|
||||
|
||||
ok_button = QPushButton("OK")
|
||||
ok_button.clicked.connect(dialog.close)
|
||||
layout.addWidget(ok_button)
|
||||
|
||||
dialog.setLayout(layout)
|
||||
dialog.exec_()
|
||||
|
||||
@staticmethod
|
||||
def param_changed(ui_element):
|
||||
ui_element.setStyleSheet("background-color: #FFA700;")
|
||||
|
Reference in New Issue
Block a user