On Mon, Nov 21, 2022 at 10:29:59PM -0500, Scott Kostyshak wrote:
> On Mon, Nov 21, 2022 at 02:50:59PM -0500, Scott Kostyshak wrote:
> > On Mon, Nov 21, 2022 at 06:57:59PM +0100, Jürgen Spitzmüller wrote:
> > > Am Montag, dem 21.11.2022 um 10:57 -0500 schrieb Scott Kostyshak:
> > > > Thanks for the thoughts, Jürgen and JMarc!
> > > > 
> > > > Those are good ideas. I'm not going to work on this for 2.4.0. If
> > > > someone else wants to do it, please go ahead. Otherwise, I'll make a
> > > > note to look into it for the next major version.
> > > 
> > > I did it (explicit cancel button).
> > 
> > Nice, thank you!
> > 
> > Should I go ahead with removing the "Let it run" mechanism then?
> 
> Also, what do you think of the attached patch? Without it, I find it
> confusing that the busy icon is still spinning during the prompt after
> clicking cancel. See the before and after screenshots.

Oops, I forgot to attach the patch. Patch now attached.
> 
> Scott



From 788f4a1ff1a7b81859ca0062d3c54739f01e23ca Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Mon, 21 Nov 2022 22:34:01 -0500
Subject: [PATCH] After confirm cancel, hide busy and cancel buttons

---
 src/frontends/qt/GuiView.cpp | 9 ++++++++-
 src/frontends/qt/GuiView.h   | 2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 2ec50374df..82a6f17382 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -663,6 +663,9 @@ GuiView::GuiView(int id)
 		processStop, SLOT(hide()));
 	connect(processStop, SIGNAL(pressed()), this, SLOT(checkCancelBackground()));
 
+	connect(this, SIGNAL(scriptKilled()), busySVG, SLOT(hide()));
+	connect(this, SIGNAL(scriptKilled()), processStop, SLOT(hide()));
+
 	stat_counts_ = new GuiClickableLabel(statusBar());
 	stat_counts_->setAlignment(Qt::AlignCenter);
 	stat_counts_->setFrameStyle(QFrame::StyledPanel);
@@ -831,8 +834,12 @@ void GuiView::checkCancelBackground()
 	int const ret =
 		Alert::prompt(ttl, msg, 1, 1,
 			_("&Cancel export"), _("Co&ntinue"));
-	if (ret == 0)
+	if (ret == 0) {
 		Systemcall::killscript();
+		// stop busy signal immediately so that in the subsequent
+		// "Export canceled" prompt the status bar icons are accurate.
+		Q_EMIT scriptKilled();
+	}
 }
 
 void GuiView::statsPressed()
diff --git a/src/frontends/qt/GuiView.h b/src/frontends/qt/GuiView.h
index cbe805eed3..5b22ea574b 100644
--- a/src/frontends/qt/GuiView.h
+++ b/src/frontends/qt/GuiView.h
@@ -228,6 +228,8 @@ Q_SIGNALS:
 	void bufferViewChanged();
 	/// emitted when zoom is modified
 	void currentZoomChanged(int);
+	/// emitted when script is killed (e.g., user cancels export)
+	void scriptKilled();
 
 public Q_SLOTS:
 	///
-- 
2.34.1

Attachment: signature.asc
Description: PGP signature

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to