Skip to content

Commit

Permalink
Misc minor bugs, optimizations, and typos
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Lamprianidis <[email protected]>
  • Loading branch information
nlamprian committed Aug 27, 2023
1 parent b0db3fd commit b51243e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
16 changes: 7 additions & 9 deletions src/rqt_reconfigure/node_selector_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self, parent, context, signal_msg=None):
"""
Init node selector widget.
@param signal_msg: Signal to carries a system msg that is shown on GUI.
@param signal_msg: Signal to carry a system msg that is shown on GUI.
@type signal_msg: QtCore.Signal
"""
super(NodeSelectorWidget, self).__init__()
Expand All @@ -83,8 +83,8 @@ def __init__(self, parent, context, signal_msg=None):
loadUi(ui_file, self)

# List of the available nodes. Since the list should be updated over
# time and we don't want to create node instance per every update
# cycle, This list instance should better be capable of keeping track.
# time, and we don't want to create node instance per every update
# cycle, this list instance should better be capable of keeping track.
self._nodeitems = OrderedDict()
# Dictionary. 1st elem is node's GRN name,
# 2nd is TreenodeQstdItem instance.
Expand Down Expand Up @@ -158,7 +158,7 @@ def node_selected(self, grn, scroll_to=False):
:type grn: str
"""
# Iterate over all of the indexes
# Iterate over all the indexes
for index in self._enumerate_indexes():
grn_from_index = RqtRosGraph.get_upper_grn(index, '')
logging.debug(' Compare given grn={} from selected={}'.format(
Expand Down Expand Up @@ -225,7 +225,6 @@ def _selection_selected(self, index_current, rosnode_name_selected):
# Only when it's a terminal we move forward.

item_child = self._nodeitems[rosnode_name_selected]
item_widget = None
try:
item_widget = item_child.get_param_client_widget()
except Exception as e:
Expand Down Expand Up @@ -261,7 +260,7 @@ def _selection_changed_slot(self, selected, deselected):
# Setting length criteria as 1 is only a workaround, to avoid
# Node boxes on right-hand side disappears when filter key doesn't
# match them.
# Indeed this workaround leaves another issue. Question for
# Indeed, this workaround leaves another issue. Question for
# permanent solution is asked here http://goo.gl/V4DT1
index_current = deselected.indexes()[0]

Expand Down Expand Up @@ -314,7 +313,7 @@ def _update_nodetree_pernode(self):
try:
nodes = find_nodes_with_params(self._context.node)
except Exception as e:
self._logger.error(e)
logging.error(e)
# TODO: print to sysmsg pane
raise e # TODO Make sure 'raise' here returns or finalizes func.

Expand Down Expand Up @@ -368,7 +367,7 @@ def _update_nodetree_pernode(self):
def _add_children_treenode(self, treenodeitem_toplevel,
treenodeitem_parent, child_names_left):
"""
Add childen treenode.
Add children treenode.
Evaluate current treenode and the previous treenode at the same depth.
If the name of both nodes is the same, current node instance is
Expand Down Expand Up @@ -399,7 +398,6 @@ def _add_children_treenode(self, treenodeitem_toplevel,
stditem_prev = treenodeitem_parent.child(row_index_parent)
name_prev = stditem_prev.text()

stditem = None
# If the name of both nodes is the same, current node instance is
# ignored (that means children will be added to the same parent)
if name_prev != name_currentnode:
Expand Down
5 changes: 2 additions & 3 deletions src/rqt_reconfigure/param_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def create_param_client(node, remote_node_name, param_change_callback=None):


def _has_parameters(node, node_name, node_namespace):
# Get all of the service provided by a node (node_name)
# Get all the service provided by a node (node_name)
for service_name, service_types in node.get_service_names_and_types_by_node(
node_name, node_namespace):

Expand All @@ -149,7 +149,6 @@ def find_nodes_with_params(node):
node_list = []
for node_name, node_namespace in names_and_namespaces:
if _has_parameters(node, node_name, node_namespace):
full_name = node_namespace + (
'/' if not node_namespace.endswith('/') else '') + node_name
full_name = node_namespace.rstrip('/') + '/' + node_name
node_list.append(full_name)
return node_list
3 changes: 2 additions & 1 deletion src/rqt_reconfigure/param_client_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def __init__(self, context, node_name):
self._param_client.describe_parameters(param_names)
)
except Exception as e:
logging.warn('Failed to retrieve parameters from node: ' + str(e))
logging.warn(
f'Failed to retrieve parameters from node {self._node_grn}: {e}')

# Save and load buttons
button_widget = QWidget(self)
Expand Down

0 comments on commit b51243e

Please sign in to comment.