diff --git a/source/carla_host.py b/source/carla_host.py index 52375c632..16593dcd5 100644 --- a/source/carla_host.py +++ b/source/carla_host.py @@ -1942,7 +1942,12 @@ def canvasCallback(action, value1, value2, valueStr): pluginId = value1 newName = valueStr - if not host.rename_plugin(pluginId, newName): + if host.rename_plugin(pluginId, newName): + # FIXME + pwidget = gCarla.gui.getPluginSlotWidget(pluginId) + if pwidget is not None: + pwidget.setName(newName) + else: CustomMessageBox(gCarla.gui, QMessageBox.Warning, gCarla.gui.tr("Error"), gCarla.gui.tr("Operation failed"), host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) diff --git a/source/patchcanvas.py b/source/patchcanvas.py index b0ae6cc0c..f0e2761fd 100644 --- a/source/patchcanvas.py +++ b/source/patchcanvas.py @@ -2586,9 +2586,11 @@ class CanvasBox(QGraphicsItem): canvas.callback(ACTION_GROUP_INFO, self.m_group_id, 0, "") elif act_selected == act_x_rename: - new_name_try = QInputDialog.getText(None, "Rename Group", "New name:", QLineEdit.Normal, self.m_group_name) - if new_name_try[1] and new_name_try[0]: # 1 - bool ok, 0 - return text - canvas.callback(ACTION_GROUP_RENAME, self.m_group_id, 0, new_name_try[0]) + oldName = self.m_group_name + newNameTry = QInputDialog.getText(self.parentWidget(), "Rename Group", "New name:", QLineEdit.Normal, oldName) + + if newNameTry[1] and newNameTry[0] and oldName != newNameTry[0]: + canvas.callback(ACTION_GROUP_RENAME, self.m_group_id, 0, newNameTry[0]) elif act_selected == act_x_split_join: if self.m_splitted: @@ -2606,9 +2608,11 @@ class CanvasBox(QGraphicsItem): canvas.callback(ACTION_PLUGIN_CLONE, self.m_plugin_id, 0, "") elif act_selected == act_p_rename: - new_name_try = QInputDialog.getText(None, "Rename Plugin", "New name:", QLineEdit.Normal, self.m_group_name) - if new_name_try[1] and new_name_try[0]: # 1 - bool ok, 0 - return text - canvas.callback(ACTION_PLUGIN_RENAME, self.m_plugin_id, 0, new_name_try[0]) + oldName = self.m_group_name + newNameTry = QInputDialog.getText(self.parentWidget(), "Rename Plugin", "New name:", QLineEdit.Normal, oldName) + + if newNameTry[1] and newNameTry[0] and oldName != newNameTry[0]: + canvas.callback(ACTION_PLUGIN_RENAME, self.m_plugin_id, 0, newNameTry[0]) elif act_selected == act_p_remove: canvas.callback(ACTION_PLUGIN_REMOVE, self.m_plugin_id, 0, "")