main: properly show "Okay|Panic" after initial disk error

When Gupax can't read disk files at startup, it will [Error],
with an option to reset the state file, the user is given two
options [Yes] or [No].

Gupax's global error screen system ignores new errors from
overriding the current IF the current is a [Panic]. This makes
sure the worst errors stay on screen.

This also means after clicking [Yes], it will get ignored and the
screen won't change. So, allow for certain buttons to pass through.

I should probably re-make this whole global error screen system,
it's pretty much a global variable anyone can mutate randomly.
This commit is contained in:
hinto-janaiyo 2022-12-26 13:58:41 -05:00
parent 4cac807ca7
commit 04d270b37f
No known key found for this signature in database
GPG key ID: B1C5A64B80691E45
3 changed files with 9 additions and 17 deletions

View file

@ -3,7 +3,7 @@
* macOS: Added warning (and solution) if `Gupax/P2Pool/XMRig` were quarantined by [`Gatekeeper`](https://support.apple.com/en-us/HT202491)
* P2Pool/XMRig: Added a red `Start` button on errors (bad PATH, invalid file, etc) and a solution in the tooltip
* P2Pool: Fixed custom node selection sometimes using old values after save
* Miscellaneous UI changes
* Miscellaneous UI changes and fixes
## Bundled Versions
* [`P2Pool v2.6`](https://github.com/SChernykh/p2pool/releases/tag/v2.6)

View file

@ -304,7 +304,7 @@ In general:
---
### Swapping P2Pool/XMRig
If you want to use your own `P2Pool/XMRig` binaries and/or want to swap them, you can:
If you want to use your own `P2Pool/XMRig` binaries you can:
- Edit the PATH in `Gupax Advanced` to point at the new binaries
- Change the binary itself
@ -345,8 +345,8 @@ gupax/
### Gupax
Along with the updater and settings mentioned in [Simple](#simple), `Gupax Advanced` allows you to change:
- The PATH of where Gupax looks for P2Pool/XMRig
- Gupax's resolution
- The selected tab on startup
- Gupax's resolution
**Warning:** Gupax will use your custom PATH/binary and will replace them if you use `Check for updates` in the `[Gupax]` tab. There are sanity checks in place, however. Your PATH MUST end in a value that _appears_ correct or else the updater will refuse to start:
| Binary | Accepted values | Good PATH | Bad PATH |
@ -367,8 +367,7 @@ P2Pool Advanced has:
- Out/In peer setting
- Log level setting
The overriding command arguments will completely override your Gupax settings and start P2Pool with those arguments.
**Warning:** If using this setting, use `--no-color` and make sure to set `--data-api <PATH>` & `--local-api` so that the `[Status]` tab can work!
The overriding command arguments will completely override your Gupax settings and start P2Pool with those arguments. **Warning:** If using this setting, use `--no-color` and make sure to set `--data-api <PATH>` & `--local-api` so that the `[Status]` tab can work!
The manual node list allows you save and connect up-to 1000 custom Monero nodes:
| Data Field | Purpose | Limits | Max Length |
@ -414,8 +413,7 @@ XMRig Advanced has:
- TLS setting
- Keepalive setting
The overriding command arguments will completely override your Gupax settings and start XMRig with those arguments.
**Warned:** If using this setting, use `[--no-color]` and make sure to set `[--http-host <IP>]` & `[--http-port <PORT>]` so that the `[Status]` tab can work!
The overriding command arguments will completely override your Gupax settings and start XMRig with those arguments. **Warned:** If using this setting, use `[--no-color]` and make sure to set `[--http-host <IP>]` & `[--http-port <PORT>]` so that the `[Status]` tab can work!
The manual pool list allows you save and connect up-to 1000 custom Pools (regardless if P2Pool or not):
| Data Field | Purpose | Limits | Max Length |
@ -428,7 +426,7 @@ The manual pool list allows you save and connect up-to 1000 custom Pools (regard
The HTTP API textboxes allow you to change to IP/Port XMRig's HTTP API opens up on:
| Data Field | Purpose | Default | Limits | Max Length
|-----------------|-----------------------------------------------|-----------------------|--------------------------------------------------------|----------------|
| `HTTPS API IP` | The IP XMRig's HTTP API server will bind to | `localhost/127.0.0.1` | It must be a valid IPv4 address or a valid domain name | 255 characters |
| `HTTP API IP` | The IP XMRig's HTTP API server will bind to | `localhost/127.0.0.1` | It must be a valid IPv4 address or a valid domain name | 255 characters |
| `HTTP API Port` | The port XMRig's HTTP API server will bind to | `18088` | `[1-65535]` | 5 characters |
The remaining buttons control miscellaneous settings (both are disabled by default, as P2Pool does not require them):
@ -547,7 +545,7 @@ The GUI library Gupax uses is [egui](https://github.com/emilk/egui). It is licen
## FAQ
### Where are updates downloaded from?
The latest versions are downloaded using the GitHub API.
The latest versions are downloaded using GitHub's API.
* Gupax [`https://github.com/hinto-janaiyo/gupax`](https://github.com/hinto-janaiyo/gupax)
* P2Pool [`https://github.com/SChernykh/p2pool`](https://github.com/SChernykh/p2pool)
* XMRig [`https://github.com/xmrig/xmrig`](https://github.com/xmrig/xmrig)

View file

@ -504,14 +504,8 @@ impl ErrorState {
// Convenience function to enable the [App] error state
pub fn set(&mut self, msg: impl Into<String>, ferris: ErrorFerris, buttons: ErrorButtons) {
if self.error {
// If a panic error is already set, return
if self.ferris == ErrorFerris::Panic { return }
// If we shouldn't be overriding the current error, return
match self.buttons {
ErrorButtons::YesNo => (), // Not important
ErrorButtons::Okay => (), // Not important
_ => return, // Overwrite, Quits, etc
}
// If a panic error is already set and there isn't an [Okay] confirm or another [Panic], return
if self.ferris == ErrorFerris::Panic && (buttons != ErrorButtons::Okay || ferris != ErrorFerris::Panic) { return }
}
*self = Self {
error: true,