Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Advanced Title Editor Warning #5427

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/windows/title_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,21 +683,27 @@ def accept(self):

def btnAdvanced_clicked(self):
"""Use an external editor to edit the image"""
# Get editor executable from settings
# Get editor executable from settings (or placeholder text)
_ = self.app._tr
s = get_app().get_settings()
prog = s.get("title_editor")
# Store filename field to display on reload
prog = s.get("title_editor").strip()
setting_name = _("Advanced Title Editor (path)")
prog_warning = ""
if prog.strip():
prog_warning = f": [{prog}]"

# Get filename field to display on reload
filename_text = self.txtFileName.text().strip()
try:
# launch advanced title editor
log.info("Advanced title editor command: %s", str([prog, self.filename]))
p = subprocess.Popen([prog, self.filename], env=self.env)

# wait for process to finish, then update preview
p.communicate()
self.load_svg_template(filename_field=filename_text)
self.display_svg()

except OSError:
_ = self.app._tr
msg = QMessageBox(self)
msg.setText(_("Please install %s to use this function" % prog))
msg.exec_()
QMessageBox.warning(self, _("Settings Error"),
_("Please install %s to use this function" % f"<b>{setting_name}{prog_warning}</b>"))
Loading