p2pool/xmrig: red/green [Start] on errors with solution in tooltip

This commit is contained in:
hinto-janaiyo 2022-12-23 11:41:43 -05:00
parent b5add2f4bf
commit 3991c26d76
No known key found for this signature in database
GPG key ID: B1C5A64B80691E45
3 changed files with 23 additions and 20 deletions

View file

@ -1,6 +1,7 @@
# v1.0.1
## Fixes
* 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

View file

@ -239,10 +239,10 @@ pub const P2POOL_NAME: &str = "Add a unique name to identify this node; Only [A-
pub const P2POOL_NODE_IP: &str = "Specify the Monero Node IP to connect to with P2Pool; It must be a valid IPv4 address or a valid domain name; Max length = 255 characters";
pub const P2POOL_RPC_PORT: &str = "Specify the RPC port of the Monero node; [1-65535]";
pub const P2POOL_ZMQ_PORT: &str = "Specify the ZMQ port of the Monero node; [1-65535]";
pub const P2POOL_PATH_NOT_FILE: &str = "P2Pool binary not found at the given PATH in the Gupax tab!";
pub const P2POOL_PATH_NOT_VALID: &str = "P2Pool binary at the given PATH in the Gupax tab doesn't look like P2Pool!";
pub const P2POOL_PATH_NOT_FILE: &str = "P2Pool binary not found at the given PATH in the Gupax tab! To fix: goto the [Gupax Advanced] tab, select [Open] and specify where P2Pool is located.";
pub const P2POOL_PATH_NOT_VALID: &str = "P2Pool binary at the given PATH in the Gupax tab doesn't look like P2Pool! To fix: goto the [Gupax Advanced] tab, select [Open] and specify where P2Pool is located.";
pub const P2POOL_PATH_OK: &str = "P2Pool was found at the given PATH";
pub const P2POOL_PATH_EMPTY: &str = "P2Pool PATH is empty";
pub const P2POOL_PATH_EMPTY: &str = "P2Pool PATH is empty! To fix: goto the [Gupax Advanced] tab, select [Open] and specify where P2Pool is located.";
// Node/Pool list
pub const LIST_ADD: &str = "Add the current values to the list";
@ -282,10 +282,10 @@ pub const XMRIG_API_PORT: &str = "Specify which port to bind to for XMRig's HTTP
pub const XMRIG_TLS: &str = "Enable SSL/TLS connections (needs pool support)";
pub const XMRIG_KEEPALIVE: &str = "Send keepalive packets to prevent timeout (needs pool support)";
pub const XMRIG_THREADS: &str = "Number of CPU threads to use for mining";
pub const XMRIG_PATH_NOT_FILE: &str = "XMRig binary not found at the given PATH in the Gupax tab!";
pub const XMRIG_PATH_NOT_VALID: &str = "XMRig binary at the given PATH in the Gupax tab doesn't look like XMRig!";
pub const XMRIG_PATH_NOT_FILE: &str = "XMRig binary not found at the given PATH in the Gupax tab! To fix: goto the [Gupax Advanced] tab, select [Open] and specify where XMRig is located.";
pub const XMRIG_PATH_NOT_VALID: &str = "XMRig binary at the given PATH in the Gupax tab doesn't look like XMRig! To fix: goto the [Gupax Advanced] tab, select [Open] and specify where XMRig is located.";
pub const XMRIG_PATH_OK: &str = "XMRig was found at the given PATH";
pub const XMRIG_PATH_EMPTY: &str = "XMRig PATH is empty";
pub const XMRIG_PATH_EMPTY: &str = "XMRig PATH is empty! To fix: goto the [Gupax Advanced] tab, select [Open] and specify where XMRig is located.";
// CLI argument messages
pub const ARG_HELP: &str =

View file

@ -1426,9 +1426,9 @@ impl eframe::App for App {
let width = (ui.available_width()/3.0)-5.0;
if p2pool_is_waiting {
ui.add_enabled_ui(false, |ui| {
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text("Restart P2Pool");
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text("Stop P2Pool");
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text("Start P2Pool");
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text(P2POOL_MIDDLE);
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text(P2POOL_MIDDLE);
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text(P2POOL_MIDDLE);
});
} else if p2pool_is_alive {
if key.is_up() && !wants_input || ui.add_sized([width, height], Button::new("")).on_hover_text("Restart P2Pool").clicked() {
@ -1450,16 +1450,17 @@ impl eframe::App for App {
let mut ui_enabled = true;
if !Regexes::addr_ok(&self.regex, &self.state.p2pool.address) {
ui_enabled = false;
text = P2POOL_ADDRESS.to_string();
text = format!("Error: {}", P2POOL_ADDRESS);
} else if !Gupax::path_is_file(&self.state.gupax.p2pool_path) {
ui_enabled = false;
text = P2POOL_PATH_NOT_FILE.to_string();
text = format!("Error: {}", P2POOL_PATH_NOT_FILE);
} else if !crate::update::check_p2pool_path(&self.state.gupax.p2pool_path) {
ui_enabled = false;
text = P2POOL_PATH_NOT_VALID.to_string();
text = format!("Error: {}", P2POOL_PATH_NOT_VALID);
}
ui.set_enabled(ui_enabled);
if (ui_enabled && key.is_up() && !wants_input) || ui.add_sized([width, height], Button::new("")).on_hover_text("Start P2Pool").on_disabled_hover_text(text).clicked() {
let color = if ui_enabled { GREEN } else { RED };
if (ui_enabled && key.is_up() && !wants_input) || ui.add_sized([width, height], Button::new(RichText::new("").color(color))).on_hover_text("Start P2Pool").on_disabled_hover_text(text).clicked() {
Helper::start_p2pool(&self.helper, &self.state.p2pool, &self.state.gupax.absolute_p2pool_path);
}
}
@ -1480,9 +1481,9 @@ impl eframe::App for App {
let width = (ui.available_width()/3.0)-5.0;
if xmrig_is_waiting {
ui.add_enabled_ui(false, |ui| {
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text("Restart XMRig");
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text("Stop XMRig");
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text("Start XMRig");
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text(XMRIG_MIDDLE);
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text(XMRIG_MIDDLE);
ui.add_sized([width, height], Button::new("")).on_disabled_hover_text(XMRIG_MIDDLE);
});
} else if xmrig_is_alive {
if key.is_up() && !wants_input || ui.add_sized([width, height], Button::new("")).on_hover_text("Restart XMRig").clicked() {
@ -1513,18 +1514,19 @@ impl eframe::App for App {
let mut ui_enabled = true;
if !Gupax::path_is_file(&self.state.gupax.xmrig_path) {
ui_enabled = false;
text = XMRIG_PATH_NOT_FILE.to_string();
text = format!("Error: {}", XMRIG_PATH_NOT_FILE);
} else if !crate::update::check_xmrig_path(&self.state.gupax.xmrig_path) {
ui_enabled = false;
text = XMRIG_PATH_NOT_VALID.to_string();
text = format!("Error: {}", XMRIG_PATH_NOT_VALID);
}
ui.set_enabled(ui_enabled);
let color = if ui_enabled { GREEN } else { RED };
#[cfg(target_os = "windows")]
if (ui_enabled && key.is_up() && !wants_input) || ui.add_sized([width, height], Button::new("")).on_hover_text("Start XMRig").on_disabled_hover_text(text).clicked() {
if (ui_enabled && key.is_up() && !wants_input) || ui.add_sized([width, height], Button::new(RichText::new("").color(color))).on_hover_text("Start XMRig").on_disabled_hover_text(text).clicked() {
Helper::start_xmrig(&self.helper, &self.state.xmrig, &self.state.gupax.absolute_xmrig_path, Arc::clone(&self.sudo));
}
#[cfg(target_family = "unix")]
if (ui_enabled && key.is_up() && !wants_input) || ui.add_sized([width, height], Button::new("")).on_hover_text("Start XMRig").on_disabled_hover_text(text).clicked() {
if (ui_enabled && key.is_up() && !wants_input) || ui.add_sized([width, height], Button::new(RichText::new("").color(color))).on_hover_text("Start XMRig").on_disabled_hover_text(text).clicked() {
self.sudo.lock().unwrap().signal = ProcessSignal::Start;
self.error_state.ask_sudo(&self.sudo);
}