Dash progress bar with celery - celery

I am developing a dash application. I am using docker-compose, web and celery are few services to name.
I have a long running task for this I am using celery and I have a progress bar to display progress of that task.
So basically user clicks on run button to start the task and then a progress bar and cancel button is visible to cancel the task and run button is disabled till task is running or cancel button is clicked.
This above setup is working smooth.
Now suppose user clicks on run button i.e. progress bar and cancel button is visible and run button is disabled and after that user do one of the following below actions -
Problem:
If user closes the browser tab or
If user clicks the browser refresh button or
If user switches/clicks on any other page within the application
And now if user again returns/opens the same page again, I observed following things:
Page gets loaded with default page settings i.e. no progress bar and cancel button only run button is visible.
The task is still running in background.
What is preferred approach to handle above problems?
I am trying to get the status of the page as it was left i.e. progress bar and cancel button is visible and run button is disabled.Is this possible?
Please suggest.

Related

Possible to have multiple buttons in a StatusItem on MacOS?

I'm trying to build a timer app on MacOS that would show the remaining time in the status bar.
Wondering if it's possible to show multiple buttons there at once? E.g. show play/pause button, reset button and the time right in the status bar.
Or are there any hacks possible, like make it a single button with 2 icons next to each other, and check the click position to see which "button" got the click?
I know I can put the extra buttons in a popover, but I'm new to MacOS dev and trying to understand the limits. Thanks!

Button not staying disabled when page refresh LWC

I am trying to be disabled when another button gets clicked, currently it does disable the button but I am stuck on when refreshing page the button gets enabled again. Any ideas on how to keep the button disabled even on refresh?

NSWindow appears inactive but still accepts keyevents

I'm building a status bar app (windowless) on OSX and having trouble with a pesky little UI bug.
The application opens up a preferences window from the status bar menu when a certain menu item is clicked. The bug presents after the following scenario:
A user opens the preference window from the status bar menu
App resigns the active status when the user opens a browser or another app
User clicks the status bar item (to look at some info in the menu) but doesnt click the menuitem to show the preferenceswindow
User closes the other application and clicks on the already opened preferences window again
After this sequence the NSWindow representing the preferences window appears inactive while still accepting key events. By inactive I mean that the close button for the preferences NSWindow is gray unless hovered over, all the textfields don't get a blue focus ring when clicked and buttons with keyEquivalent = "\r" are not blue. The status bar item will also not highlight. It's like some other hidden window is hijacking the visuals of an active window.
This is what the preferences window looks like normally:
This is what it looks like after the scenario I just described:
How do I make it so that when the preferences NSWindow looks active when clicked even if the user has used other apps and clicked the status bar item in the meantime? Note that the window accepts keyevents normally, and the application is active. Even just a step further in how to debug this would be helpful. Ive logged the main/key window and the apps active status in multiple places and everything looks right.
I think I figured it out. Apparently the NSMenu pop up from the statusbar blocks the execution of the application code. Somehow the NSMenu was retaining the focus even if the menu had been closed if the application wasn't active.
Solution was to activate the app if windows are open when clicking on the NSMenu before popUpMenu is called. Note that the popUpMenu must be done slightly later to not block the activation of the app. Something like:
let noWindowsOpen = extraVisibleWindows.count == 0
if (!noWindowsOpen) {
NSApp.activate(ignoringOtherApps: true)
}
Timer.scheduledTimer(withTimeInterval: 0.04, repeats: false) { _ in
self.statusItem.popUp(self.menu)
}
I found the solution on Github for another app that was dealing with similar problems.

Haw can I handle clicking back button in install4j?

I have a screen with really long action. I figured out that I can handle clicking 'Cancel' button by running scheduled task which checks the condition: context.isCancelling() during execution of this action. Is there any way to handle clicking 'Back' button during the action execution?
The back button is always disabled while an action is being executed, this cannot be changed programmatically.
If you want to provide a way to cancel an action and to go back to the previous screen, you have to add such a button yourself to the screen. In the action script of the button, you can set an installer variable to true and regularly check its value in the action. If the variable is set, call
context.goBackInHistory(1);
to go back to the previous screen and return from the action.

Cancel button beside Eclipse Job Status Bar Progress

Eclipse jobs can have a progress bar with a stop button on the side. However on the status bar only a small progress bar appears informing the user that a job is ongoing.
Is it possible to put a small stop button next to the progress in the status bar? This will allow the user to stop the job without opening the "Progress" view.
You should probably use a Job using setUser(true) which will display a popup dialog showing the progress with a Cancel button.