pub struct Admin { /* private fields */ }Expand description
The administration app’s state, manifests, hooks, widget kinds and value layers.
Need (dialog): a settings or admin page declared as a manifest.
Implementations§
Source§impl Admin
impl Admin
Sourcepub fn open_detail(
&self,
app: &AppHandle,
records: &Records,
row: &Json,
) -> Result<u64, String>
pub fn open_detail( &self, app: &AppHandle, records: &Records, row: &Json, ) -> Result<u64, String>
Opens the detail sheet of row, one of records’ rows, over the
window drawn (or the one whose command opened it): the sheet
Records::detail declares, its title the row’s, each line a
label over its value. Returns the dialog’s id; refused when the
records declare no sheet or there are no dialogs.
Source§impl Admin
impl Admin
Sourcepub fn set_foci(&self, foci: impl SettingsFoci)
pub fn set_foci(&self, foci: impl SettingsFoci)
Gives the Settings the host’s foci (see the module’s docs).
Sourcepub fn foci(&self, app: &AppHandle) -> Vec<SettingsFocus>
pub fn foci(&self, app: &AppHandle) -> Vec<SettingsFocus>
The host’s foci open now (none without Admin::set_foci).
Sourcepub fn edited_focus(&self) -> Option<String>
pub fn edited_focus(&self) -> Option<String>
The focus the Settings edit, once one was chosen.
Source§impl Admin
impl Admin
Sourcepub fn note_changed<'a>(&self, ids: impl IntoIterator<Item = &'a str>, at: f64)
pub fn note_changed<'a>(&self, ids: impl IntoIterator<Item = &'a str>, at: f64)
Notes that the person changed settings (their ids) at at
(seconds since the epoch): offered among the recent ones in the
quick settings until RECENT_SECONDS later.
Sourcepub fn quick_settings(&self, app: &AppHandle) -> Vec<String>
pub fn quick_settings(&self, app: &AppHandle) -> Vec<String>
The settings marked quick that exist, in order.
Sourcepub fn recent_settings(&self, app: &AppHandle, now: f64) -> Vec<String>
pub fn recent_settings(&self, app: &AppHandle, now: f64) -> Vec<String>
The settings changed lately at now, the latest first, without
the quick ones, at most RECENT_MAX.
Sourcepub fn quick_open_in(&self, group: ViewportId) -> bool
pub fn quick_open_in(&self, group: ViewportId) -> bool
Whether the quick settings are open in a window group.
Sourcepub fn toggle_quick(&self, group: ViewportId) -> bool
pub fn toggle_quick(&self, group: ViewportId) -> bool
Opens or closes them in a window group; whether they are open.
Sourcepub fn quick_window_in(&self, group: ViewportId) -> Option<ViewportId>
pub fn quick_window_in(&self, group: ViewportId) -> Option<ViewportId>
The window they are shown in, in a window group, once drawn.
Source§impl Admin
impl Admin
Sourcepub fn attach_store(&self, store: impl SettingsStore + 'static)
pub fn attach_store(&self, store: impl SettingsStore + 'static)
Gives the Settings app the host’s store: its scopes are read at the next pass (a host scope once offered), what changes is saved to it, and its changes made elsewhere are followed. Replaces a store attached before.
Sourcepub fn reload(&self, scope: ValueScope)
pub fn reload(&self, scope: ValueScope)
Reads a scope from the store again at the next pass (the host opened another library): what it holds replaces the layer.
Sourcepub fn store_errors(&self) -> Vec<(Option<ValueScope>, String)>
pub fn store_errors(&self) -> Vec<(Option<ValueScope>, String)>
The store’s errors to show: a failed load or save, by scope, and its other problems (a setting two handlers claim).
Sourcepub fn session_only(&self, app: &AppHandle) -> bool
pub fn session_only(&self, app: &AppHandle) -> bool
Whether the values changed here last only the session: no store, and neither the application’s settings file nor the host’s own layer handling keeps them.
Source§impl Admin
impl Admin
Sourcepub fn obsolete(&self, id: &str, note: &str)
pub fn obsolete(&self, id: &str, note: &str)
Names a setting the application retired, with what replaced it: an imported file’s value for it is flagged obsolete, not applied.
Sourcepub fn export_settings(
&self,
app: &AppHandle,
selection: &Selection,
) -> Result<SettingsFile, String>
pub fn export_settings( &self, app: &AppHandle, selection: &Selection, ) -> Result<SettingsFile, String>
The settings file of a selection: the values, the shortcuts, the sensitive settings left out.
Sourcepub fn import_plan(
&self,
app: &AppHandle,
file: &SettingsFile,
scope: ValueScope,
) -> Vec<Row>
pub fn import_plan( &self, app: &AppHandle, file: &SettingsFile, scope: ValueScope, ) -> Vec<Row>
What importing a file into a value scope would do, row by row.
Sourcepub fn import_settings(
&self,
app: &AppHandle,
file: &SettingsFile,
scope: ValueScope,
keys: Option<&[String]>,
) -> Result<Json, String>
pub fn import_settings( &self, app: &AppHandle, file: &SettingsFile, scope: ValueScope, keys: Option<&[String]>, ) -> Result<Json, String>
Applies a file’s changes into a value scope: those keys names
(None: every change), as one undo step. What is not applied is
said, with its reason.
Sourcepub fn undo_import(&self, app: &AppHandle) -> Result<Json, String>
pub fn undo_import(&self, app: &AppHandle) -> Result<Json, String>
Takes the last import back: its undo step (refused when the settings changed since: undo those first), the layer and the shortcuts as they were.
Sourcepub fn can_undo_import(&self) -> bool
pub fn can_undo_import(&self) -> bool
Whether an import can be undone.
Source§impl Admin
impl Admin
Sourcepub fn wizard_flow(&self) -> Option<Flow>
pub fn wizard_flow(&self) -> Option<Flow>
The wizard running, if any.
Sourcepub fn open_wizard(
&self,
app: &AppHandle,
id: &str,
step: Option<&str>,
values: Values,
) -> Result<Json, String>
pub fn open_wizard( &self, app: &AppHandle, id: &str, step: Option<&str>, values: Values, ) -> Result<Json, String>
Opens a wizard declared in a manifest, on its first step (or on
step, if the steps before it are valid), its draft the defaults
with values over them. The Settings app opens with it.
Sourcepub fn open_focus_wizard(
&self,
app: &AppHandle,
id: &str,
step: Option<&str>,
values: Values,
) -> Result<Json, String>
pub fn open_focus_wizard( &self, app: &AppHandle, id: &str, step: Option<&str>, values: Values, ) -> Result<Json, String>
Opens a wizard as Admin::open_wizard does, as a focus screen:
the main window’s whole page, whatever the app’s window setting
(pop.admin.window), with the shell’s menus, status bar and centre
hidden until it ends; the title bar stays, to move or quit. For a
setup run before anything else (a first launch).
Sourcepub fn open_sheet_wizard(
&self,
app: &AppHandle,
id: &str,
step: Option<&str>,
values: Values,
) -> Result<Json, String>
pub fn open_sheet_wizard( &self, app: &AppHandle, id: &str, step: Option<&str>, values: Values, ) -> Result<Json, String>
Opens a wizard as Admin::open_wizard does, as a sheet: a
window-modal dialog over the window it is opened from (the window
drawn, or the one whose command opened it), which blocks that
window alone; the other windows keep working. For a short wizard of
one to three steps of form fields. The Settings app does not open.
Finishing runs the wizard’s command, its answer to whatever opened
it, and closes the sheet; Cancel, Escape, or the window closing
end it with nothing run. Refused while another wizard runs.
Sourcepub fn focus_screen(&self) -> bool
pub fn focus_screen(&self) -> bool
Whether a wizard opened as a focus screen is running.
Sourcepub fn wizard_set(
&self,
app: &AppHandle,
values: Values,
) -> Result<Json, String>
pub fn wizard_set( &self, app: &AppHandle, values: Values, ) -> Result<Json, String>
Sets draft values.
Sourcepub fn wizard_next(&self, app: &AppHandle) -> Result<Json, String>
pub fn wizard_next(&self, app: &AppHandle) -> Result<Json, String>
Next: refused with the step’s first blocking problem.
pub fn wizard_back(&self, app: &AppHandle) -> Result<Json, String>
pub fn wizard_skip(&self, app: &AppHandle) -> Result<Json, String>
Sourcepub fn wizard_go(&self, app: &AppHandle, step: &str) -> Result<Json, String>
pub fn wizard_go(&self, app: &AppHandle, step: &str) -> Result<Json, String>
Goes to a step: lands on the first invalid one before it, if any, and says why.
Sourcepub fn wizard_finish(&self, app: &AppHandle) -> Result<Json, String>
pub fn wizard_finish(&self, app: &AppHandle) -> Result<Json, String>
Finishes: runs the wizard’s command with the draft, then closes it. Refused (and landed on the step) while a step is not valid.
Sourcepub fn wizard_cancel(
&self,
app: &AppHandle,
force: bool,
) -> Result<Json, String>
pub fn wizard_cancel( &self, app: &AppHandle, force: bool, ) -> Result<Json, String>
Cancels: asks first when anything was entered (unless force),
through the dialogs; without them, refused.
Sourcepub fn wizard_state(&self, app: &AppHandle) -> Json
pub fn wizard_state(&self, app: &AppHandle) -> Json
The flow’s state, for its commands’ answers and the collector: the step, the steps and their state, the draft, the problems.
Sourcepub fn last_finished(&self) -> Option<Json>
pub fn last_finished(&self) -> Option<Json>
What the last finish ran (the wizard, the command, its arguments).
Source§impl Admin
impl Admin
pub fn is_open(&self) -> bool
Sourcepub fn open(&self, app: &AppHandle, place: Option<&str>) -> Result<(), String>
pub fn open(&self, app: &AppHandle, place: Option<&str>) -> Result<(), String>
Opens it on a place: scope, scope/section, scope/section/key
or a setting id (None: where it was). Asked in a window of one of
the host’s foci, it edits that focus (focus).
Sourcepub fn close(&self, app: &AppHandle)
pub fn close(&self, app: &AppHandle)
Closes it, and the wizard running with it. In its window, it is
the window’s close (pop.window.close, the app asking): the app closes
in that call, its window’s listeners after it.
Sourcepub fn shown(&self) -> (Option<String>, Option<String>, String)
pub fn shown(&self) -> (Option<String>, Option<String>, String)
The scope, section and search shown.
Sourcepub fn manifest(&self, manifest: Manifest)
pub fn manifest(&self, manifest: Manifest)
Adds a manifest (checked when the tree is built: what does not resolve is left out and reported).
Sourcepub fn texts(&self, keys: &[StrKey])
pub fn texts(&self, keys: &[StrKey])
Registers the strings a manifest’s texts are, so they show in the interface’s language: a declared text (a section’s title, a group’s, a column’s, an action’s, a confirmation’s, an empty state’s, a row field’s and its choices’) equal to a key’s English fallback is shown translated. A text with no key shows as declared.
Sourcepub fn hook(&self, name: &str, hook: Hook) -> bool
pub fn hook(&self, name: &str, hook: Hook) -> bool
Registers a hook a manifest names; false when the name is taken.
Sourcepub fn widget_kind(
&self,
id: &str,
draw: impl Fn(&mut Ui, &AppHandle, &Json) + Send + Sync + 'static,
)
pub fn widget_kind( &self, id: &str, draw: impl Fn(&mut Ui, &AppHandle, &Json) + Send + Sync + 'static, )
Registers a widget kind: draws a node of its kind with its options
(shortcuts, gestures, fonts and settings-page are
egui-pop’s own). One that edits settings names them in its
options’ settings, so the generated pages leave them out.
Sourcepub fn widget_search(
&self,
kind: &str,
search: impl Fn(&Context, &AppHandle, &Json, &str) -> Vec<(String, String)> + Send + Sync + 'static,
)
pub fn widget_search( &self, kind: &str, search: impl Fn(&Context, &AppHandle, &Json, &str) -> Vec<(String, String)> + Send + Sync + 'static, )
Registers a widget kind’s search, so the Settings app’s search
finds the items inside a node of that kind (the shortcuts editor’s
commands, by name and by key). The settings a widget names in its
options’ settings are searched without it.
Sourcepub fn marked(&self) -> Option<String>
pub fn marked(&self) -> Option<String>
The item a deep link or a search hit landed on, marked while its section shows: a setting id, or a widget’s item key.
Sourcepub fn take_key(&self, key: &str) -> bool
pub fn take_key(&self, key: &str) -> bool
Whether key is the item to scroll to, taken once: the widget
that draws it scrolls to it.
Sourcepub fn diagnostics(&self) -> Diagnostics
pub fn diagnostics(&self) -> Diagnostics
The diagnostics of the last tree built.
Sourcepub fn tree(&self, app: &AppHandle) -> Tree
pub fn tree(&self, app: &AppHandle) -> Tree
The resolved tree: the declared settings’ pages (less the settings a manifest places), then every manifest, checked.
Sourcepub fn declare_scope(&self, extra: ExtraScope)
pub fn declare_scope(&self, extra: ExtraScope)
Declares a host value scope above those declared before it: a
value set for it wins over theirs and app’s. Declare them in
order, lowest first, before offering them; declaring one again
changes its label and about.
Sourcepub fn extra_scopes(&self) -> Vec<ExtraScope>
pub fn extra_scopes(&self) -> Vec<ExtraScope>
The host’s value scopes, lowest first.
Sourcepub fn extra_scope(&self, scope: ValueScope) -> Option<ExtraScope>
pub fn extra_scope(&self, scope: ValueScope) -> Option<ExtraScope>
A declared scope’s declaration.
Sourcepub fn offer(&self, scope: ValueScope, on: bool)
pub fn offer(&self, scope: ValueScope, on: bool)
Offers a host value scope for editing (the application opened its library, its workspace…), or takes it back.
Sourcepub fn offered(&self) -> Vec<ValueScope>
pub fn offered(&self) -> Vec<ValueScope>
The editable value scopes offered (app always).
Sourcepub fn load_layer(
&self,
app: &AppHandle,
scope: ValueScope,
values: BTreeMap<String, Json>,
)
👎Deprecated: attach a store::SettingsStore with Admin::attach_store
pub fn load_layer( &self, app: &AppHandle, scope: ValueScope, values: BTreeMap<String, Json>, )
store::SettingsStore with Admin::attach_storeReplaces a layer’s values (setting id to JSON), as the application keeps them with its library or workspace; the effective values change at once.
Sourcepub fn export_layer(&self, scope: ValueScope) -> BTreeMap<String, Json>
👎Deprecated: attach a store::SettingsStore with Admin::attach_store
pub fn export_layer(&self, scope: ValueScope) -> BTreeMap<String, Json>
store::SettingsStore with Admin::attach_storeA layer’s values, by setting id: what the application saves.
Sourcepub fn set_run(
&self,
app: &AppHandle,
id: &SettingId,
value: Json,
) -> Result<(), String>
pub fn set_run( &self, app: &AppHandle, id: &SettingId, value: Json, ) -> Result<(), String>
A command line override (--set key=value): shown as the command line origin, never edited.
Sourcepub fn set_in(
&self,
app: &AppHandle,
scope: ValueScope,
id: &SettingId,
value: Json,
) -> Result<(), String>
pub fn set_in( &self, app: &AppHandle, scope: ValueScope, id: &SettingId, value: Json, ) -> Result<(), String>
Sets a setting’s value in a value scope; app writes the store as
the settings form does (an undo step) unless a layer above holds
it.
Sourcepub fn allows(&self, app: &AppHandle, id: &SettingId, scope: ValueScope) -> bool
pub fn allows(&self, app: &AppHandle, id: &SettingId, scope: ValueScope) -> bool
Whether a setting opted into a host scope: in its declaration
(Descriptor::scopes) or on a field of a manifest placing it.
Sourcepub fn clear_in(
&self,
app: &AppHandle,
scope: ValueScope,
id: &SettingId,
) -> Result<(), String>
pub fn clear_in( &self, app: &AppHandle, scope: ValueScope, id: &SettingId, ) -> Result<(), String>
Takes a value scope’s value of a setting back: app goes back to
the default, a layer above to what is under it.
Sourcepub fn read(
&self,
app: &AppHandle,
command: &str,
args: &Json,
) -> Option<Result<Json, String>>
pub fn read( &self, app: &AppHandle, command: &str, args: &Json, ) -> Option<Result<Json, String>>
A read_only command’s answer: None while it is read for the
first time (the command is asked for, run before the next frame;
its result is taken from the runs). Read again after a refresh, it
answers what it answered before until the new answer comes
(Admin::refreshing says so meanwhile).
Sourcepub fn refreshing(&self, command: &str, args: &Json) -> bool
pub fn refreshing(&self, command: &str, args: &Json) -> bool
Whether the read of command with args shows its last answer
while a new one is read (after a refresh): a page marks it
“Refreshing…” and keeps its rows.
Sourcepub fn attach_reads(&self, kernel: Arc<ReadKernel>)
pub fn attach_reads(&self, kernel: Arc<ReadKernel>)
Reads the commands kernel’s transport serves through it: a
status or a list shows at once what the kernel holds, read again
in the background (crate::reads); the events the page looks at
reach the kernel’s policies, and a refresh makes its values out of
date without dropping them. Other commands are run as before.
Sourcepub fn reads(&self) -> Option<Arc<ReadKernel>>
pub fn reads(&self) -> Option<Arc<ReadKernel>>
The read kernel attached, if any.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Admin
impl RefUnwindSafe for Admin
impl Send for Admin
impl Sync for Admin
impl Unpin for Admin
impl UnsafeUnpin for Admin
impl UnwindSafe for Admin
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more