Skip to content

Commit

Permalink
Added save name label option
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Yu committed Nov 5, 2020
1 parent f303690 commit 44c96dc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
#

Expand Down
17 changes: 17 additions & 0 deletions python/tk_multi_workfiles/file_save_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
'<html><head/><body><p><span style=" font-weight:600;">'
"{}:</span></p></body></html>"
)
# 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)

Expand Down

0 comments on commit 44c96dc

Please sign in to comment.