Browse Source

Cleanup, set name on rack when renaming in canvas

tags/1.9.7
falkTX 9 years ago
parent
commit
589b2cb043
2 changed files with 16 additions and 7 deletions
  1. +6
    -1
      source/carla_host.py
  2. +10
    -6
      source/patchcanvas.py

+ 6
- 1
source/carla_host.py View File

@@ -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)



+ 10
- 6
source/patchcanvas.py View File

@@ -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, "")


Loading…
Cancel
Save