fix(gui): install feedback, local .afw picker, scan icons, report wrap
Addresses the bench bug reports filed from the toolkit (issues #37, #38, #39) and the request for a local-file install source. Install (issue #38): the install never reached the worker in the reported case and aborts were only a status-bar line, so the operator saw nothing. Abort reasons (missing FLASH keyword, no release/asset, no target) now raise the visible error indicator and keep the dialog open; the actual per-board failure detail is surfaced and logged instead of a bare count; a clear "installing..." line and log entry mark the start. Install source (requested): the install dialog gains a "Browse local .afw" button beside the Gitea release picker, in the same window. A chosen file takes precedence over the selected release. start_install takes an AfwSource (Release or Local); a local file is used in place, a release is downloaded as before. This brings the CLI's local-file install to the GUI. Scan icons (issue #39): a hashboard the firmware lists with no active flag and no working-chip count now reads grey (not detected) instead of green, and the PSU bolt greens only on real delivery evidence (watts, PSU fan, or PSU output) -- is_mining counts only when the miner is actually hashing. A stock S17 control board with no PSU or hashboards attached asserts a cgminer mining status at zero watts, which previously showed green board and PSU icons. Confirmed against the bench S17 at 10.255.1.111 (reports watts=0). Regression tests added for both. Bug report (issue #37): the report box word-wraps instead of running off the edge (new wx text_ctrl_wrapped without wxTE_DONTWRAP). Sub-window movability is window-manager behaviour (the dialog already has a caption and resize border) and is not changed here. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
This commit is contained in:
@@ -692,9 +692,18 @@ impl MinerRow {
|
||||
/// live); grey (unknown) otherwise -- asic-rs has no direct PSU-fault flag, so
|
||||
/// a missing wattage reading is treated as unknown, never a false "down".
|
||||
pub fn power_health(&self) -> CompHealth {
|
||||
// A miner drawing power / spinning its PSU fan / actively mining has a live
|
||||
// PSU regardless of any warning flag.
|
||||
let delivering = self.power_w > 0.0 || self.psu_fan_rpm > 0.0 || self.is_mining;
|
||||
// A live PSU shows real evidence: measured draw, a spinning PSU fan, or
|
||||
// reported PSU output. A stock control board can assert a cgminer "mining"
|
||||
// status with no PSU and no hashboards attached (issue #39: a bare S17
|
||||
// control board showed a green PSU), so is_mining counts only when the
|
||||
// miner is actually hashing (hashrate, or at least one healthy board).
|
||||
let actually_hashing = self.hashrate_ths > 0.0
|
||||
|| self.board_status.iter().any(|b| *b == BoardHealth::Ok);
|
||||
let delivering = self.power_w > 0.0
|
||||
|| self.psu_fan_rpm > 0.0
|
||||
|| self.psu_out_voltage_v.is_some()
|
||||
|| self.psu_out_current_a.is_some()
|
||||
|| (self.is_mining && actually_hashing);
|
||||
// A reported PSU fault while the miner is actually mining is a warning, not
|
||||
// a failure -- yellow, not red (round 18 #2: some WhatsMiners flag a PSU
|
||||
// error while running fine). A fault on a miner that is not mining is a real
|
||||
@@ -2476,6 +2485,52 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stock_board_with_nothing_attached_shows_grey_psu() {
|
||||
// Issue #39: a stock S17 control board with no PSU and no hashboards
|
||||
// attached asserts a cgminer "mining" status (is_mining = true) while
|
||||
// reporting zero watts, no PSU fan, and no PSU output. That is not
|
||||
// evidence of a live PSU, so the bolt must read grey (Unreachable).
|
||||
let bare = MinerRow {
|
||||
is_mining: true,
|
||||
power_w: 0.0,
|
||||
psu_fan_rpm: 0.0,
|
||||
hashrate_ths: 0.0,
|
||||
board_status: vec![BoardHealth::Missing, BoardHealth::Missing],
|
||||
..Default::default()
|
||||
};
|
||||
assert_eq!(bare.power_health(), CompHealth::Unreachable);
|
||||
|
||||
// A genuinely-running miner still greens: is_mining with real hashing is
|
||||
// evidence enough even when the firmware reports no watts.
|
||||
let hashing = MinerRow {
|
||||
is_mining: true,
|
||||
power_w: 0.0,
|
||||
psu_fan_rpm: 0.0,
|
||||
hashrate_ths: 90.0,
|
||||
board_status: vec![BoardHealth::Ok, BoardHealth::Ok],
|
||||
..Default::default()
|
||||
};
|
||||
assert_eq!(hashing.power_health(), CompHealth::Ok);
|
||||
|
||||
// Measured draw alone is always enough.
|
||||
let drawing = MinerRow {
|
||||
is_mining: false,
|
||||
power_w: 19.0,
|
||||
..Default::default()
|
||||
};
|
||||
assert_eq!(drawing.power_health(), CompHealth::Ok);
|
||||
|
||||
// Reported PSU output alone is enough even with zero measured watts.
|
||||
let psu_out = MinerRow {
|
||||
is_mining: false,
|
||||
power_w: 0.0,
|
||||
psu_out_voltage_v: Some(12.0),
|
||||
..Default::default()
|
||||
};
|
||||
assert_eq!(psu_out.power_health(), CompHealth::Ok);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn warning_fault_degrades_board_to_yellow_not_red() {
|
||||
// Round 21 #1: a board still mining near full hashrate with some failed/
|
||||
|
||||
@@ -674,6 +674,42 @@ fn messages_to_faults(
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// A hashboard's health dot from its reported activity. `active` is the firmware's
|
||||
/// active flag; `working_chips` its working-chip count. Green needs positive
|
||||
/// evidence (active, or a nonzero chip count); a board with neither flag nor count
|
||||
/// reads grey ("not detected") rather than green (issue #39: an S17 control board
|
||||
/// with no hashboards attached showed its boards green). A board that is present
|
||||
/// but idle or has zero working chips reads as a fault (red).
|
||||
fn board_health(active: Option<bool>, working_chips: Option<u16>) -> crate::model::BoardHealth {
|
||||
use crate::model::BoardHealth;
|
||||
match (active, working_chips) {
|
||||
(Some(true), _) => BoardHealth::Ok,
|
||||
(Some(false), _) => BoardHealth::Fault,
|
||||
(None, Some(c)) if c > 0 => BoardHealth::Ok,
|
||||
(None, Some(_)) => BoardHealth::Fault,
|
||||
(None, None) => BoardHealth::Missing,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod board_health_tests {
|
||||
use super::board_health;
|
||||
use crate::model::BoardHealth;
|
||||
|
||||
#[test]
|
||||
fn no_activity_evidence_reads_grey_not_green() {
|
||||
// Issue #39: the firmware lists a board but reports no active flag and no
|
||||
// working-chip count -> not detected (grey), not green.
|
||||
assert_eq!(board_health(None, None), BoardHealth::Missing);
|
||||
// Positive evidence still greens.
|
||||
assert_eq!(board_health(Some(true), None), BoardHealth::Ok);
|
||||
assert_eq!(board_health(None, Some(63)), BoardHealth::Ok);
|
||||
// Present but idle / zero working chips -> fault (red).
|
||||
assert_eq!(board_health(Some(false), Some(63)), BoardHealth::Fault);
|
||||
assert_eq!(board_health(None, Some(0)), BoardHealth::Fault);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod board_index_tests {
|
||||
use super::board_index_from_text;
|
||||
@@ -1189,18 +1225,7 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
|
||||
let mut board_status: Vec<crate::model::BoardHealth> = data
|
||||
.hashboards
|
||||
.iter()
|
||||
.map(|b| {
|
||||
let ok = match (b.active, b.working_chips) {
|
||||
(Some(a), _) => a,
|
||||
(None, Some(c)) => c > 0,
|
||||
(None, None) => true,
|
||||
};
|
||||
if ok {
|
||||
crate::model::BoardHealth::Ok
|
||||
} else {
|
||||
crate::model::BoardHealth::Fault
|
||||
}
|
||||
})
|
||||
.map(|b| board_health(b.active, b.working_chips))
|
||||
.collect();
|
||||
if let Some(exp) = data.expected_hashboards {
|
||||
while board_status.len() < exp as usize {
|
||||
|
||||
@@ -34,12 +34,26 @@ pub fn is_supported_board(board: &str) -> bool {
|
||||
SUPPORTED_BOARDS.iter().any(|(b, _)| *b == board)
|
||||
}
|
||||
|
||||
/// The release asset to install: its filename and download URL, resolved to a
|
||||
/// local path on the worker thread so the download never blocks the UI. (Local-
|
||||
/// file install is a CLI feature; the GUI installs from scanned releases.)
|
||||
pub struct AfwChoice {
|
||||
pub name: String,
|
||||
pub url: String,
|
||||
/// Where the `.afw` to install comes from. `Release` is a scanned Gitea asset
|
||||
/// (its filename and download URL), fetched on the worker thread so the download
|
||||
/// never blocks the UI. `Local` is a file the operator picked with the Browse
|
||||
/// button -- the same local-file install the CLI offers, now in the GUI too.
|
||||
pub enum AfwSource {
|
||||
Release { name: String, url: String },
|
||||
Local(PathBuf),
|
||||
}
|
||||
|
||||
impl AfwSource {
|
||||
/// A short human label for the status line (the filename in both cases).
|
||||
fn label(&self) -> String {
|
||||
match self {
|
||||
AfwSource::Release { name, .. } => name.clone(),
|
||||
AfwSource::Local(p) => p
|
||||
.file_name()
|
||||
.map(|n| n.to_string_lossy().into_owned())
|
||||
.unwrap_or_else(|| p.to_string_lossy().into_owned()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Progress + results streamed from the background worker to the UI.
|
||||
@@ -81,7 +95,7 @@ fn download_dir() -> PathBuf {
|
||||
pub fn start_install(
|
||||
ips: Vec<String>,
|
||||
board: String,
|
||||
source: AfwChoice,
|
||||
source: AfwSource,
|
||||
allow_unsigned: bool,
|
||||
password: Option<String>,
|
||||
) -> StockHandle {
|
||||
@@ -111,26 +125,49 @@ pub fn start_install(
|
||||
.spawn(move || {
|
||||
let _ = tx.send(StockMsg::Started);
|
||||
|
||||
// 1. Download the chosen release asset (on this worker thread).
|
||||
let _ = tx.send(StockMsg::Progress("acquiring .afw...".into()));
|
||||
let afw_path = match fetch::fetch_afw_url(
|
||||
&ReleaseSource::alkane_os(),
|
||||
&source.name,
|
||||
&source.url,
|
||||
&download_dir(),
|
||||
) {
|
||||
Ok(p) => p,
|
||||
Err(e) => {
|
||||
// One failure line per target so the UI clears its op-status.
|
||||
for ip in &ips {
|
||||
let _ = tx.send(StockMsg::Result {
|
||||
ip: ip.clone(),
|
||||
ok: false,
|
||||
detail: format!("could not fetch .afw: {e}"),
|
||||
});
|
||||
// 1. Acquire the .afw: a local file is used in place; a release asset
|
||||
// is downloaded on this worker thread (never blocking the UI).
|
||||
let afw_path = match source {
|
||||
AfwSource::Local(path) => {
|
||||
let _ = tx.send(StockMsg::Progress(format!(
|
||||
"using local {}...",
|
||||
AfwSource::Local(path.clone()).label()
|
||||
)));
|
||||
if !path.is_file() {
|
||||
for ip in &ips {
|
||||
let _ = tx.send(StockMsg::Result {
|
||||
ip: ip.clone(),
|
||||
ok: false,
|
||||
detail: format!("local .afw not found: {}", path.display()),
|
||||
});
|
||||
}
|
||||
let _ = tx.send(StockMsg::Done);
|
||||
return;
|
||||
}
|
||||
path
|
||||
}
|
||||
AfwSource::Release { name, url } => {
|
||||
let _ = tx.send(StockMsg::Progress("acquiring .afw...".into()));
|
||||
match fetch::fetch_afw_url(
|
||||
&ReleaseSource::alkane_os(),
|
||||
&name,
|
||||
&url,
|
||||
&download_dir(),
|
||||
) {
|
||||
Ok(p) => p,
|
||||
Err(e) => {
|
||||
// One failure line per target so the UI clears its op-status.
|
||||
for ip in &ips {
|
||||
let _ = tx.send(StockMsg::Result {
|
||||
ip: ip.clone(),
|
||||
ok: false,
|
||||
detail: format!("could not fetch .afw: {e}"),
|
||||
});
|
||||
}
|
||||
let _ = tx.send(StockMsg::Done);
|
||||
return;
|
||||
}
|
||||
}
|
||||
let _ = tx.send(StockMsg::Done);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+115
-23
@@ -6,7 +6,7 @@ use crate::credentials;
|
||||
use crate::model::*;
|
||||
use crate::restore;
|
||||
use crate::scan::{self, ScanMsg};
|
||||
use crate::stock_ops::{self, AfwChoice, StockMsg};
|
||||
use crate::stock_ops::{self, AfwSource, StockMsg};
|
||||
use alkane_artifacts::fetch::{self, ReleaseInfo, ReleaseSource};
|
||||
use asic_rs::core::data::firmware::FirmwareImage;
|
||||
use std::cell::RefCell;
|
||||
@@ -108,6 +108,8 @@ const ID_CTX_UPDATE_ALKANE: i32 = 772;
|
||||
const ID_INSTALL_OK: i32 = 1006;
|
||||
const ID_INSTALL_CANCEL: i32 = 1007;
|
||||
const ID_INSTALL_RELEASE_CHOICE: i32 = 1008;
|
||||
// Browse for a local .afw to install instead of a scanned Gitea release.
|
||||
const ID_INSTALL_BROWSE: i32 = 1011;
|
||||
const ID_UNINSTALL_OK: i32 = 1009;
|
||||
const ID_UNINSTALL_CANCEL: i32 = 1010;
|
||||
// Pool-preset manager dialog (round 18 #8b): edit the whole saved list at once.
|
||||
@@ -908,6 +910,10 @@ pub struct App {
|
||||
install_releases: Vec<ReleaseInfo>,
|
||||
install_ips: Vec<String>,
|
||||
install_board: String,
|
||||
// A local .afw picked with the Browse button, used in place of a Gitea
|
||||
// release when set; the read-only label beside the button shows it.
|
||||
install_local_path: Option<String>,
|
||||
install_local_label: Widget,
|
||||
uninstall_dialog: Widget,
|
||||
uninstall_pass_input: Widget,
|
||||
uninstall_firmware_input: Widget,
|
||||
@@ -1296,6 +1302,8 @@ pub fn build(frame: Widget) -> App {
|
||||
install_releases: Vec::new(),
|
||||
install_ips: Vec::new(),
|
||||
install_board: stock_ops::DEFAULT_BOARD.to_string(),
|
||||
install_local_path: None,
|
||||
install_local_label: frame,
|
||||
uninstall_dialog: frame,
|
||||
uninstall_pass_input: frame,
|
||||
uninstall_firmware_input: frame,
|
||||
@@ -2651,6 +2659,7 @@ impl App {
|
||||
};
|
||||
self.install_releases = releases;
|
||||
self.install_ips = ips.clone();
|
||||
self.install_local_path = None;
|
||||
|
||||
let frame = Widget::main_frame();
|
||||
let title = if update {
|
||||
@@ -2724,6 +2733,32 @@ impl App {
|
||||
);
|
||||
self.install_release_choice = choice;
|
||||
|
||||
// Or install from a local .afw the operator picks (the CLI's local-file
|
||||
// install, now in the GUI). When a file is chosen it takes precedence
|
||||
// over the release selected above; the label shows the current choice.
|
||||
root.add(
|
||||
Widget::static_text(dlg, "Or install from a local .afw file:"),
|
||||
0,
|
||||
sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP,
|
||||
12,
|
||||
);
|
||||
let browse_row = Widget::box_sizer(false);
|
||||
browse_row.add(
|
||||
Widget::button(dlg, "Browse local .afw...", ID_INSTALL_BROWSE),
|
||||
0,
|
||||
sf::BORDER_RIGHT,
|
||||
6,
|
||||
);
|
||||
let local_label = Widget::static_text(dlg, "(none; using the selected release above)");
|
||||
browse_row.add(local_label, 1, sf::ALIGN_CENTRE_VERTICAL, 0);
|
||||
self.install_local_label = local_label;
|
||||
root.add_sizer(
|
||||
browse_row,
|
||||
0,
|
||||
sf::EXPAND | sf::BORDER_LEFT | sf::BORDER_RIGHT,
|
||||
12,
|
||||
);
|
||||
|
||||
root.add(
|
||||
Widget::static_text(dlg, "Board password (optional):"),
|
||||
0,
|
||||
@@ -2793,28 +2828,47 @@ impl App {
|
||||
return;
|
||||
}
|
||||
if !flash_confirmed(&self.install_confirm_input.get_value()) {
|
||||
wx_rs::set_status_text("type FLASH to confirm the install");
|
||||
return;
|
||||
}
|
||||
let idx = self.install_release_choice.choice_get_selection();
|
||||
if idx < 0 || self.install_releases.is_empty() {
|
||||
wx_rs::set_status_text("no release selected");
|
||||
// Keep the dialog open; the typed confirmation is the only thing
|
||||
// missing. A plain status line was easy to miss (issue #38), so this
|
||||
// also raises the visible error indicator.
|
||||
self.set_error_indicator("type FLASH in the confirmation box to start the install");
|
||||
return;
|
||||
}
|
||||
let board = self.install_board.clone();
|
||||
let Some(release) = self.install_releases.get(idx as usize) else {
|
||||
wx_rs::set_status_text("no release selected");
|
||||
return;
|
||||
// Source: a local .afw the operator picked takes precedence; otherwise
|
||||
// the selected Gitea release's asset for this board.
|
||||
let (source, source_name) = if let Some(path) = self.install_local_path.clone() {
|
||||
let name = std::path::Path::new(&path)
|
||||
.file_name()
|
||||
.map(|n| n.to_string_lossy().into_owned())
|
||||
.unwrap_or_else(|| path.clone());
|
||||
(AfwSource::Local(std::path::PathBuf::from(path)), name)
|
||||
} else {
|
||||
let idx = self.install_release_choice.choice_get_selection();
|
||||
if idx < 0 || self.install_releases.is_empty() {
|
||||
self.set_error_indicator(
|
||||
"pick a Gitea release or Browse for a local .afw, then start the install",
|
||||
);
|
||||
return;
|
||||
}
|
||||
let Some(release) = self.install_releases.get(idx as usize) else {
|
||||
self.set_error_indicator("the selected release is no longer available; rescan");
|
||||
return;
|
||||
};
|
||||
let Some(asset) = release.asset_for_board(&board) else {
|
||||
self.set_error_indicator(&format!(
|
||||
"the selected release has no .afw for {board}; pick another or Browse for a file"
|
||||
));
|
||||
return;
|
||||
};
|
||||
(
|
||||
AfwSource::Release {
|
||||
name: asset.name.clone(),
|
||||
url: asset.url.clone(),
|
||||
},
|
||||
asset.name.clone(),
|
||||
)
|
||||
};
|
||||
let Some(asset) = release.asset_for_board(&board) else {
|
||||
wx_rs::set_status_text("the selected release has no .afw for this board");
|
||||
return;
|
||||
};
|
||||
let source = AfwChoice {
|
||||
name: asset.name.clone(),
|
||||
url: asset.url.clone(),
|
||||
};
|
||||
let asset_name = asset.name.clone();
|
||||
let allow_unsigned = self.install_unsigned_check.is_checked();
|
||||
let password = {
|
||||
let p = self.install_pass_input.get_value();
|
||||
@@ -2826,6 +2880,7 @@ impl App {
|
||||
};
|
||||
let ips = std::mem::take(&mut self.install_ips);
|
||||
if ips.is_empty() {
|
||||
self.set_error_indicator("no board selected to install onto; close this and reselect");
|
||||
self.install_dialog.close(0);
|
||||
return;
|
||||
}
|
||||
@@ -2833,7 +2888,11 @@ impl App {
|
||||
crate::logs::log(format!(
|
||||
"install alkane OS onto {} board(s) from {}",
|
||||
ips.len(),
|
||||
asset_name
|
||||
source_name
|
||||
));
|
||||
wx_rs::set_status_text(&format!(
|
||||
"installing alkane OS onto {} board(s) from {source_name}...",
|
||||
ips.len()
|
||||
));
|
||||
self.set_op_status(&ips, "installing...");
|
||||
self.stock_op = Some(stock_ops::start_install(
|
||||
@@ -3029,9 +3088,23 @@ impl App {
|
||||
}
|
||||
if done {
|
||||
if !fails.is_empty() {
|
||||
self.set_error_indicator(&format!("stock op: {} failed", fails.len()));
|
||||
// Surface the actual reason, not just a count (issue #38: a bare
|
||||
// "1 failed" left the operator unable to tell what went wrong).
|
||||
for f in &fails {
|
||||
crate::logs::log(format!("install/restore failed -- {f}"));
|
||||
}
|
||||
let first = fails.first().cloned().unwrap_or_default();
|
||||
let more = if fails.len() > 1 {
|
||||
format!(" (+{} more; see the log)", fails.len() - 1)
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
self.set_error_indicator(&format!("install/restore failed -- {first}{more}"));
|
||||
} else if oks > 0 {
|
||||
wx_rs::set_status_text(&format!("stock op complete: {oks} ok"));
|
||||
crate::logs::log(format!("install/restore complete: {oks} board(s) ok"));
|
||||
wx_rs::set_status_text(&format!(
|
||||
"install/restore complete: {oks} board(s) ok -- verify liveness over the network"
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5005,7 +5078,9 @@ impl App {
|
||||
sf::BORDER_LEFT | sf::BORDER_RIGHT,
|
||||
8,
|
||||
);
|
||||
let text = Widget::text_ctrl(dlg, true);
|
||||
// Word-wrap the report box so long lines wrap instead of running off the
|
||||
// edge (issue #37).
|
||||
let text = Widget::text_ctrl_wrapped(dlg);
|
||||
text.set_min_size(560, 220);
|
||||
root.add(text, 1, sf::EXPAND | sf::BORDER_ALL, 8);
|
||||
let log = Widget::check_box(
|
||||
@@ -5779,6 +5854,23 @@ impl App {
|
||||
self.restore_dialog.close(0);
|
||||
}
|
||||
ID_INSTALL_OK => self.apply_install_confirm(),
|
||||
ID_INSTALL_BROWSE => {
|
||||
if let Some(path) =
|
||||
Widget::file_dialog(self.install_dialog, "Choose a local .afw to install")
|
||||
{
|
||||
let name = std::path::Path::new(&path)
|
||||
.file_name()
|
||||
.map(|n| n.to_string_lossy().into_owned())
|
||||
.unwrap_or_else(|| path.clone());
|
||||
self.install_local_label
|
||||
.set_label(&format!("Using local file: {name}"));
|
||||
self.install_local_path = Some(path);
|
||||
} else {
|
||||
self.install_local_label
|
||||
.set_label("(none; using the selected release above)");
|
||||
self.install_local_path = None;
|
||||
}
|
||||
}
|
||||
ID_INSTALL_CANCEL => {
|
||||
self.install_ips.clear();
|
||||
self.install_dialog.close(0);
|
||||
|
||||
@@ -890,6 +890,15 @@ void* wxbr_text_ctrl(void* parent, int multiline) {
|
||||
wxDefaultPosition, wxSize(-1, -1), style);
|
||||
}
|
||||
|
||||
// A multiline text control that word-wraps at the control's width instead of
|
||||
// scrolling horizontally (no wxTE_DONTWRAP). For prose entry such as the bug
|
||||
// report box, where long lines should wrap rather than run off the edge.
|
||||
void* wxbr_text_ctrl_wrap(void* parent) {
|
||||
return (void*)new wxTextCtrl((wxWindow*)parent, wxID_ANY, wxT(""),
|
||||
wxDefaultPosition, wxSize(-1, -1),
|
||||
wxTE_MULTILINE | wxTE_BESTWRAP);
|
||||
}
|
||||
|
||||
// A single-line text control that masks its content (wxTE_PASSWORD), for secret
|
||||
// entry so a saved password is never rendered in the clear (round 18 #12).
|
||||
void* wxbr_text_ctrl_password(void* parent) {
|
||||
|
||||
@@ -41,6 +41,7 @@ mod notsafe {
|
||||
pub fn wxbr_button(parent: *mut c_void, label: *const c_char, id: c_int) -> *mut c_void;
|
||||
pub fn wxbr_bind_click(win: *mut c_void, id: c_int);
|
||||
pub fn wxbr_text_ctrl(parent: *mut c_void, multiline: c_int) -> *mut c_void;
|
||||
pub fn wxbr_text_ctrl_wrap(parent: *mut c_void) -> *mut c_void;
|
||||
pub fn wxbr_text_ctrl_password(parent: *mut c_void) -> *mut c_void;
|
||||
pub fn wxbr_text_ctrl_get(win: *mut c_void, buf: *mut c_char, cap: c_int) -> c_int;
|
||||
pub fn wxbr_text_ctrl_set(win: *mut c_void, value: *const c_char);
|
||||
@@ -463,6 +464,12 @@ impl Widget {
|
||||
Widget(unsafe { notsafe::wxbr_text_ctrl(parent.0, multiline as c_int) })
|
||||
}
|
||||
|
||||
/// A multiline text control that word-wraps at its width (no horizontal
|
||||
/// scroll), for prose entry such as the bug-report box.
|
||||
pub fn text_ctrl_wrapped(parent: Widget) -> Widget {
|
||||
Widget(unsafe { notsafe::wxbr_text_ctrl_wrap(parent.0) })
|
||||
}
|
||||
|
||||
/// A single-line text control that masks its content (for password entry).
|
||||
pub fn password_ctrl(parent: Widget) -> Widget {
|
||||
Widget(unsafe { notsafe::wxbr_text_ctrl_password(parent.0) })
|
||||
|
||||
Reference in New Issue
Block a user