From c4781615cd8fde4ecac56b222f93ce22049318cb Mon Sep 17 00:00:00 2001
From: Joseph Yu
Date: Thu, 11 Mar 2021 15:42:51 +0000
Subject: [PATCH] Added save name label option
---
info.yml | 7 +++++++
python/tk_multi_workfiles/file_save_form.py | 17 +++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/info.yml b/info.yml
index fdaf4655..d97e2856 100644
--- a/info.yml
+++ b/info.yml
@@ -13,6 +13,13 @@
# expected fields in the configuration file for this app
configuration:
+ # WWFX: Save Name label
+ #
+ save_name_label:
+ type: str
+ description: Custom save dialog "Name" label text.
+ default_value: Name
+
# Startup options
#
diff --git a/python/tk_multi_workfiles/file_save_form.py b/python/tk_multi_workfiles/file_save_form.py
index 74276b94..c127b093 100644
--- a/python/tk_multi_workfiles/file_save_form.py
+++ b/python/tk_multi_workfiles/file_save_form.py
@@ -604,6 +604,23 @@ def _on_work_area_changed(self, env):
name = self._current_env.save_as_default_name or "scene"
self._ui.name_edit.setText(name)
+ # Setup custom name label if any.
+ # See also ./ui/file_save_form.py:retranslateUi()
+ app = sgtk.platform.current_bundle()
+ label_template = (
+ '
'
+ "{}:
"
+ )
+ # Catch even if save_name_label is an empty string.
+ label_text = app.get_setting("save_name_label") or "Name"
+ text = QtGui.QApplication.translate(
+ "FileSaveForm",
+ label_template.format(label_text),
+ None,
+ QtGui.QApplication.UnicodeUTF8,
+ )
+ self._ui.name_label.setText(text)
+
self._ui.name_label.setVisible(name_is_used)
self._ui.name_edit.setVisible(name_is_used)