Skip to content

Commit

Permalink
Use Tab and arrow keys in the find node dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
aloytag committed Jun 23, 2024
1 parent 28ef2a3 commit 6286ebf
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "electricalsim"
version = "0.0.8.7.dev4"
version = "0.0.8.7.dev5"
author = "Dr. Ing. Ariel S. Loyarte"
authors = [
{ name="Dr. Ing. Ariel S. Loyarte", email="aloyarte@frsf.utn.edu.ar" },
Expand Down
Binary file not shown.
1 change: 0 additions & 1 deletion src/electricalsim/lib/electricalGraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,6 @@ def dialog_closed(result, node_from=node_from, node_to=node_to,

dialog.finished.connect(dialog_closed)
dialog.open()
# dialog.btnImpedance.setFocus()

if {node_from.type_, node_to.type_} not in allowed_connections:
# port_from.disconnect_from(port_to)
Expand Down
Binary file modified src/electricalsim/ui/__pycache__/dialogs.cpython-311.pyc
Binary file not shown.
10 changes: 6 additions & 4 deletions src/electricalsim/ui/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,12 +917,13 @@ def list_all_nodes():
button_group.setExclusive(True)

for node_name, node_type in zip(all_names, all_types):
btn_node = QtWidgets.QToolButton(widget)
btn_node = QtWidgets.QPushButton(widget)
btn_node.setIcon(qta.icon(icon_for_type[node_type]))
btn_node.setText(node_name)
btn_node.setIconSize(icon_size)
btn_node.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
btn_node.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
# btn_node.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
btn_node.setStyleSheet("border:0px; text-align:left;")
btn_action = SaveNodeName(node_name)
btn_node.clicked.connect(btn_action)
btn_node.setFocusPolicy(QtCore.Qt.FocusPolicy.TabFocus)
Expand Down Expand Up @@ -957,12 +958,13 @@ def nodes_found(text):
search_text = node_name.join((node_name.lower(), node_name.upper()))
found_list = find_near_matches(text, search_text, max_l_dist=1)
if text in search_text or (found_list and not all([m.matched=='' for m in found_list])):
btn_node = QtWidgets.QToolButton(widget)
btn_node = QtWidgets.QPushButton(widget)
btn_node.setIcon(qta.icon(icon_for_type[node_type]))
btn_node.setText(node_name)
btn_node.setIconSize(icon_size)
btn_node.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
btn_node.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
# btn_node.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
btn_node.setStyleSheet("border:0px; text-align:left;")
btn_action = SaveNodeName(node_name)
btn_node.clicked.connect(btn_action)
btn_node.setFocusPolicy(QtCore.Qt.FocusPolicy.TabFocus)
Expand Down
6 changes: 3 additions & 3 deletions src/electricalsim/ui/search_node_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<item>
<widget class="QLineEdit" name="input_search">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
<enum>Qt::TabFocus</enum>