UltimateHackingKeyboard / agent

Ultimate Hacking Keyboard configurator
https://ultimatehackingkeyboard.github.io/agent/
Other
699 stars 77 forks source link

Allow dismissing the macro error pane. #2338

Open kareltucek opened 3 weeks ago

kareltucek commented 3 weeks ago

https://forum.ultimatehackingkeyboard.com/t/macro-error-message-in-agent-how-do-dismiss/1532

@mondalaci?

mhantsch commented 3 weeks ago

Either have a dismiss or close button, or automatically dismiss the pane when clearStatus has been executed. Or have both: a dismiss button and a auto-dismiss checkbox.

mondalaci commented 3 weeks ago

@ert78gb When a smart macro with a syntax error is saved, the error pane appears, but getDeviceState:isMacroStatusDirty is false. How does Agent detect the error in this case?

ert78gb commented 3 weeks ago

Agent reads the statusBuffer of the keyboard when

Anytime when Agent reads something from the statusBuffer shows it.

ert78gb commented 3 weeks ago

And when the device connection state changes. Like

mondalaci commented 3 weeks ago

@kareltucek Why don't we set getDeviceState:isMacroStatusDirty to true when the status buffer is non-empty? If we would, we could make the error pane appear only when getDeviceState:isMacroStatusDirty is true, making clearStatus hide it.

kareltucek commented 3 weeks ago

Well, Macros_ConsumeStatusCharDirtyFlag provides information whether there is something in the error buffer that Agent has not seen yet.

Once Agent reads the content, it switches to false, but the error buffer still contains the error. (We don't want to clear it in case the user wants to print it manually - so that an Agent instance that runs in background isn't continuously clearing the buffer, thus making UHK behave as if there was no error.)

Once everything is consumed, subsequent buffer content requests restart reading.

kareltucek commented 3 weeks ago

We can instead report following enum:

mondalaci commented 3 weeks ago

@kareltucek What would getDeviceState:isMacroStatusDirty contain after clearStatus regarding the proposed tri-state? How would Agent's error pane behave based on the new getDeviceState:isMacroStatusDirty value?

kareltucek commented 3 weeks ago

What would getDeviceState:isMacroStatusDirty contain after clearStatus regarding the proposed tri-state?

clean

How would Agent's error pane behave based on the new getDeviceState:isMacroStatusDirty value?

ert78gb commented 3 weeks ago

The error panel of the Agent is visible if the statusBuffer has any value. Currently, It is a generic error panel and not just macro error panel. Would you like to convert this generic error panel to a macro specific error panel?

mondalaci commented 3 weeks ago

Whatever we do, let's make it simple. This is a very niche issue, and we have issues with far greater priority.

kareltucek commented 3 weeks ago

The error panel of the Agent is visible if the statusBuffer has any value. Currently, It is a generic error panel and not just macro error panel. Would you like to convert this generic error panel to a macro specific error panel?

I think it is a good idea to have it as a generic error panel.

What about having a cross button in the error pane that will clear Agent's statusBuffer and thus also hides the panel? Seems user friendly and simple.

kareltucek commented 3 weeks ago

(But yes, this is definitely not a priority.)

ert78gb commented 3 weeks ago

What about having a cross button in the error pane that will clear Agent's statusBuffer and thus also hides the panel?

I need some info when to ignore the dismissed state. I think when the content of the statusBuffer changes it means a new error occurred so should show again the error panel. Is it OK for you?

kareltucek commented 3 weeks ago

Yes, that sounds perfect to me.

mondalaci commented 3 weeks ago

I'm fine with the suggested cross button.